Initial public release #49
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm run test:ci | |
| - name: Extract coverage percentage | |
| run: | | |
| COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.statements.pct') | |
| echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV | |
| echo "Coverage: $COVERAGE%" | |
| - name: Create Coverage Badge | |
| uses: schneegans/dynamic-badges-action@v1.7.0 | |
| with: | |
| auth: ${{ secrets.GIST_TOKEN }} | |
| gistID: ${{ secrets.GIST_ID }} | |
| filename: coverage-badge.json | |
| label: Coverage | |
| message: ${{ env.COVERAGE }}% | |
| color: ${{ env.COVERAGE > 80 && 'brightgreen' || env.COVERAGE > 60 && 'yellow' || 'red' }} |