Improve CI #5
This file contains hidden or 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: Coverage | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| workflow_dispatch: | |
| env: | |
| FOUNDRY_PROFILE: ci | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run coverage | |
| run: | | |
| forge coverage --report summary --report lcov | |
| ls -la lcov.info || echo "lcov.info not found" | |
| - name: Generate coverage report | |
| if: github.event_name == 'pull_request' | |
| env: | |
| COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
| REPO_OWNER: ${{ github.repository_owner }} | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| node .github/scripts/coverage-comment.js | |
| echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> coverage-data.txt | |
| echo "COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> coverage-data.txt | |
| echo "REPO_OWNER=${{ github.repository_owner }}" >> coverage-data.txt | |
| echo "REPO_NAME=${{ github.event.repository.name }}" >> coverage-data.txt | |
| echo "Generated coverage report for PR #${{ github.event.pull_request.number }}" | |
| - name: Upload coverage data | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-data | |
| path: | | |
| coverage-report.md | |
| coverage-data.txt | |
| retention-days: 1 |