-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add a more capable CI workflow
This is mostly copied from the Granddave/timecalc-rs project without the docs building which is not needed for this project.
- Loading branch information
Showing
1 changed file
with
76 additions
and
24 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 |
---|---|---|
@@ -1,40 +1,92 @@ | ||
--- | ||
name: ci | ||
name: Continious integration | ||
|
||
on: | ||
push: | ||
pull_request: | ||
paths-ignore: | ||
- "**/*.md" | ||
push: | ||
branches: | ||
- "master" | ||
- "renovate/**" | ||
paths-ignore: | ||
- "**/*.md" | ||
merge_group: | ||
types: | ||
- checks_requested | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUSTFLAGS: -D warnings | ||
RUSTDOCFLAGS: -D warnings | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
toolchain: | ||
- stable | ||
- beta | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.toolchain }} | ||
components: rustfmt, clippy | ||
|
||
- name: Format | ||
toolchain: stable | ||
components: rustfmt | ||
- name: Run Cargo Fmt | ||
run: cargo fmt --all -- --check | ||
|
||
- name: Build | ||
run: cargo build --verbose | ||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: stable | ||
components: clippy | ||
- name: Get build cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Run clippy | ||
run: cargo clippy --all-targets -- -D warnings | ||
|
||
- name: Run tests | ||
run: cargo test | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.job.os }} | ||
strategy: | ||
matrix: | ||
job: | ||
- os: macos-latest | ||
- os: ubuntu-latest | ||
- os: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: stable | ||
- name: Get build cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Run Cargo Test | ||
run: cargo test -r --all-targets --workspace | ||
|
||
- name: Run clippy | ||
run: cargo clippy -- -D warnings | ||
result: | ||
name: Result (CI) | ||
runs-on: ubuntu-latest | ||
needs: | ||
- fmt | ||
- clippy | ||
- test | ||
steps: | ||
- name: Mark the job as successful | ||
run: exit 0 | ||
if: "success()" | ||
- name: Mark the job as unsuccessful | ||
run: exit 1 | ||
if: "!success()" |