|
| 1 | +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json |
| 2 | + |
| 3 | +name: Weekly Coverage |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + paths: |
| 8 | + - .github/workflows/Coverage.yml |
| 9 | + schedule: |
| 10 | + # Runs every Monday at 06:00 UTC |
| 11 | + - cron: '0 6 * * 1' |
| 12 | + workflow_dispatch: # Allow manual trigger |
| 13 | + |
| 14 | +env: |
| 15 | + CARGO_TERM_COLOR: always |
| 16 | + RUST_BACKTRACE: full |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +defaults: |
| 22 | + run: |
| 23 | + shell: bash |
| 24 | + |
| 25 | +jobs: |
| 26 | + coverage: |
| 27 | + timeout-minutes: 90 |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + hypervisor: [kvm] |
| 32 | + cpu: [amd] |
| 33 | + runs-on: ${{ fromJson( |
| 34 | + format('["self-hosted", "Linux", "X64", "1ES.Pool=hld-{0}-{1}"]', |
| 35 | + matrix.hypervisor, |
| 36 | + matrix.cpu)) }} |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v6 |
| 39 | + |
| 40 | + - uses: hyperlight-dev/ci-setup-workflow@v1.9.0 |
| 41 | + with: |
| 42 | + rust-toolchain: "1.89" |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + |
| 46 | + - name: Fix cargo home permissions |
| 47 | + run: | |
| 48 | + sudo chown -R $(id -u):$(id -g) /opt/cargo || true |
| 49 | +
|
| 50 | + - name: Rust cache |
| 51 | + uses: Swatinem/rust-cache@v2 |
| 52 | + with: |
| 53 | + shared-key: "${{ runner.os }}-debug" |
| 54 | + cache-on-failure: "true" |
| 55 | + |
| 56 | + - name: Build guest binaries |
| 57 | + run: just guests |
| 58 | + |
| 59 | + - name: Install nightly toolchain |
| 60 | + run: | |
| 61 | + rustup toolchain install nightly |
| 62 | + rustup component add llvm-tools --toolchain nightly |
| 63 | +
|
| 64 | + - name: Generate coverage report |
| 65 | + run: just coverage-ci ${{ matrix.hypervisor }} |
| 66 | + |
| 67 | + - name: Coverage summary |
| 68 | + run: | |
| 69 | + echo '## Code Coverage Report' >> $GITHUB_STEP_SUMMARY |
| 70 | + echo '' >> $GITHUB_STEP_SUMMARY |
| 71 | + if [ -f target/coverage/summary.txt ]; then |
| 72 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 73 | + cat target/coverage/summary.txt >> $GITHUB_STEP_SUMMARY |
| 74 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 75 | + else |
| 76 | + echo 'Coverage report was not generated.' >> $GITHUB_STEP_SUMMARY |
| 77 | + fi |
| 78 | + echo '' >> $GITHUB_STEP_SUMMARY |
| 79 | + echo '> For a detailed per-file breakdown, download the **HTML coverage report** from the Artifacts section below.' >> $GITHUB_STEP_SUMMARY |
| 80 | +
|
| 81 | + - name: Upload HTML coverage report |
| 82 | + uses: actions/upload-artifact@v7 |
| 83 | + with: |
| 84 | + name: coverage-html-${{ matrix.hypervisor }}-${{ matrix.cpu }} |
| 85 | + path: target/coverage/html/ |
| 86 | + if-no-files-found: error |
| 87 | + |
| 88 | + - name: Upload LCOV coverage report |
| 89 | + uses: actions/upload-artifact@v7 |
| 90 | + with: |
| 91 | + name: coverage-lcov-${{ matrix.hypervisor }}-${{ matrix.cpu }} |
| 92 | + path: target/coverage/lcov.info |
| 93 | + if-no-files-found: error |
| 94 | + |
| 95 | + notify-failure: |
| 96 | + runs-on: ubuntu-latest |
| 97 | + needs: [coverage] |
| 98 | + if: always() && needs.coverage.result == 'failure' |
| 99 | + permissions: |
| 100 | + issues: write |
| 101 | + steps: |
| 102 | + - name: Checkout code |
| 103 | + uses: actions/checkout@v6 |
| 104 | + |
| 105 | + - name: Notify Coverage Failure |
| 106 | + run: ./dev/notify-ci-failure.sh --title="Weekly Coverage Failure - ${{ github.run_number }}" --labels="area/ci-periodics,area/testing,lifecycle/needs-review" |
| 107 | + env: |
| 108 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments