Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update rust CI #215

Merged
merged 5 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +35 to +40
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

🛠️ Refactor suggestion

Restore comprehensive clippy checks for better coverage

The codebase has multiple components that justify using --all-targets --all-features:

  • A benchmark target (translate_cds)
  • Extensive test dependencies indicating significant test code
  • Multiple source modules that could have conditional compilation
-run: cargo clippy --no-deps  # --all-targets --all-features
+run: cargo clippy --no-deps --all-targets --all-features
🔗 Analysis chain

Consider restoring comprehensive clippy checks

The simplified clippy command removes --all-targets --all-features flags (as seen in the comment). This might reduce the scope of linting coverage.

Let's check if these flags are important for your codebase:

Consider restoring these flags for comprehensive checking:

-run: cargo clippy --no-deps  # --all-targets --all-features
+run: cargo clippy --no-deps --all-targets --all-features

The previous output showed we have benches, lib, and multiple source files. Let's examine the Cargo.toml to understand the project structure and features better, and specifically look for test files to determine if --all-targets would be beneficial.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for different target types and features in the project
echo "Checking for different targets (lib, bin, examples, tests)..."
fd -e rs -t f . src/ examples/ tests/ benches/ 2>/dev/null

echo "Checking for feature definitions..."
rg '^\[features\]' -A 5 Cargo.toml

Length of output: 852


Script:

#!/bin/bash
# Let's check the Cargo.toml for targets and dependencies
echo "Checking Cargo.toml for targets and dependencies..."
cat Cargo.toml

# Let's also check for test files specifically
echo -e "\nChecking for test files..."
fd -t f -g '*test*.rs' .

Length of output: 1329


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
Loading