Skip to content

Revive CLI tooling #379

Revive CLI tooling

Revive CLI tooling #379

Workflow file for this run

name: Build, Test & Coverage
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
rust-version:
- stable
- nightly
cargo-args:
- ''
- '--all-features'
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo binaries
uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
- name: Toolchain setup
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: llvm-tools-preview
- name: Install grcov
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
- name: Run tests
run: cargo test --all-features --no-fail-fast
env:
RUSTFLAGS: '-Cinstrument-coverage'
- name: Run grcov
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
# Important! Keep in grcov flags in sync with Makefile.internal.toml.
run: >
grcov .
--binary-path target/debug/deps/
--source-dir .
--branch
--ignore-not-existing
--ignore '../**'
--ignore '/*'
--ignore 'fluent-testing/*'
--ignore 'fluent-syntax/src/bin/*'
--output-type 'lcov'
--output-path 'coverage.lcov'
--excl-start '^#\[cfg\(test\)\]|^// coverage\(off\)'
--excl-br-start '^#\[cfg\(test\)\]|^// coverage\(off\)'
--excl-stop '^// coverage\(on\)'
--excl-br-stop '^// coverage\(on\)'
--excl-line '\#\[derive\(|// cov\(skip\)'
--excl-br-line '\#\[derive\(|// cov\(skip\)'
- name: Coveralls upload
if: matrix.rust-version == 'nightly' && matrix.cargo-args == '--all-features'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov