diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 49775481b..ee8c55a22 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -15,7 +15,7 @@ env: jobs: ci-pass: name: CI is green - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: - test - wasm @@ -25,14 +25,14 @@ jobs: test: name: ${{ matrix.os }} / ${{matrix.target || 'default' }} - runs-on: ${{ matrix.os || 'ubuntu-latest' }} + runs-on: ${{ matrix.os || 'ubuntu-22.04' }} strategy: matrix: os: - - ubuntu-latest - - macOS-latest - - windows-latest + - ubuntu-22.04 + - macOS-12 + - windows-2022 steps: - name: Checkout @@ -49,10 +49,38 @@ jobs: - name: Test run: cargo test --all-features + coverage: + name: Coverage + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install rust + uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # stable + with: + toolchain: stable + components: llvm-tools + + - name: Cache cargo registry + uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1 + + - name: Install cargo-llvm-cov + run: cargo install cargo-llvm-cov --version 0.5.38 + + - name: Generate coverage + run: cargo llvm-cov --all-features --lcov --output-path lcov.info --ignore-filename-regex "crates/bitwarden-api-" + + - name: Upload to codecov.io + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + wasm: name: WASM - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout