Merge pull request #669 from cluesmith/chore/pnpm-migration #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| unit: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Copy skeleton for unit tests | |
| working-directory: packages/codev | |
| run: pnpm copy-skeleton | |
| - name: Run unit tests with coverage | |
| working-directory: packages/codev | |
| run: | | |
| # Enable pipefail so a vitest failure is not masked by tee's exit code. | |
| # (GitHub Actions' default Linux shell is `bash -e {0}` without pipefail, | |
| # so without this line the pipeline exits with tee's status — always 0 — | |
| # and failing tests silently pass CI.) | |
| set -o pipefail | |
| # Vitest forks pool has a known issue where the worker process crashes | |
| # during cleanup after all tests pass (native module teardown). | |
| # Capture the output and check if all test files passed. | |
| pnpm exec vitest run --coverage 2>&1 | tee /tmp/vitest-output.txt; VITEST_EXIT=$? | |
| if [ $VITEST_EXIT -ne 0 ]; then | |
| # Check if all test files actually passed despite the exit code | |
| if grep -q "Test Files.*passed" /tmp/vitest-output.txt && ! grep -q "failed" /tmp/vitest-output.txt; then | |
| echo "::warning::Vitest worker crashed during cleanup but all tests passed" | |
| else | |
| exit $VITEST_EXIT | |
| fi | |
| fi | |
| integration: | |
| name: Tower Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build package | |
| working-directory: packages/codev | |
| run: pnpm build | |
| - name: Run tower integration tests | |
| working-directory: packages/codev | |
| run: pnpm exec vitest run --config vitest.e2e.config.ts --exclude 'src/commands/porch/__tests__/e2e/**' | |
| cli: | |
| name: CLI Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build package | |
| working-directory: packages/codev | |
| run: pnpm build | |
| - name: Run CLI integration tests | |
| working-directory: packages/codev | |
| run: pnpm exec vitest run --config vitest.cli.config.ts | |
| package: | |
| name: Package Install Verification | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build package | |
| working-directory: packages/codev | |
| run: pnpm build | |
| - name: Pack tarball | |
| working-directory: packages/codev | |
| run: pnpm pack | |
| - name: Verify install from tarball | |
| working-directory: packages/codev | |
| run: node scripts/verify-install.mjs cluesmith-codev-*.tgz | |