Skip to content

fix: am tests passing #2106

fix: am tests passing

fix: am tests passing #2106

Workflow file for this run

name: Run Coverage
on:
push:
workflow_dispatch: {}
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v2
run-coverage:
needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Load issue number
uses: actions/github-script@v6
id: get_issue_number
with:
script: |
let issue_number;
// Attempt to find a pull request associated with the commit
const pullRequests = await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
});
if (pullRequests.data.length > 0) {
issue_number = pullRequests.data[0].number;
} else {
throw new Error('No associated issue or pull request found.');
}
return issue_number;
result-encoding: string
- name: Checkout code
uses: actions/checkout@v2
- name: Install lcov
run: |
sudo apt-get install lcov
id: lcov
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run coverage
run: 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 (s3 link here)
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: report/*
- name: View Coverage (text here)
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: Comment the full report
uses: actions/github-script@v7
with:
script: |
let body = `${{ steps.print_coverage.outputs.comment_contents }}`;
github.rest.issues.createComment({
issue_number: ${{ steps.get_issue_number.outputs.result }},
owner: context.repo.owner,
repo: context.repo.repo,
body: `
\`\`\`
${body}
\`\`\`
`
})