Skip to content

Merge pull request #23 from SimplyLiz/feature/ic-former-inspired-impr… #72

Merge pull request #23 from SimplyLiz/feature/ic-former-inspired-impr…

Merge pull request #23 from SimplyLiz/feature/ic-former-inspired-impr… #72

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
tags: ['v*.*.*']
pull_request:
branches: [main, develop]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
dependency-review:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm audit --omit=dev --audit-level=high
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx eslint .
- run: npx prettier --check .
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Run tests
run: |
if [ "${{ matrix.node-version }}" = "18" ]; then
npm test
else
npm run test:coverage
fi
- name: Upload coverage
if: matrix.node-version == 22
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Coverage report on PR
if: matrix.node-version == 22 && github.event_name == 'pull_request'
uses: davelosert/vitest-coverage-report-action@v2
continue-on-error: true
- run: npx tsc --noEmit
bench:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run bench:check
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- name: Build, pack, lint, and smoke test
run: npm run test:e2e
publish:
needs: [audit, lint, test, bench, e2e]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: npm
- run: npm ci
- name: Validate version tag
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
exit 1
fi
- name: Validate changelog entry
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
if ! grep -q "## \[${TAG_VERSION}\]" CHANGELOG.md; then
echo "::error::No CHANGELOG.md entry found for version ${TAG_VERSION}"
exit 1
fi
- run: npm publish --provenance --access public
- name: Extract release notes
id: release_notes
uses: ffurrer2/extract-release-notes@v3
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.release_notes.outputs.release_notes }}