mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-05 23:15:40 -06:00
The coverage workflow was failing on Dependabot PRs because COVERALLS_REPO_TOKEN is not available to PRs from forks for security reasons. Add a conditional check to skip the upload step when the token is missing, while still running coverage generation. This allows PRs to pass CI while retaining coverage reports on master.
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
name: Code Coverage
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_TOOLCHAIN: nightly
|
|
|
|
jobs:
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: llvm-tools-preview
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Cache vcpkg
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: target/vcpkg
|
|
key: A-vcpkg-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
|
|
restore-keys: |
|
|
A-vcpkg-${{ runner.os }}-
|
|
|
|
- name: Vcpkg Linux Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libltdl-dev
|
|
|
|
- name: Vcpkg
|
|
run: |
|
|
cargo install cargo-vcpkg
|
|
cargo vcpkg -v build
|
|
working-directory: pacman
|
|
|
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
|
- uses: taiki-e/install-action@nextest
|
|
- uses: taiki-e/install-action@just
|
|
|
|
- name: Generate coverage report
|
|
run: |
|
|
just coverage
|
|
working-directory: pacman
|
|
|
|
- name: Coveralls upload
|
|
if: ${{ secrets.COVERALLS_REPO_TOKEN != '' }}
|
|
uses: coverallsapp/github-action@v2
|
|
with:
|
|
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
path-to-lcov: lcov.info
|
|
debug: true
|