Migrate project configuration to Rust and enhance CI coverage #1
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: Run Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry & build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Cache cargo-tarpaulin | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/cargo-tarpaulin | |
| key: ${{ runner.os }}-tarpaulin-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install cargo-tarpaulin | |
| run: command -v cargo-tarpaulin || cargo install cargo-tarpaulin | |
| - name: Generate coverage report | |
| run: | | |
| cargo tarpaulin --out lcov --output-dir coverage \ | |
| --exclude-files "examples/*" \ | |
| --exclude-files "tests/*" \ | |
| --exclude-files "src/main.rs" | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| fail_ci_if_error: false |