-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
151 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Rust CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
merge_group: | ||
pull_request: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
cargo-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- uses: taiki-e/install-action@nextest | ||
- name: cargo nextest | ||
run: cargo nextest run --release --workspace --all --locked | ||
run: just test | ||
cargo-lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
name: lint | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@just | ||
- uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: Log into ghcr | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: fmt + lint | ||
run: just lint | ||
- name: chown target | ||
run: sudo chown -R $(id -u):$(id -g) ./target | ||
cargo-build-benches: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
name: build-benchmarks | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@just | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: build benches | ||
run: cargo bench --no-run --workspace --all | ||
- name: chown target | ||
run: sudo chown -R $(id -u):$(id -g) ./target | ||
cargo-build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
name: build | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@just | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: Log into ghcr | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: build | ||
run: just build | ||
- name: chown target | ||
run: sudo chown -R $(id -u):$(id -g) ./target | ||
cargo-doc: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/install-action@just | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: doclint | ||
run: just lint-docs | ||
- name: doctest | ||
run: just test-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
set positional-arguments | ||
alias t := test | ||
alias f := fmt | ||
alias l := lint | ||
alias b := build | ||
|
||
# default recipe to display help information | ||
default: | ||
@just --list | ||
|
||
# Run all tests | ||
tests: test test-docs | ||
|
||
# Test for the native target with all features | ||
test *args='': | ||
cargo nextest run --workspace --all --all-features $@ | ||
|
||
# Test the Rust documentation | ||
test-docs: | ||
cargo test --doc --all --locked | ||
|
||
# Fixes and checks all workspace formatting | ||
fmt: fmt-fix fmt-check | ||
|
||
# Fixes the formatting of the workspace | ||
fmt-fix: | ||
cargo +nightly fmt --all | ||
|
||
# Check the formatting of the workspace | ||
fmt-check: | ||
cargo +nightly fmt --all -- --check | ||
|
||
# Lint workspace and docs | ||
lint: lint-docs clippy | ||
|
||
# Lint the Rust documentation | ||
lint-docs: | ||
RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --document-private-items | ||
|
||
# Run clippy lints on the workspace | ||
clippy: | ||
cargo +nightly clippy --workspace --all --all-features --all-targets -- -D warnings | ||
|
||
# Build for the native target | ||
build *args='': | ||
cargo build --workspace --all $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters