Skip to content

coverage path is now OS-specific #18

coverage path is now OS-specific

coverage path is now OS-specific #18

Workflow file for this run

name: Rust
on:
push:
branches: [ "main", "development" ]
pull_request:
branches: [ "main", "development" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Set up coverage path
run: echo "COVERAGE_PATH=./coverage/" >> $GITHUB_ENV
if: runner.os == 'Linux' || runner.os == 'macOS'
- name: Set up coverage path for Windows
run: |
echo "COVERAGE_PATH=D:/coverage/" >> $GITHUB_ENV
mkdir -p D:/coverage
if: runner.os == 'Windows

Check failure on line 30 in .github/workflows/tests.yml

View workflow run for this annotation

GitHub Actions / Rust

Invalid workflow file

The workflow is not valid. .github/workflows/tests.yml (Line: 30, Col: 11): Unexpected symbol: ''Windows'. Located at position 14 within expression: runner.os == 'Windows
- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up environment for code coverage
run: |
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
echo "RUSTFLAGS=-C instrument-coverage" >> $GITHUB_ENV
echo "LLVM_PROFILE_FILE=${{ github.workspace }}/coverage/%p-%m.profraw" >> $GITHUB_ENV
- name: Install LLVM tools
run: rustup component add llvm-tools-preview
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Collecting code coverage
run: |
cargo install grcov
grcov ${GITHUB_WORKSPACE}/coverage/ -b ./target/debug/deps/ -s . -t lcov --llvm --branch --ignore-not-existing --output-path ${{ env.COVERAGE_PATH }} --token ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Print lcov.info for debugging
run: head -n 100 ./coverage/lcov.info
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.COVERAGE_PATH }}
flag-name: run-${{ matrix.rust }}
parallel: true
finish:
name: Finish submitting coverage
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
continue-on-error: true
with:
parallel-finished: true