Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rework CI workflows #23

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 52 additions & 39 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,65 @@ on:
- '.gitignore'

jobs:
check:
fmt:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-check-v3
- name: Install latest stable cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Install cargo nightly
run: rustup install nightly

- run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2

- run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- run: rustup component add clippy
- uses: Swatinem/rust-cache@v2

- run: cargo clippy --all

doc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- run: rustup install nightly --profile minimal
- uses: Swatinem/rust-cache@v2

- name: Run check
run: |
cargo fmt --all -- --check
cargo clippy --all
./build_doc.sh
run: ./build_doc.sh

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-test-v6
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rust-src, miri
- name: Run tests
run: ./run_test.sh

- run: |
rustup toolchain install nightly --profile minimal --component rust-src --component miri
rustup override set nightly
- uses: Swatinem/rust-cache@v2

- run: ./run_test.sh

# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Tests pass
needs:
- fmt
- clippy
- doc
- build
if: always() # always run even if dependencies fail
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
run: exit 1
- run: exit 0