Skip to content
Open
Show file tree
Hide file tree
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
60 changes: 58 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,41 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Detect Rust formatting inputs
id: rust_changes
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
if [[ "$EVENT_NAME" == "pull_request" ]]; then
range="origin/$BASE_REF...HEAD"
elif [[ -n "$BEFORE_SHA" && "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
range="$BEFORE_SHA...HEAD"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --quiet "$range" -- '*.rs' Cargo.toml Cargo.lock rust-toolchain.toml rustfmt.toml; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.92
if: steps.rust_changes.outputs.changed == 'true'
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master @ 2026-09-01
with:
toolchain: '1.92'
components: rustfmt

- name: Check formatting
if: steps.rust_changes.outputs.changed == 'true'
run: cargo fmt --all -- --check

clippy:
Expand All @@ -99,13 +127,41 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Detect Rust lint inputs
id: rust_changes
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
if [[ "$EVENT_NAME" == "pull_request" ]]; then
range="origin/$BASE_REF...HEAD"
elif [[ -n "$BEFORE_SHA" && "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
range="$BEFORE_SHA...HEAD"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --quiet "$range" -- '*.rs' Cargo.toml Cargo.lock rust-toolchain.toml; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.92
if: steps.rust_changes.outputs.changed == 'true'
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # master @ 2026-09-01
with:
toolchain: '1.92'
components: clippy

- name: Run Clippy
if: steps.rust_changes.outputs.changed == 'true'
run: cargo clippy --lib -- -W clippy::correctness -A warnings

doc:
Expand Down
Loading
Loading