Skip to content

Commit

Permalink
chore: improve CI workflow using just
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudy committed Oct 9, 2024
1 parent c1be1f2 commit fe31862
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 32 deletions.
61 changes: 31 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ jobs:
hack: true
- name: cargo hack check --tests
run: just check-hack-tests
hack: true
- name: cargo hack check --examples
run: just check-hack-examples
hack: true
- name: cargo doc
run: just docs
- name: clippy
run: just clippy
- name: fmt
run: just fmt

steps:
- uses: extractions/setup-just@v1
- name: Install rust toolchain
Expand All @@ -61,6 +70,22 @@ jobs:
- name: ${{ matrix.steps.name }}
run: ${{ matrix.steps.run }}

pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v3
- run: pip install pre-commit
- uses: extractions/setup-just@v1
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Checkout sources
uses: actions/checkout@v4
- name: Run pre-commit
run: just pre-commit-ci

msrv:
name: MSRV 1.74
runs-on: ubuntu-latest
Expand All @@ -69,7 +94,7 @@ jobs:
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.74.0
toolchain: "1.74"
- name: Checkout sources
uses: actions/checkout@v4
- name: Run cargo build
Expand All @@ -85,6 +110,9 @@ jobs:
- beta

steps:
- uses: extractions/setup-just@v1
- uses: taiki-e/install-action@nextest

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -94,37 +122,10 @@ jobs:
toolchain: ${{ matrix.toolchain }}

- name: Build cargo tests
run: cargo test --features axum,sni,tls,tls-ring,mocks --no-run
run: just test-build

- name: Run cargo test
run: cargo test --features axum,sni,tls,tls-ring,mocks

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy

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

- name: Run cargo clippy
uses: actions-rs/clippy-check@v1
if: github.repository_owner == 'linode-sokka'
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -D warnings

- name: Run cargo clippy
if: github.repository_owner != 'linode-sokka'
run: cargo clippy --all-features -- -D warnings
run: just test-run

deny:
name: Deny
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ default_language_version:
rust: stable
repos:
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.10.0.1
hooks:
- id: shellcheck
args: ["-x"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ deny:
fmt:
cargo +{{rust}} fmt --all --check

# Run pre-commit checks
pre-commit:
pre-commit run --all-files

[private]
pre-commit-ci:
SKIP=cargo-machete,fmt,check,clippy pre-commit run --color=always --all-files --show-diff-on-failure --hook-stage commit

# Run httpbin tests
httpbin:
cargo +{{rust}} build --features client,tls,tls-ring --example httpbin
Expand Down

0 comments on commit fe31862

Please sign in to comment.