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

👷 Update LCOV to Version 2.2 #160

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/test-createx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,27 +144,49 @@ jobs:
FOUNDRY_PROFILE: default

- name: Run coverage
run: NO_COLOR=1 forge coverage --report summary --report lcov >> $GITHUB_STEP_SUMMARY
run: NO_COLOR=1 forge coverage --report summary --report lcov --lcov-version 2.2 >> $GITHUB_STEP_SUMMARY
env:
FOUNDRY_PROFILE: default

- name: Setup LCOV
- name: Set up LCOV
uses: hrishikesh-kadam/setup-lcov@v1
with:
ref: v2.2

# See https://github.com/ScopeLift/foundry-template/blob/fd3875d2e99a65dec19431723d6516b4ed76746e/.github/workflows/ci.yml#L49-L78.
- name: Remove unnecessary `test` directory
run: lcov --remove lcov.info 'test/*' --output-file lcov.info --rc lcov_branch_coverage=1
run: lcov --branch-coverage --remove lcov.info 'test/*' --output-file lcov.info --ignore-errors inconsistent,inconsistent

- name: Post coverage report
# See https://github.com/orgs/community/discussions/26829#discussioncomment-3253575.
if: ${{ (github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request') }}
uses: sunsergdev/lcov-reporter-action@v0.3.1-fork
if: ${{ (github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request') || (github.event.pull_request.head.repo.full_name != github.repository && github.event_name == 'pull_request_target') }}
uses: romeovs/lcov-reporter-action@v0.4.0
with:
title: "`CreateX` Test Coverage Report"
delete-old-comments: true
lcov-file: ./lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}

# The following steps act as a temporary workaround, as LCOV `2.2` is not yet supported
# in `zgosalvez/github-actions-report-lcov@v4`: https://github.com/zgosalvez/github-actions-report-lcov/issues/168.
- name: Set up LCOV `1.16`
run: |
wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz
tar -xzf lcov-1.16.tar.gz
cd lcov-1.16
sudo make install
lcov --version
sudo rm -rf lcov-1.16.tar.gz lcov-1.16

- name: Run coverage using LCOV `1.16`
run: forge coverage --report lcov --lcov-version 1.16
env:
FOUNDRY_PROFILE: default

# See https://github.com/ScopeLift/foundry-template/blob/fd3875d2e99a65dec19431723d6516b4ed76746e/.github/workflows/ci.yml#L49-L78.
- name: Remove unnecessary `test` directory
run: lcov --remove lcov.info 'test/*' --output-file lcov.info --rc lcov_branch_coverage=1

- name: Verify minimum coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"clean": "npx hardhat clean && forge clean",
"test": "forge test --out forge-artifacts",
"snapshot": "forge snapshot --out forge-artifacts",
"coverage": "forge coverage --report summary",
"coverage:report": "forge coverage --report lcov && lcov --remove lcov.info \"test/*\" --output-file lcov.info --rc lcov_branch_coverage=1 && genhtml lcov.info --branch-coverage --output-dir coverage",
"coverage": "forge coverage --report summary --out forge-artifacts --lcov-version 2.2",
"coverage:report": "forge coverage --report lcov --out forge-artifacts --lcov-version 2.2 && lcov --branch-coverage --remove lcov.info \"test/*\" --output-file lcov.info --ignore-errors inconsistent,inconsistent && genhtml lcov.info --branch-coverage --output-dir coverage --ignore-errors inconsistent,inconsistent",
"compile": "npx hardhat compile && forge build --out forge-artifacts",
"size": "npx hardhat size-contracts",
"abi": "npx hardhat export-abi",
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading