ci 👷: add GitHub Actions workflow for linting and testing

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.
This commit is contained in:
Ante Budimir 2025-03-10 15:34:40 +02:00
parent d2b62d3995
commit 58249ba281
5 changed files with 145 additions and 4 deletions

137
.github/workflows/ci.yml vendored Normal file
View file

@ -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 }}

View file

@ -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/), 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). 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 ## [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 ## [1.4.3] - 2025-03-10

View file

@ -1,6 +1,6 @@
{ {
"name": "@antebudimir/eslint-plugin-vanilla-extract", "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.", "description": "ESLint plugin for enforcing best practices in vanilla-extract CSS styles, including CSS property ordering and additional linting rules.",
"author": "Ante Budimir", "author": "Ante Budimir",
"license": "MIT", "license": "MIT",

View file

@ -5,7 +5,7 @@ import customOrderRule from './css-rules/custom-order/rule-definition.js';
export const vanillaExtract = { export const vanillaExtract = {
meta: { meta: {
name: '@antebudimir/eslint-plugin-vanilla-extract', name: '@antebudimir/eslint-plugin-vanilla-extract',
version: '1.4.4', version: '1.4.5',
}, },
rules: { rules: {
'alphabetical-order': alphabeticalOrderRule, 'alphabetical-order': alphabeticalOrderRule,

View file

@ -4,7 +4,7 @@ export default defineConfig({
test: { test: {
coverage: { coverage: {
provider: 'v8', provider: 'v8',
reporter: ['html', 'json', 'text'], reporter: ['html', 'json', 'lcov', 'text'],
reportsDirectory: './coverage/vitest-reports', reportsDirectory: './coverage/vitest-reports',
include: ['src/css-rules/**/*.ts', 'src/shared-utils/**/*.ts'], include: ['src/css-rules/**/*.ts', 'src/shared-utils/**/*.ts'],
exclude: ['src/**/*.css.ts', 'src/**/*index.ts', 'src/**/*types.ts'], exclude: ['src/**/*.css.ts', 'src/**/*index.ts', 'src/**/*types.ts'],