refactor: renaming #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
workflow_dispatch: {} | |
jobs: | |
run-coverage: | |
name: Coverage | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Load issue number | |
uses: actions/github-script@v6 | |
id: get_issue_number | |
with: | |
script: | | |
const pullRequests = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
commit_sha: context.sha, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
if (pullRequests.data.length > 0) { | |
return pullRequests.data[0].number; | |
} else { | |
throw new Error('No associated pull request found.'); | |
} | |
result-encoding: string | |
- name: Install dependencies | |
run: | | |
sudo apt-get install lcov | |
id: lcov | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Run coverage | |
run: FOUNDRY_PROFILE=ci forge coverage --report lcov | |
env: | |
RPC_MAINNET: ${{ secrets.RPC_MAINNET }} | |
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }} | |
- name: Prune coverage report | |
run: lcov --remove ./lcov.info -o ./lcov.info.pruned 'src/test/*' 'script/*' '*Storage.sol' --ignore-errors inconsistent | |
- name: Generate reports | |
run: genhtml -o report ./lcov.info.pruned | |
- name: Upload coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: report/* | |
- name: View and log coverage | |
id: print_coverage | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "comment_contents<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(lcov --list ./lcov.info.pruned --ignore-errors inconsistent)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Log Coverage Report | |
run: echo "${{ steps.print_coverage.outputs.comment_contents }}" |