Merge pull request #216 from conjure-cp/dependabot/cargo/all-b4d90a9b83 #11
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: "Code and Documentation Coverage (main)" | |
on: | |
push: | |
branches: | |
- main # run for pushes to the main branch | |
workflow_dispatch: | |
env: | |
rust_release: nightly | |
jobs: | |
coverage: | |
name: "Generate Code Coverage Reports" | |
# only do coverage for ready PRs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
target | |
solvers/minion/vendor | |
solvers/chuffed/vendor | |
key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} | |
restore-keys: ${{ runner.os }}-${{ env.rust_release }} | |
- name: Install rust ${{ env.rust_release }} | |
run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} | |
- uses: ./.github/actions/install-conjure | |
with: | |
os_arch: linux | |
version: 2.5.1 | |
- name: Generate coverage reports | |
run: | | |
./tools/coverage.sh | |
- name: Print documentation coverage to job summary | |
run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
RUSTDOCFLAGS='-Z unstable-options --show-coverage' cargo +nightly doc --workspace --no-deps | tee -a /dev/fd/2 >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
- name: Generate documentation coverage JSON for diffs in PRs | |
run: | | |
RUSTDOCFLAGS='-Z unstable-options --output-format json --show-coverage' cargo +nightly doc --workspace --no-deps > rustdoc-coverage-report.json | |
- run: | | |
mkdir -p deploy/ | |
cp -r target/debug/coverage/* deploy/ # html | |
cp target/debug/lcov.info deploy/ # used for diffing code coverage in PR comments | |
cp rustdoc-coverage-report.json deploy/ # used for diffing doc coverage in PR comments | |
- name: Copy coverage report to /main. | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ./deploy | |
target-folder: "coverage/main" | |
branch: gh-pages | |
commit-message: "Actions: Update code coverage for main " |