Skip to content

Commit

Permalink
chore: use a new github action for coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
adjisb committed Sep 19, 2023
1 parent 889a89d commit 84d2f99
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
cache: 'yarn'

- name: Installing dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
shell: bash

- name: Derive appropriate SHAs for base and head for `nx affected` commands
Expand Down
34 changes: 14 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI
on: push
on: pull_request
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -28,6 +31,7 @@ jobs:
- name: Running tests
run: yarn test:ci


coverage:
runs-on: ubuntu-latest
steps:
Expand All @@ -37,30 +41,20 @@ jobs:
- name: Running coverage
run: yarn coverage:ci

- name: Coverage created?
id: check_coverage
run: |
if [ -s $GITHUB_WORKSPACE/coverage/lcov.info ] ; then
echo "check_result=true" >> $GITHUB_OUTPUT
echo "lcov.info FILE exists and has a size greater than zero"
else
echo "check_result=false" >> $GITHUB_OUTPUT
echo "lcov.info does not exists or has size zero"
fi
- name: Report coverage
if: steps.check_coverage.outputs.check_result == 'true'
uses: romeovs/[email protected]
uses: adjisb/code-coverage-assistant@master
with:
lcov-file: ./coverage/lcov.info
monorepo-base-path: "./packages"
exclude: "core"
github-token: ${{ secrets.GITHUB_TOKEN }}
min_coverage: 90
badge_path: "./badges"

- name: Enforce coverage
if: steps.check_coverage.outputs.check_result == 'true'
uses: VeryGoodOpenSource/very_good_coverage@v2
- name: Deploy badges
uses: peaceiris/actions-gh-pages@v3
with:
path: ./coverage/lcov.info
min_coverage: 80
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./badges

deploy:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"deploy": "nx run-many --target=deploy",
"all": "nx run-many --all --parallel --targets=lint,format,test,deploy && nx run-many --all --targets=coverage",
"test:ci": "nx affected --target=test --parallel=1",
"coverage:ci": "nx affected --target=coverage --parallel=1 && istanbul-combine -r lcov -r html 'packages/*/coverage.json'",
"coverage:ci": "nx affected --target=coverage --parallel=1",
"lint:ci": "nx affected --target=lint",
"format:ci": "nx affected --target=format",
"deploy:ci": "nx affected --target=deploy --parallel=1",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"keywords": [
"ethereum",
"smart-contracts",
"The Sandbox"
"The Sandbox",
"matic"
],
"resolutions": {
"websocket": "1.0.32"
Expand Down
8 changes: 7 additions & 1 deletion packages/example-hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,11 @@
"ts-node": "^10.9.1",
"typechain": "^8.2.0",
"typescript": "5.0.4"
}
},
"keywords": [
"ethereum",
"polygon",
"smart-contracts",
"The Sandbox"
]
}

0 comments on commit 84d2f99

Please sign in to comment.