Merge pull request #2 from rafaelvieiras/fix/ci-husky-and-release-bas… #12
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
| # quality-gate.yml — Generated by boatman | |
| # https://github.com/rafaelvieiras/boatman | |
| # | |
| # This workflow runs the quality gate on every push to main branches and PRs. | |
| # It compares metrics against baseline.json and blocks merges on regressions. | |
| name: Quality Gate | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| quality-gate: | |
| name: Quality Gate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| - name: Update npm | |
| run: npm install -g npm@11.6.2 | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| HUSKY: 0 | |
| - name: Run ESLint | |
| run: | | |
| mkdir -p reports | |
| npx eslint . --ext js,jsx --format json --output-file reports/eslint.json || true | |
| - name: Run tests with coverage | |
| run: | | |
| mkdir -p reports | |
| npm run test:coverage | |
| - name: Check code duplication | |
| run: | | |
| mkdir -p reports | |
| npx jscpd . --ignore "node_modules,coverage,reports" --reporters json --output reports/ || true | |
| - name: Run security audit | |
| run: | | |
| mkdir -p reports | |
| npm audit --json > reports/audit.json || true | |
| - name: Run mutation tests (Stryker) | |
| run: | | |
| mkdir -p reports/mutation | |
| npx stryker run || true | |
| - name: Run quality gate | |
| id: quality_gate | |
| run: node scripts/quality-gate.mjs > reports/quality-gate-report.md 2>&1; echo "exit_code=$?" >> $GITHUB_OUTPUT | |
| continue-on-error: true | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v3 | |
| with: | |
| path: reports/quality-gate-report.md | |
| recreate: true | |
| - name: Upload quality reports | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: quality-reports | |
| path: reports/ | |
| retention-days: 30 | |
| - name: Check quality gate result | |
| run: | | |
| if [ "${{ steps.quality_gate.outputs.exit_code }}" != "0" ]; then | |
| echo "Quality gate failed. See reports/quality-gate-report.md for details." | |
| exit 1 | |
| fi |