Set up GitHub Actions workflow to automatically create a GitHub Release #145
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
name: Rust | |
on: | |
pull_request: | |
paths: | |
- "**.rs" | |
- .github/workflows/rust.yml | |
- Cargo.lock | |
- Cargo.toml | |
- clippy.toml | |
- Justfile | |
- rust-toolchain.toml | |
- rustfmt.toml | |
push: | |
branches: | |
- main | |
permissions: read-all | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
name: Build (${{ matrix.name }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: MacOS | |
os: macos-12 | |
- name: Ubuntu | |
os: ubuntu-22.04 | |
- name: Windows | |
os: windows-2022 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Build | |
run: just ci-build | |
build-nightly: | |
name: Build nightly (${{ matrix.name }}) | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: MacOS | |
os: macos-12 | |
- name: Ubuntu | |
os: ubuntu-22.04 | |
- name: Windows | |
os: windows-2022 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: nightly-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly | |
rustup override set nightly | |
rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Build | |
run: just ci-build | |
coverage: | |
name: Coverage | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-tarpaulin | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Run all tests with coverage | |
run: just ci-coverage | |
- name: Upload coverage report | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
if: ${{ failure() || success() }} | |
with: | |
name: coverage-report | |
path: _reports/coverage/ | |
retention-days: 7 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | |
with: | |
file: ./_reports/coverage/lcov.info | |
docs: | |
name: Docs | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Build docs | |
run: just ci-docs | |
fmt: | |
name: Fmt | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Check formatting | |
run: just ci-fmt | |
mutation: | |
name: Mutation | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-mutants | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Run mutation tests | |
run: just ci-mutation | |
- name: Upload mutation report | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
if: ${{ failure() || success() }} | |
with: | |
name: mutation-report | |
path: _reports/mutants.out/ | |
retention-days: 7 | |
test: | |
name: Test (${{ matrix.name }}) | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: MacOS | |
os: macos-12 | |
- name: Ubuntu | |
os: ubuntu-22.04 | |
- name: Windows | |
os: windows-2022 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Run all tests | |
run: just ci-test | |
test-nightly: | |
name: Test nightly (${{ matrix.name }}) | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build-nightly | |
- test | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: MacOS | |
os: macos-12 | |
- name: Ubuntu | |
os: ubuntu-22.04 | |
- name: Windows | |
os: windows-2022 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: nightly-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: | | |
rustup install nightly | |
rustup override set nightly | |
rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Run all tests | |
run: just ci-test | |
vet: | |
name: Vet | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Cache Rust & Cargo | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
run: rustup show | |
- name: Install Just | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: just@1 | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@1d74f337f279f52e54c352ebe5b96eaa36c948d3 # v2.9.0 | |
with: | |
tool: [email protected] | |
- name: Vet | |
run: just ci-vet |