Skip to content

Commit

Permalink
feat: coverage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-mendez committed Aug 4, 2024
1 parent 0866c55 commit 58ae588
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ jobs:
run: npm ci
- name: Test
run: npm run test
coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: npm ci
- name: Generate coverage report
run: npm run coverage
- name: Check coverage
run: |
COVERAGE=$(cat coverage/lcov.info | grep 'Lines' | sed 's/^.*: \([0-9.]*\)%.*$/\1/')
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "Code coverage is less than 90%"
exit 1
fi
build:
needs: test
runs-on: ubuntu-latest
Expand Down

0 comments on commit 58ae588

Please sign in to comment.