Skip to content

Commit

Permalink
ci: set up nyc coverage limits aligned with reality
Browse files Browse the repository at this point in the history
  • Loading branch information
boredland committed Aug 15, 2022
1 parent 8063a78 commit 96f9d7b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 7 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
env:
node-version: lts/*
redis-version: 7-alpine
allowed_coverage_change: -0.25

steps:
- name: Checkout repository
Expand All @@ -37,10 +38,33 @@ jobs:
- run: yarn install --frozen-lockfile --non-interactive
- run: yarn build
- run: yarn coverage
- name: Coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: yarn coveralls
- name: Upload LCOV to Coveralls
if: ${{ ( github.event_name == 'pull_request' && github.event.pull_request.head.fork == false ) || github.event_name == 'push' }}
uses: coverallsapp/github-action@3284643be2c47fb6432518ecec17f1255e8a06a6 # branch=master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Coverage change not below threshold
id: threshold
continue-on-error: true
run: |
sleep 2
COVERAGE_CHANGE=$(curl -s https://coveralls.io/builds/${{ github.sha }}.json | jq '.coverage_change')
echo coverage changed by ${COVERAGE_CHANGE}%
echo "COVERAGE_CHANGE=${COVERAGE_CHANGE}" >>$GITHUB_ENV
if [[ -z "$(echo ${COVERAGE_CHANGE} ${{ env.allowed_coverage_change }} | awk '$1 >= $2')" ]]; then
exit 1
fi
- name: Update action status
uses: Sibz/github-status-action@v1
if: ${{ success() || failure() }}
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: 'Coverage'
description: 'changed ${{ env.COVERAGE_CHANGE }}% (${{ env.allowed_coverage_change }}% allowed)'
state: steps.threshold.outcome
target_url: https://coveralls.io/builds/${{ github.sha }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}

compatibility:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ yarn-error.log*

# Coverage files
.nyc_output
coverage
coverage/*

# Editor directories and files
.idea
Expand Down
27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"clean:temp:files": "rimraf dist/cjs/bullmq.d.ts dist/esm/bullmq.d.ts dist/tsdoc-metadata.json",
"copy:lua": "copyfiles -f ./src/commands/*.lua ./dist/cjs/commands && copyfiles -f ./src/commands/*.lua ./dist/esm/commands",
"copy:includes:lua": "copyfiles -f ./src/commands/includes/*.lua ./dist/cjs/commands/includes && copyfiles -f ./src/commands/includes/*.lua ./dist/esm/commands/includes",
"coverage": "nyc --reporter=text npm run test",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"coverage": "nyc --reporter=text --reporter=lcovonly --reporter=json-summary yarn test",
"cm": "git cz",
"docs": "typedoc --excludeExternals --excludeProtected --excludePrivate --readme none src/index.ts",
"dc:up": "docker-compose -f docker-compose.yml up -d",
Expand Down Expand Up @@ -120,7 +119,29 @@
],
"exclude": [
"bullmq-tests/test_*.ts"
]
],
"lines": 80,
"functions": 80,
"branches": 70,
"statements": 80,
"watermarks": {
"lines": [
80,
95
],
"functions": [
80,
95
],
"branches": [
80,
95
],
"statements": [
80,
95
]
}
},
"config": {
"commitizen": {
Expand Down

0 comments on commit 96f9d7b

Please sign in to comment.