Fix/basic/path generator #4
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: Stash Test Suite | |
| on: | |
| push: | |
| branches: [ main, develop, 'feat/**' ] | |
| paths: | |
| - 'apps/cli/src/stash/**' | |
| - 'apps/cli/src/commands/stash.ts' | |
| - 'apps/cli/__tests__/**' | |
| - '.github/workflows/stash-tests.yml' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'apps/cli/src/stash/**' | |
| - 'apps/cli/src/commands/stash.ts' | |
| - 'apps/cli/__tests__/**' | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| node-version: [18.x, 20.x, 22.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: | | |
| cd apps/cli | |
| npm install | |
| - name: Run Stash Tests | |
| run: | | |
| cd apps/cli | |
| bash __tests__/scripts/run-all-tests.sh | |
| env: | |
| CI: true | |
| - name: Generate Test Report | |
| if: always() | |
| run: | | |
| cd apps/cli | |
| npm run test:coverage | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.os }}-node${{ matrix.node-version }} | |
| path: | | |
| apps/cli/coverage/ | |
| apps/cli/test-reports/ | |
| retention-days: 30 | |
| - name: Comment PR with Results | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| let comment = `## 🧪 Stash Test Results\n\n`; | |
| comment += `**OS**: ${{ matrix.os }}\n`; | |
| comment += `**Node**: ${{ matrix.node-version }}\n\n`; | |
| try { | |
| const coverage = JSON.parse( | |
| fs.readFileSync('apps/cli/coverage/coverage-summary.json', 'utf8') | |
| ); | |
| const total = coverage.total; | |
| comment += `### Coverage\n\n`; | |
| comment += `- **Lines**: ${total.lines.pct}%\n`; | |
| comment += `- **Statements**: ${total.statements.pct}%\n`; | |
| comment += `- **Functions**: ${total.functions.pct}%\n`; | |
| comment += `- **Branches**: ${total.branches.pct}%\n\n`; | |
| } catch (e) { | |
| comment += `_Coverage report not available_\n\n`; | |
| } | |
| comment += `**Status**: ${{ job.status }}\n`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - name: Install dependencies | |
| run: | | |
| cd apps/cli | |
| npm install | |
| - name: Generate Coverage Report | |
| run: | | |
| cd apps/cli | |
| npm run test:coverage | |
| - name: Upload Coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: apps/cli/coverage/coverage-final.json | |
| flags: stash-tests | |
| name: stash-coverage | |
| fail_ci_if_error: false | |