Skip to content

Commit

Permalink
chore: justfile improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades authored Jan 2, 2024
1 parent eff22fd commit a9df166
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
34 changes: 6 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3
- name: Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
default: true
- name: Cargo cache
uses: actions/cache@v3
with:
Expand All @@ -29,10 +25,7 @@ jobs:
~/.cargo/git
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }}
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt -- --check

tests:
needs:
Expand Down Expand Up @@ -69,18 +62,11 @@ jobs:
- name: System dependencies
run: sudo apt-get update; sudo apt-get install -y libxkbcommon-dev libwayland-dev
- name: Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
uses: dtolnay/rust-toolchain@stable
- name: Test features
uses: actions-rs/cargo@v1
run: cargo test --no-default-features --features "${{ matrix.features }}"
env:
RUST_BACKTRACE: full
with:
command: test
args: --no-default-features --features "${{ matrix.features }}"

examples:
needs:
Expand Down Expand Up @@ -112,16 +98,8 @@ jobs:
- name: System dependencies
run: sudo apt-get update; sudo apt-get install -y libxkbcommon-dev libwayland-dev
- name: Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
uses: dtolnay/rust-toolchain@stable
- name: Test example
uses: actions-rs/cargo@v1
run: cargo check -p "${{ matrix.examples }}"
env:
RUST_BACKTRACE: full
with:
command: check
args: -p "${{ matrix.examples }}"

9 changes: 5 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
examples := 'application cosmic cosmic-design-demo open-dialog'
examples := 'applet application config cosmic cosmic-design-demo multi-window open-dialog'
clippy_args := '-W clippy::all -W clippy::pedantic'

# Check for errors and linter warnings
check *args: (check-wayland args) (check-winit args) (check-examples args)

check-examples *args:
#!/bin/bash
for project in {{examples}}; do
cargo check -p ${project} {{args}}
cargo clippy -p ${project} {{args}} -- {{clippy_args}}
done

check-wayland *args:
cargo clippy --no-deps --features="wayland,tokio" {{args}} -- -W clippy::pedantic
cargo clippy --no-deps --features="wayland,tokio" {{args}} -- {{clippy_args}}

check-winit *args:
cargo clippy --no-deps --features="winit,tokio" {{args}} -- -W clippy::pedantic
cargo clippy --no-deps --features="winit,tokio" {{args}} -- {{clippy_args}}

# Runs a check with JSON message format for IDE integration
check-json: (check '--message-format=json')
Expand Down

0 comments on commit a9df166

Please sign in to comment.