From 58249ba281f691e27ae27d5f35a03dc148906eea Mon Sep 17 00:00:00 2001 From: Ante Budimir Date: Mon, 10 Mar 2025 15:34:40 +0200 Subject: [PATCH] =?UTF-8?q?ci=20=F0=9F=91=B7:=20add=20GitHub=20Actions=20w?= =?UTF-8?q?orkflow=20for=20linting=20and=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set up comprehensive CI pipeline with three jobs: - Lint: Runs ESLint and type checking - Test: Executes test suite with Coveralls integration - Build: Verifies package builds correctly The workflow uses pnpm and caches dependencies for faster runs. --- .github/workflows/ci.yml | 137 +++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 6 +- package.json | 2 +- src/index.ts | 2 +- vitest.config.mjs | 2 +- 5 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bbc54c0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,137 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + NODE_VERSION: '20.18.3' + PNPM_VERSION: '10.5.0' + COVERAGE_REPORT_PATH: './coverage/vitest-reports/lcov.info' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build package + run: pnpm build + + lint: + name: Lint + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build package + run: pnpm build + + - name: Run ESLint + run: pnpm lint + + - name: Run type checking + run: pnpm typecheck + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Run tests with coverage + run: pnpm test:coverage + + - name: Upload coverage to Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ${{ env.COVERAGE_REPORT_PATH }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ac533c..0aa99f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.5] - 2025-03-10 + +- Add GitHub Actions workflow for linting and testing () + ## [1.4.4] - 2025-03-10 -- Improve GitHub Actions workflow for release creation () +- Improve GitHub Actions workflow for release creation (d2b62d3) ## [1.4.3] - 2025-03-10 diff --git a/package.json b/package.json index 1770380..638235e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antebudimir/eslint-plugin-vanilla-extract", - "version": "1.4.4", + "version": "1.4.5", "description": "ESLint plugin for enforcing best practices in vanilla-extract CSS styles, including CSS property ordering and additional linting rules.", "author": "Ante Budimir", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index d3447ea..9202850 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import customOrderRule from './css-rules/custom-order/rule-definition.js'; export const vanillaExtract = { meta: { name: '@antebudimir/eslint-plugin-vanilla-extract', - version: '1.4.4', + version: '1.4.5', }, rules: { 'alphabetical-order': alphabeticalOrderRule, diff --git a/vitest.config.mjs b/vitest.config.mjs index 8615dc7..9cdea77 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -4,7 +4,7 @@ export default defineConfig({ test: { coverage: { provider: 'v8', - reporter: ['html', 'json', 'text'], + reporter: ['html', 'json', 'lcov', 'text'], reportsDirectory: './coverage/vitest-reports', include: ['src/css-rules/**/*.ts', 'src/shared-utils/**/*.ts'], exclude: ['src/**/*.css.ts', 'src/**/*index.ts', 'src/**/*types.ts'],