Potential fix for code scanning alert no. 8: Workflow does not contai… #115
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: Rust Coverage | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths: | |
| - 'server/**' | |
| - '.github/workflows/rust-coverage.yml' | |
| pull_request: | |
| branches: [main, dev] | |
| paths: | |
| - 'server/**' | |
| - '.github/workflows/rust-coverage.yml' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| # https://github.com/marketplace/actions/cache | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| server/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install Rust | |
| run: rustup override set nightly | |
| # https://github.com/marketplace/actions/mongodb-in-github-actions | |
| - name: MongoDB in GitHub Action | |
| uses: supercharge/[email protected] | |
| # https://github.com/taiki-e/cargo-llvm-cov?tab=readme-ov-file#github-actions-and-codecov | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Generate code coverage | |
| working-directory: ./server | |
| run: cargo llvm-cov --all-features --workspace --lcov --output-path ./target/lcov.info | |
| # https://github.com/codecov/codecov-action | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| name: rust-coverage | |
| files: ./server/target/lcov.info | |
| flags: rust | |
| token: ${{ secrets.CODECOV_TOKEN }} |