Support the SpaceWasm compilation target (#325) #716
Workflow file for this run
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: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - 'book/**' | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - 'book/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: "-C instrument-coverage" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Install llvm-tools | |
| run: rustup component add llvm-tools-preview | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-index- | |
| # `target/llvm-cov-target` is deliberately excluded: `cargo llvm-cov | |
| # report` unions coverage regions from every binary it finds there, so a | |
| # cached binary built from an earlier commit maps its stale line table | |
| # onto the current sources and invents phantom (un)covered lines. | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| target | |
| !target/llvm-cov-target | |
| key: ${{ runner.os }}-cargo-build-coverage-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-build-coverage- | |
| ${{ runner.os }}-cargo-build- | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| # The infs integration suite aborts under CI when `wasmtime` is missing or | |
| # when it cannot resolve `infc`, so both must be provisioned here or the | |
| # coverage run fails outright. | |
| - name: Install wasmtime | |
| uses: bytecodealliance/actions/wasmtime/setup@v1 | |
| # A cache restored via the fallback keys may predate the exclusion above | |
| # and still carry stale coverage artifacts; start every run from a clean | |
| # slate regardless of what the cache brought in. `cargo llvm-cov clean` | |
| # only touches `target/llvm-cov-target`, so this may sit on either side of | |
| # the `infc` build below; it precedes it to keep provisioning adjacent to | |
| # the run that consumes it. | |
| - name: Clean stale coverage artifacts | |
| run: cargo llvm-cov clean --workspace | |
| # The suite resolves `infc` from the directory holding the running test | |
| # binary, which under cargo-llvm-cov is its private instrumented target | |
| # directory. Building an uninstrumented compiler here and pinning it below | |
| # keeps the ~70 spawns from each emitting profraw data that would be | |
| # unioned into the report and reattributed onto the compiler's own lines. | |
| - name: Build infc for tests that spawn the real compiler | |
| env: | |
| RUSTFLAGS: "" | |
| run: cargo build -p inference-cli | |
| - name: Run tests with coverage for core crates | |
| env: | |
| INFERENCE_TEST_INFC: ${{ github.workspace }}/target/debug/infc | |
| run: | | |
| cargo llvm-cov \ | |
| --workspace \ | |
| --exclude inference-playground-server \ | |
| --exclude wasm-fmt \ | |
| --exclude wat-fmt \ | |
| --exclude inf-wast \ | |
| --exclude inf-wasmparser \ | |
| --no-report | |
| - name: Generate lcov report from collected coverage | |
| run: | | |
| cargo llvm-cov report --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v6.0.2 | |
| with: | |
| files: ./lcov.info | |
| fail_ci_if_error: true | |
| verbose: true | |
| token: ${{ secrets.CODECOV_TOKEN }} |