name: CI on: pull_request: # merge queue is required so all commits on target branches trigger this workflow # despite lack of the push event trigger here merge_group: branches: - main - next # merge group rulesets don't allow wildcards so in settings each maintenance branch needs to be added separately - "maintenance/v*" # branch rulesets don't support v[0-9]+ permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.sha }} cancel-in-progress: true jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: $/.github/actions/ci-setup - name: Build artifacts run: pnpm build - name: Upload artifacts uses: actions/upload-artifact@v7.0.2 with: # the size of the dist artifacts is not very large, so we can use better compression without a slowdown compression-level: 8 # store it for as short as possible, since we only need it for the same workflow run retention-days: 1 name: dist path: | packages/*/dist scripts/*/dist lint-workflows: name: Lint workflows runs-on: ubuntu-latest permissions: contents: read actions: read # only required in private repos security-events: write # allow writing security events steps: - name: Checkout repository uses: actions/checkout@v7.0.1 with: persist-credentials: false # Check every workflow for lockfile coverage and entries for removed dependencies. # Runtime enforcement only checks dependencies used by onboarded workflows. - name: Verify workflow lockfile run: | gh extension install github/gh-actions-lock --pin v0.5.0 gh actions-lock --verify env: GH_TOKEN: ${{ github.token }} - name: Run zizmor uses: zizmorcore/zizmor-action@v0.8.1 with: persona: pedantic annotations: true advanced-security: false test: name: "Test using Node ${{ matrix.node_version }} on ${{ matrix.os }}" needs: [build] runs-on: ${{ matrix.os }} timeout-minutes: 20 strategy: matrix: node_version: [22, 24, 26] os: [ubuntu-latest] include: # Active LTS + other OS - node_version: 24 os: macos-latest - node_version: 24 os: windows-latest fail-fast: false steps: - uses: $/.github/actions/ci-setup with: node-version: ${{ matrix.node_version }} download-dist: true - name: Check Git version run: git --version - name: Setup mock Git user run: git config --global user.email "you@example.com" && git config --global user.name "Your Name" - name: Vitest tests if: matrix.os != 'windows-latest' && !(matrix.node_version == 24 && matrix.os == 'ubuntu-latest') run: pnpm test # For Windows, run fixtures in the runner tempdir instead of os tempdir. The default tempdir # is in the D drive which is known to be slow: https://github.com/actions/runner-images/issues/8755 - name: Vitest tests on Windows if: matrix.os == 'windows-latest' run: pnpm test env: TEMP: ${{ runner.temp }} TMP: ${{ runner.temp }} # Run coverage only once on Ubuntu & node 24 to avoid duplicate codecov uploads - name: Vitest tests with coverage if: matrix.node_version == 24 && matrix.os == 'ubuntu-latest' run: pnpm test --coverage - name: Upload coverage uses: codecov/codecov-action@v7.1.1 if: matrix.node_version == 24 && matrix.os == 'ubuntu-latest' with: token: ${{ secrets.CODECOV_TOKEN }} e2e: name: E2E tests needs: [build] runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: $/.github/actions/ci-setup with: node-version: 24 download-dist: true install-e2e: true - name: Typecheck E2E tests run: pnpm --filter=@changesets/e2e types:check - name: Run E2E tests run: pnpm test:e2e typecheck: name: Typecheck needs: [build] runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: $/.github/actions/ci-setup with: download-dist: true - name: Typecheck run: pnpm types:check lint: name: Lint needs: [build] runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: $/.github/actions/ci-setup with: download-dist: true - name: Lint run: pnpm lint - name: Format run: pnpm format ci-ok: name: CI OK runs-on: ubuntu-latest if: always() needs: [lint-workflows, build, test, e2e, typecheck, lint] steps: - name: Exit with error if some jobs are not successful run: exit 1 if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}