🚀 Major Quality Improvements: Security, Performance & Test Coverage #96
Workflow file for this run
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 Test & Coverage | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| statuses: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| RUST_BACKTRACE: short | |
| RUSTUP_MAX_RETRIES: 10 | |
| # Cancel previous runs on new push | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Cross-platform tests | |
| test: | |
| name: Test (${{ matrix.os }}, ${{ matrix.allocator }}) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| allocator: [system, jemalloc, mimalloc] | |
| exclude: | |
| # jemalloc has limited Windows support and tikv-jemalloc-sys fails to build on Windows MSVC | |
| - os: windows-latest | |
| allocator: jemalloc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: llvm-tools-preview | |
| - name: Setup sccache (Unix) | |
| id: sccache-unix | |
| if: matrix.os != 'windows-latest' | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| continue-on-error: true | |
| - name: Setup sccache (Windows) | |
| id: sccache-windows | |
| if: matrix.os == 'windows-latest' | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| continue-on-error: true | |
| - name: Configure sccache | |
| if: steps.sccache-unix.outcome == 'success' || steps.sccache-windows.outcome == 'success' | |
| run: | | |
| echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | |
| echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "test-${{ matrix.os }}" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest | |
| - name: Set allocator features | |
| id: features | |
| run: | | |
| if [ "${{ matrix.allocator }}" = "jemalloc" ]; then | |
| echo "features=jemalloc,schema-validation,compression,http-server" >> $GITHUB_OUTPUT | |
| elif [ "${{ matrix.allocator }}" = "mimalloc" ]; then | |
| echo "features=mimalloc,schema-validation,compression,http-server" >> $GITHUB_OUTPUT | |
| else | |
| echo "features=schema-validation,compression,http-server" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Build workspace | |
| run: cargo build --workspace --all-targets --features "${{ steps.features.outputs.features }}" | |
| - name: Run tests (nextest) | |
| run: | | |
| echo "Running tests with Rust nightly for GAT zero-cost abstractions" | |
| echo "Allocator: ${{ matrix.allocator }}" | |
| rustc --version | |
| cargo nextest run --workspace --features "${{ steps.features.outputs.features }}" --no-fail-fast | |
| - name: Run doctests | |
| run: cargo test --workspace --doc --features "${{ steps.features.outputs.features }}" | |
| - name: sccache stats | |
| if: always() | |
| run: sccache --show-stats || echo "sccache not available" | |
| continue-on-error: true | |
| shell: bash | |
| # Code coverage (Linux only) | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install llvm-cov | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Install nextest | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "coverage" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Generate coverage | |
| run: | | |
| cargo llvm-cov --features "schema-validation,compression,http-server" --workspace --lcov \ | |
| --output-path lcov.info nextest | |
| - name: Upload to codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: lcov.info | |
| fail_ci_if_error: false | |
| verbose: true | |
| flags: unittests | |
| name: codecov-pjs | |
| - name: Archive coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: lcov.info | |
| retention-days: 30 | |
| - name: Generate HTML coverage report | |
| run: cargo llvm-cov --features "schema-validation,compression,http-server" --workspace --html | |
| - name: Upload HTML coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: target/llvm-cov/html/ | |
| retention-days: 30 |