Skip to content

Commit

Permalink
chore: Update rust CI (#215)
Browse files Browse the repository at this point in the history
* switch to dtolnay/rust-toolchain, use llvm-cov instead of tarpaulin
  • Loading branch information
tedil authored Dec 9, 2024
1 parent b85d04b commit 3901274
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ jobs:
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: rustfmt

- name: Check format
run: |
cargo fmt -- --check
run: cargo fmt --check

Linting:
runs-on: ubuntu-latest
Expand All @@ -35,19 +32,15 @@ jobs:
lfs: true

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy

- name: Lint with clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
run: cargo clippy --no-deps # --all-targets --all-features

Testing:
needs: Formatting
needs: [Formatting, Linting]
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -79,6 +72,9 @@ jobs:
with:
lfs: 'true'

- name: Install host libraries
run: sudo apt-get install -y libsqlite3-dev libsqlite3-0

- name: Import test database.
run: |
set -euo pipefail
Expand All @@ -89,18 +85,17 @@ jobs:
PGPASSWORD: uta_admin

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: llvm-tools-preview # needed for cargo llvm-cov

- uses: Swatinem/[email protected]

- name: Run cargo-tarpaulin with fast tests
uses: actions-rs/[email protected]
with:
version: 0.21.0
args: "-- --test-threads 1"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Run cargo-llvm-cov with fast tests
run: cargo llvm-cov --lcov --output-path lcov.info -- --test-threads 1
env:
TEST_UTA_DATABASE_URL: postgres://uta_admin:[email protected]/uta
TEST_UTA_DATABASE_SCHEMA: uta_20210129
Expand All @@ -109,10 +104,7 @@ jobs:
if: ${{ matrix.label == 'fast' }}

- name: Run cargo-test with full tests
uses: actions-rs/cargo@v1
with:
command: test
args: "--release -- --include-ignored"
run: "cargo test --release -- --include-ignored"
env:
TEST_UTA_DATABASE_URL: postgres://uta_admin:[email protected]/uta
TEST_UTA_DATABASE_SCHEMA: uta_20210129
Expand Down

0 comments on commit 3901274

Please sign in to comment.