Skip to content

Fix coverage.yml

Fix coverage.yml #89

Workflow file for this run

name: Coverage
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
coverage:
name: Run tests and generate coverage report
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw"
SPIFFE_ENDPOINT_SOCKET: unix:///tmp/spire-agent/public/api.sock
SPIRE_ADMIN_ENDPOINT_SOCKET: unix:///tmp/spire-agent/admin/api.sock
steps:
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
submodules: recursive
- name: Cache Project
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install toolchain
uses: ./.github/actions/setup-env
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install LLVM tools
run: rustup component add llvm-tools-preview
- name: Install grcov
run: cargo install grcov --locked
- name: Start SPIRE
run: .github/workflows/scripts/run-spire.sh
# Do NOT use --all-features due to mutually exclusive rustls providers.
- name: Run Tests (workspace defaults)
run: cargo test --workspace
- name: Run Tests (spiffe-rustls aws-lc-rs)
run: cargo test -p spiffe-rustls --no-default-features --features aws-lc-rs
- name: Generate Coveralls JSON Report
run: |
grcov . \
--binary-path ./target/debug/ \
-t coveralls \
--service-job-id "${{ github.run_id }}" \
-s . \
--ignore-not-existing \
--ignore "$HOME/.cargo/**" \
--ignore "*/proto/*" \
--ignore "*/spire-api-sdk/*" \
--ignore "*/build.rs" \
--keep-only '*/src/*' > coveralls.json
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-json: ./coveralls.json
- name: Clean up SPIRE
if: always()
run: .github/workflows/scripts/cleanup-spire.sh