Coverage (Daily) #288
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 (Daily) | |
| on: | |
| schedule: | |
| - cron: "30 8 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| compute-image-tag: | |
| uses: ./.github/workflows/compute-image-tag.yaml | |
| coverage: | |
| name: Coverage | |
| needs: compute-image-tag | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 180 | |
| env: | |
| RUSTFLAGS: -D warnings | |
| container: | |
| image: zingodevops/ci-build:${{ needs.compute-image-tag.outputs.image-tag }} | |
| options: --security-opt seccomp=unconfined | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest@0.9.78 | |
| - name: Install system deps | |
| run: | | |
| apt-get update | |
| apt-get install -y libsqlite3-dev pkg-config | |
| - name: create binaries dir | |
| run: mkdir -p ./test_binaries/bins | |
| - name: Symlink lightwalletd and zcash binaries | |
| run: ln -s /usr/bin/lightwalletd /usr/bin/zainod /usr/bin/zebrad ./test_binaries/bins/ | |
| - name: Cargo cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Run instrumented tests | |
| run: cargo llvm-cov nextest --workspace --no-report | |
| - name: Generate LCOV report | |
| run: cargo llvm-cov report --lcov --output-path lcov.info | |
| - name: Generate HTML report | |
| run: cargo llvm-cov report --html --output-dir coverage-html | |
| - name: Generate coverage badge | |
| run: | | |
| COVERAGE=$(cargo llvm-cov report --json \ | |
| | jq '.data[0].totals.lines.percent' \ | |
| | xargs printf '%.1f') | |
| if [ "$(echo "$COVERAGE >= 80" | bc)" -eq 1 ]; then COLOR="brightgreen" | |
| elif [ "$(echo "$COVERAGE >= 60" | bc)" -eq 1 ]; then COLOR="yellow" | |
| else COLOR="red"; fi | |
| jq -n --arg pct "${COVERAGE}%" --arg color "$COLOR" \ | |
| '{schemaVersion:1, label:"coverage", message:$pct, color:$color}' \ | |
| > coverage-html/badge.json | |
| - name: Upload to codecov.io | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./lcov.info | |
| fail_ci_if_error: true | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./coverage-html | |
| destination_dir: coverage | |
| force_orphan: true |