fix: fail CI on test timeout and upload vitest report on failure (closes #706) #708
Workflow file for this run
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: Branch Protection | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| jobs: | |
| security-audit: | |
| runs-on: ubuntu-latest | |
| name: Dependency Security Audit | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate audit report | |
| run: pnpm audit --json > audit-report.json || true | |
| - name: Run security audit (block on high/critical) | |
| run: pnpm audit --audit-level=high | |
| - name: Upload audit report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dependency-audit-report | |
| path: audit-report.json | |
| retention-days: 30 | |
| quality-checks: | |
| runs-on: ubuntu-latest | |
| name: Type Check, Lint & Validation | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Type Check | |
| run: pnpm run type-check | |
| - name: Run Lint | |
| run: pnpm run lint | |
| - name: Validate UI | |
| run: pnpm run validate:ui | |
| - name: Validate Web3 | |
| run: pnpm run validate:web3 | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [quality-checks] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Build | |
| run: pnpm run build | |
| env: | |
| NEXT_PUBLIC_STARKNET_NETWORK: goerli-alpha | |
| - name: Verify Build Output | |
| run: | | |
| if [ -f .next/build-manifest.json ]; then | |
| echo "✅ Build completed successfully" | |
| else | |
| echo "❌ Build failed - no manifest found" | |
| exit 1 | |
| fi | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run Tests | |
| timeout-minutes: 5 | |
| run: pnpm run test -- --reporter=default --reporter=json --outputFile=vitest-report.json | |
| - name: Upload test report on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vitest-report | |
| path: vitest-report.json | |
| retention-days: 7 |