build(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 #50
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: Test | |
| on: | |
| push: | |
| branches: [main, develop] | |
| # paths: | |
| # - 'src/**' | |
| pull_request: | |
| branches: [main, develop] | |
| # paths: | |
| # - 'src/**' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Necessário para cobertura precisa | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests with coverage | |
| run: | | |
| npx vitest run --reporter=verbose --coverage --outputFile=coverage/coverage-summary.json | |
| # Garante que a pasta de relatório existe | |
| mkdir -p coverage/lcov-report | |
| - name: Generate Coverage Badge | |
| if: success() && github.ref == 'refs/heads/main' # Só executa se os testes passarem na branch main | |
| run: | | |
| # Extrai a cobertura do relatório HTML | |
| COVERAGE=$(grep -E "All files.+[0-9.]+%" coverage/lcov-report/index.html | awk '{print $NF}' || echo "unknown") | |
| # COVERAGE=$(jq -r '.total.statements.pct' coverage/coverage-summary.json) | |
| echo "{\"coverage\":\"$COVERAGE\"}" > coverage-badge.json | |
| echo "✔️ Coverage: $COVERAGE" | |
| - name: Upload artifacts | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage-badge.json | |
| coverage/coverage-summary.json | |
| coverage/lcov-report | |
| retention-days: 3 |