diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..a0e730b7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +# Runs `clippy` and `cargo fmt` checks. + +name: Lint + +on: + push: + branches: [main] + pull_request: + +env: + CARGO_TERM_COLOR: always + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + clippy: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@clippy + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + - run: cargo clippy --workspace --all-targets --all-features + env: + RUSTFLAGS: -Dwarnings + + fmt: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - run: cargo fmt --all --check diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 68% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 295be640..6b0f28e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,6 @@ -name: CI +# Runs build checks and examples. + +name: Test on: push: @@ -57,27 +59,4 @@ jobs: echo "Running the following examples: $examples" # Run the examples - echo "$examples" | xargs -n1 cargo run --example - - clippy: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@clippy - - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - run: cargo clippy --workspace --all-targets --all-features - env: - RUSTFLAGS: -Dwarnings - - fmt: - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@nightly - with: - components: rustfmt - - run: cargo fmt --all --check + echo "$examples" | xargs -n1 cargo run --example