feat(ci): add GitHub Actions workflows and documentation (#4) #5
This file contains hidden or 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: Coverage | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - 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: Install grcov | |
| run: cargo install grcov | |
| - name: Build | |
| run: cargo build | |
| env: | |
| RUSTFLAGS: '-Cinstrument-coverage' | |
| LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw' | |
| - name: Run tests | |
| run: cargo test | |
| env: | |
| RUSTFLAGS: '-Cinstrument-coverage' | |
| LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw' | |
| - name: Generate coverage report | |
| run: | | |
| grcov . \ | |
| --binary-path ./target/debug/ \ | |
| --source-dir . \ | |
| --output-type lcov \ | |
| --branch \ | |
| --ignore-not-existing \ | |
| --ignore "/*" \ | |
| --ignore "target/*" \ | |
| --ignore "tests/*" \ | |
| --output-path coverage.lcov | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: coverage.lcov | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |