Skip to content

Fix build_release workflow permissions #151

Fix build_release workflow permissions

Fix build_release workflow permissions #151

Workflow file for this run

name: Coverage
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
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: Cache external binaries
uses: actions/cache@v4
id: cache-binaries
with:
path: external/
key: ${{ runner.os }}-binaries-v5
restore-keys: |
${{ runner.os }}-binaries-
- name: Download binaries (Linux)
if: steps.cache-binaries.outputs.cache-hit != 'true'
run: |
mkdir -p external/bin/linux external/lib/linux
# Download and extract inf-llc
curl -L "https://storage.googleapis.com/external_binaries/linux/bin/inf-llc.zip" -o /tmp/inf-llc.zip
unzip -o /tmp/inf-llc.zip -d external/bin/linux/
# Download and extract rust-lld
curl -L "https://storage.googleapis.com/external_binaries/linux/bin/rust-lld.zip" -o /tmp/rust-lld.zip
unzip -o /tmp/rust-lld.zip -d external/bin/linux/
# Download and extract libLLVM
curl -L "https://storage.googleapis.com/external_binaries/linux/lib/libLLVM.so.21.1-rust-1.94.0-nightly.zip" -o /tmp/libLLVM.zip
unzip -o /tmp/libLLVM.zip -d external/lib/linux/
# Make executables
chmod +x external/bin/linux/inf-llc external/bin/linux/rust-lld
- name: Install Rust toolchain
run: |
rustup update nightly
rustup default nightly
rustup component add llvm-tools-preview
- name: Install LLVM 21
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21
sudo apt-get install -y llvm-21-dev libpolly-21-dev
- name: Set LLVM Prefix
run: |
echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> $GITHUB_ENV
- 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-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: 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
- name: Run tests with coverage for core crates
run: |
cargo llvm-cov \
--workspace \
--exclude inference-tests \
--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@v5
with:
files: ./lcov.info
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}