Skip to content

refactor(cli-core): remove configstore dependency, use sync config I/O #3713

refactor(cli-core): remove configstore dependency, use sync config I/O

refactor(cli-core): remove configstore dependency, use sync config I/O #3713

Workflow file for this run

name: Test
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ github.event_name == 'push' || steps.filter.outputs.code == 'true' }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: filter
with:
predicate-quantifier: 'every'
filters: |
code:
- '**'
- '!**/*.md'
- '!LICENSE'
- '!.editorconfig'
- '!.prettierrc'
- '!.prettierignore'
- '!.claude/**'
- '!.cursor/**'
- '!.gitignore'
- '!.husky/**'
- '!.changeset/**'
- '!.github/workflows/**'
- '!.github/renovate.json'
- '!knip.config.ts'
- '!commitlint.config.ts'
- '!release-please-config.json'
- '!.release-please-manifest.json'
test:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: ${{ matrix.os }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
strategy:
matrix:
include:
# Linux: 6 shards × 3 Node versions
- {os: ubuntu-latest, node-version: 20, shardIndex: 1, shardTotal: 6}
- {os: ubuntu-latest, node-version: 20, shardIndex: 2, shardTotal: 6}
- {os: ubuntu-latest, node-version: 20, shardIndex: 3, shardTotal: 6}
- {os: ubuntu-latest, node-version: 20, shardIndex: 4, shardTotal: 6}
- {os: ubuntu-latest, node-version: 20, shardIndex: 5, shardTotal: 6}
- {os: ubuntu-latest, node-version: 20, shardIndex: 6, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 1, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 2, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 3, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 4, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 5, shardTotal: 6}
- {os: ubuntu-latest, node-version: 22, shardIndex: 6, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 1, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 2, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 3, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 4, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 5, shardTotal: 6}
- {os: ubuntu-latest, node-version: 24, shardIndex: 6, shardTotal: 6}
# Windows: 4 shards × 3 Node versions
- {os: windows-8core, node-version: 20, shardIndex: 1, shardTotal: 4}
- {os: windows-8core, node-version: 20, shardIndex: 2, shardTotal: 4}
- {os: windows-8core, node-version: 20, shardIndex: 3, shardTotal: 4}
- {os: windows-8core, node-version: 20, shardIndex: 4, shardTotal: 4}
- {os: windows-8core, node-version: 22, shardIndex: 1, shardTotal: 4}
- {os: windows-8core, node-version: 22, shardIndex: 2, shardTotal: 4}
- {os: windows-8core, node-version: 22, shardIndex: 3, shardTotal: 4}
- {os: windows-8core, node-version: 22, shardIndex: 4, shardTotal: 4}
- {os: windows-8core, node-version: 24, shardIndex: 1, shardTotal: 4}
- {os: windows-8core, node-version: 24, shardIndex: 2, shardTotal: 4}
- {os: windows-8core, node-version: 24, shardIndex: 3, shardTotal: 4}
- {os: windows-8core, node-version: 24, shardIndex: 4, shardTotal: 4}
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Setup Environment
uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- name: Set Turbo cache bypass on rerun
if: github.run_attempt > 1
shell: bash
run: echo "TURBO_FORCE=true" >> $GITHUB_ENV
- name: Restore Vitest cache
uses: actions/cache@v5
with:
path: node_modules/.vite/vitest
key: vitest-cache-${{ matrix.os }}-node${{ matrix.node-version }}-shard${{ matrix.shardIndex }}-${{ github.run_id }}
restore-keys: |
vitest-cache-${{ matrix.os }}-node${{ matrix.node-version }}-shard${{ matrix.shardIndex }}-
- name: Test on ${{ matrix.os }}
shell: bash
env:
SANITY_AUTH_TOKEN: 'test-token'
run: |
ARGS="--test-timeout=60000 --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
# We only gather coverage from Node 20 on Ubuntu
if [ "${{ matrix.node-version }}" == "20" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
# We pass in `--reporter=blob` so that we can combine the results from all shards.
ARGS="$ARGS --coverage --reporter=default --reporter=blob"
fi
pnpm test $ARGS
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() && matrix.node-version == '20' && matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v7
with:
name: blob-report-${{ github.run_id }}-${{ matrix.shardIndex }}
path: '.vitest-reports/*'
include-hidden-files: true
retention-days: 1
report-coverage:
needs: [changes, test]
if: ${{ !cancelled() && needs.changes.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Node 24 required: runs .ts files directly via built-in type stripping
- name: Setup Environment
uses: ./.github/actions/setup
with:
node-version: 24
- name: 'Download coverage artifacts'
uses: actions/download-artifact@v8
with:
path: .vitest-reports
pattern: blob-report-${{ github.run_id }}-*
merge-multiple: true
- name: Merged report
run: |
pnpm vitest run --merge-reports --coverage
- name: Prepare coverage baseline
if: github.ref == 'refs/heads/main'
run: |
mkdir -p coverage/baseline
cp coverage/coverage-summary.json coverage/baseline/coverage-summary.json
echo "${{ github.sha }}" > coverage/baseline/sha.txt
- name: Save coverage baseline to cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v5
with:
path: coverage/baseline
key: coverage-main-${{ github.sha }}
# The exact key won't match on PRs (PR SHA ≠ main SHA); restore-keys picks up the latest main entry.
- name: Restore main branch coverage baseline
if: github.event_name == 'pull_request'
uses: actions/cache/restore@v5
with:
path: coverage/baseline
key: coverage-main-${{ github.sha }}
restore-keys: |
coverage-main-
- name: Post coverage delta
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: node packages/@repo/coverage-delta/src/coverage-delta.ts
test-status:
if: always()
needs: [changes, test, report-coverage]
runs-on: ubuntu-latest
steps:
- name: Check status
run: |
# Fail if any needed job failed or was cancelled
results=("${{ needs.changes.result }}" "${{ needs.test.result }}" "${{ needs.report-coverage.result }}")
for result in "${results[@]}"; do
if [ "$result" == "failure" ] || [ "$result" == "cancelled" ]; then
echo "Job failed or was cancelled: $result"
exit 1
fi
done
echo "All jobs passed or were skipped"