Skip to content

Commit

Permalink
CI: Improve workflow using just for keeping commands in one place
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
  • Loading branch information
guerinoni committed Sep 21, 2023
1 parent a551fdc commit 5dcf8d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,32 @@ env:
CARGO_TERM_COLOR: always

jobs:
fmt:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup just
uses: extractions/setup-just@v1

- uses: actions/checkout@v4

- name: Check fmt
run: cargo fmt --all --check
run: cargo fmt -- --check

- name: Check clippy
run: just lint

test:
needs: [fmt]
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Setup just
uses: extractions/setup-just@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test --workspace

lint:
needs: [fmt, test]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Lint
run: |
cargo clippy --workspace -- -D warnings \
-W clippy::complexity \
-W clippy::correctness \
-W clippy::nursery \
-W clippy::perf \
-W clippy::style \
-W clippy::suspicious
run: just test
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build:

# run test on all workspace
test:
@cargo test --workspace
@cargo test --workspace --all-features

# run clippy with heavy config
lint:
Expand Down

0 comments on commit 5dcf8d1

Please sign in to comment.