Support normalizing definitions from other modules (#370) #1437
This file contains 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 CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
permissions: | |
contents: read | |
statuses: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
# Ensure Minimum Supported Rust Version (MSRV) | |
build-msrv: | |
name: Build with MSRV | |
runs-on: ubuntu-latest | |
outputs: | |
msrv: ${{ steps.extract_rust_version.outputs.msrv }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Rust Version | |
id: extract_rust_version | |
run: | | |
rust_version=$(awk -F '"' '/rust-version/ {print $2; exit}' Cargo.toml) | |
if [ -z "$rust_version" ]; then | |
echo "Error: rust-version not found in Cargo.toml" | |
exit 1 | |
fi | |
echo "msrv=$rust_version" >> "$GITHUB_OUTPUT" | |
- name: Set Up Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ steps.extract_rust_version.outputs.msrv }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo build --all | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check --all | |
tests: | |
name: Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --all | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: rustup component add rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: rustup component add clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all -- -D warnings | |
line-endings: | |
name: Check line endings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check for CRLF line endings | |
run: | | |
echo "Checking for files with CRLF line endings ..." | |
files_with_crlf=$(git ls-files -z | xargs -0 grep -IlI $'\r$' || true) | |
if [ -n "$files_with_crlf" ]; then | |
echo "Error: The following files have CRLF line endings:" | |
echo "$files_with_crlf" | |
echo "Please change these files to use LF line endings." | |
exit 1 | |
else | |
echo "No files with CRLF line endings found." | |
fi |