Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve coverage action #73

Merged
merged 9 commits into from
Jul 4, 2024
Merged
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Coverage check on main push
name: Coverage Check

on: [push]

Expand All @@ -7,6 +7,7 @@ env:

jobs:
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest

steps:
Expand All @@ -28,7 +29,7 @@ jobs:

- name: Run coverage
shell: bash
run: forge coverage --report summary --report lcov
run: forge coverage --report summary --report lcov --match-contract Unit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • when writing .tree files, the Unit part of the module under test is usually skipped (at least it is on this repo)
  • then, if testcases are generated with bulloak scaffold, the contract names won't include Unit
  • therefore, those tests won't be run, and we'll have false CI negatives and lack of coverage

I'd pass --match-path test/unit/* instead (remember match path uses globs instead of regex)

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
Expand All @@ -43,7 +44,7 @@ jobs:
coverage-files: lcovNew.info

- name: Retrieve previous coverage
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: coverage.info
continue-on-error: true
Expand All @@ -66,7 +67,7 @@ jobs:
mv lcovNew.info coverage.info

- name: Upload the new coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage.info
path: ./coverage.info
path: ./coverage.info
Loading