Skip to content

Commit

Permalink
ci: use just recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed May 27, 2024
1 parent fe8355d commit 3b8e021
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 24 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/ci-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup mold linker
if: matrix.target.os == 'ubuntu-latest'
uses: rui314/setup-mold@v1

- name: Install Rust
uses: actions-rust-lang/[email protected]
with:
toolchain: ${{ matrix.version }}

- name: Install cargo-hack
- name: Install just, cargo-hack, cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: Install cargo-nextest
uses: taiki-e/[email protected]
with:
tool: cargo-nextest

- name: Check minimal
run: cargo hack --clean-per-run check --workspace --no-default-features
tool: just,cargo-hack,cargo-nextest

- name: Tests
run: cargo nextest run --workspace --all-features --no-fail-fast
run: just test
timeout-minutes: 10
33 changes: 22 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ concurrency:
cancel-in-progress: true

jobs:
msrv:
name: Read MSRV
uses: actions-rust-lang/msrv/.github/workflows/[email protected]

test:
needs: msrv

strategy:
fail-fast: false
matrix:
Expand All @@ -26,7 +32,7 @@ jobs:
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
- { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc }
version:
- { name: msrv, version: 1.68.0 }
- { name: msrv, version: "${{ needs.msrv.outputs.msrv }}" }
- { name: stable, version: stable }

name: ${{ matrix.target.name }} / ${{ matrix.version.name }}
Expand All @@ -35,26 +41,26 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup mold linker
if: matrix.target.os == 'ubuntu-latest'
uses: rui314/setup-mold@v1

- name: Install Rust (${{ matrix.version.name }})
uses: actions-rust-lang/[email protected]
with:
toolchain: ${{ matrix.version.version }}

- name: Install cargo-hack, cargo-nextest
- name: Install just, cargo-hack, cargo-nextest
uses: taiki-e/[email protected]
with:
tool: cargo-hack,cargo-nextest
tool: just,cargo-hack,cargo-nextest

- name: workaround MSRV issues
- name: Workaround MSRV issues
if: matrix.version.name == 'msrv'
run: |
cargo update -p=trybuild --precise=1.0.89
- name: Check minimal
run: cargo hack --clean-per-run check --workspace --no-default-features
run: just downgrade-for-msrv

- name: Tests
run: cargo nextest run --workspace --all-features --no-fail-fast
run: just test
timeout-minutes: 10

doc_test:
Expand All @@ -69,6 +75,11 @@ jobs:
with:
toolchain: nightly

- name: Install just
uses: taiki-e/[email protected]
with:
tool: just

- name: Test documentation
run: cargo test --workspace --doc --all-features --no-fail-fast
run: just test-docs
timeout-minutes: 10
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[workspace]
resolver = "2"
members = [
"actix",
"actix-broker",
"actix-derive",
]
resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.68"
rust-version = "1.72"

[patch.crates-io]
actix = { path = "actix" }
Expand Down
32 changes: 32 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
msrv := ```
cargo metadata --format-version=1 \
| jq -r 'first(.packages[] | select(.source == null and .rust_version)) | .rust_version' \
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/'
```
msrv_rustup := "+" + msrv

# Downgrade dev-dependencies necessary to run MSRV checks/tests.
[private]
downgrade-for-msrv:
@ echo "No MSRV downgrades currently required."
# cargo update -p=trybuild --precise=1.0.89

# Test workspace using MSRV.
test-msrv: downgrade-for-msrv (test msrv_rustup)

# Test workspace code.
test toolchain="":
cargo {{ toolchain }} test -p=actix_derive --lib --tests --all-features
cargo {{ toolchain }} nextest run --workspace --exclude=actix_derive --no-default-features
cargo {{ toolchain }} nextest run --workspace --exclude=actix_derive --all-features

# Test workspace docs.
test-docs toolchain="": && doc
cargo {{ toolchain }} test --doc --workspace --all-features --no-fail-fast -- --nocapture

# Document crates in workspace.
doc *args:
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --no-deps --workspace --all-features {{ args }}

# Test workspace.
test-all toolchain="": (test toolchain) (test-docs toolchain)

0 comments on commit 3b8e021

Please sign in to comment.