all environment flags should now be set properly on windows runners #30
This file contains 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: 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 environment variables | |
run: | | |
echo "COVERAGE_PATH=${GITHUB_WORKSPACE}/coverage/lcov.info" >> $GITHUB_ENV | |
mkdir -p ${GITHUB_WORKSPACE}/coverage | |
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 | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
- name: Set up environment variables for Windows | |
run: | | |
echo "COVERAGE_PATH=${GITHUB_WORKSPACE}/coverage/lcov.info" >> $env:GITHUB_ENV | |
echo "CARGO_INCREMENTAL=0" >> $env:GITHUB_ENV | |
echo "RUSTFLAGS=-C instrument-coverage" >> $env:GITHUB_ENV | |
echo "LLVM_PROFILE_FILE=${{ github.workspace }}/coverage/%p-%m.profraw" >> $env:GITHUB_ENV | |
mkdir -p ${GITHUB_WORKSPACE}/coverage | |
if: 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 | |
run: 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/ -s . --keep-only 'src/*' -t lcov --llvm --branch --ignore-not-existing --output-path ${{ env.COVERAGE_PATH }} --token ${{ secrets.COVERALLS_REPO_TOKEN }} | |
- 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 |