Skip to content

chore: checkpoint workspace changes #413

chore: checkpoint workspace changes

chore: checkpoint workspace changes #413

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
pull_request:
jobs:
lint:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run ESLint
run: pnpm lint:eslint
- name: Run typecheck
run: pnpm typecheck
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test
- name: Build
run: pnpm run build
mutation:
name: Mutation Tests
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run mutation tests
run: pnpm test:mutation
- name: Upload Stryker reports
if: always()
uses: actions/upload-artifact@v4
with:
name: stryker-reports
path: |
coverage/stryker.html
coverage/stryker.json
if-no-files-found: ignore
release:
name: Release
runs-on: ubuntu-latest
needs:
- lint
- test
if: >-
${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && (startsWith(github.event.head_commit.message, 'chore: release v') || startsWith(github.event.head_commit.message, 'hotfix: release v')) }}
permissions:
contents: write
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate release secrets
run: |
if [ -z "$NPM_TOKEN" ]; then
echo "NPM_TOKEN secret is required to publish" >&2
exit 1
fi
- name: Configure npm auth
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- name: Read release metadata
id: release_meta
run: |
VERSION=$(node -p "require('./package.json').version")
if [ -z "$VERSION" ]; then
echo "Unable to read package version" >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
NOTES_FILE=release-notes.txt
git tag -l --format='%(contents)' "v$VERSION" > "$NOTES_FILE"
if [ ! -s "$NOTES_FILE" ]; then
echo "Release notes missing from tag v$VERSION" >&2
exit 1
fi
NOTES_DELIM="NOTES_$(date +%s)_$RANDOM"
{
echo "notes<<${NOTES_DELIM}"
cat "$NOTES_FILE"
echo "${NOTES_DELIM}"
} >> "$GITHUB_OUTPUT"
- name: Build package
run: pnpm run build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
run: pnpm publish --access public
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.release_meta.outputs.version }}
name: Release ${{ steps.release_meta.outputs.version }}
body: ${{ steps.release_meta.outputs.notes }}