ci(rust): improve workflow

This commit is contained in:
EdJoPaTo
2023-10-24 19:09:08 +02:00
parent 0d9d132a67
commit 3a720d293a
2 changed files with 43 additions and 48 deletions
+5 -5
View File
@@ -9,17 +9,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Rust
shell: bash -eux {0}
run: |
rustup toolchain install stable --profile minimal --component llvm-tools-preview
rustup default stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
+38 -43
View File
@@ -7,23 +7,25 @@ on:
# Check if it works with current dependencies
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
env:
RUSTFLAGS: --deny warnings
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Setup Rust
shell: bash -eux {0}
run: |
rm ~/.cargo/bin/{rustfmt,cargo-fmt}
rustup toolchain install stable --profile minimal --component rustfmt
rustup default stable
- uses: actions/checkout@v3
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- uses: actions/checkout@v4
- run: cargo fmt --check --verbose
test:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} ${{ matrix.features }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
strategy:
fail-fast: false
matrix:
@@ -34,51 +36,42 @@ jobs:
- macos-latest
- windows-latest
clippyargs:
- -D clippy::pedantic -D warnings
- -D clippy::pedantic
features:
- --all-features
- "" # default features
include:
# Check future versions and maybe get some glances on soon to be lints
- toolchain: beta
os: ubuntu-latest
features: --all-features
clippyargs: -W clippy::pedantic -W clippy::nursery -W clippy::cargo
clippyargs: -D clippy::pedantic -D clippy::nursery -D clippy::cargo
- toolchain: nightly
os: ubuntu-latest
features: --all-features
clippyargs: -W clippy::pedantic
clippyargs: -D clippy::pedantic
steps:
- name: Setup Rust
shell: bash -eux {0}
run: |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --component clippy
rustup default ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fetch dependencies
uses: actions-rs/cargo@v1
with:
command: fetch
args: --verbose
run: cargo fetch --verbose
- name: Check clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --verbose --all-targets ${{ matrix.features }} -- ${{ matrix.clippyargs }}
run: cargo clippy --verbose --all-targets ${{ matrix.features }} -- ${{ matrix.clippyargs }}
- name: Check docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --verbose --no-deps ${{ matrix.features }}
run: cargo doc --verbose --no-deps ${{ matrix.features }}
- name: Build
run: cargo build --verbose --all-targets ${{ matrix.features }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose ${{ matrix.features }}
run: cargo test --verbose ${{ matrix.features }}
github-release:
name: Release ${{ matrix.triple }}
@@ -110,19 +103,21 @@ jobs:
os: windows-latest
steps:
- name: Setup Rust
shell: bash -eux {0}
run: |
rustup toolchain install stable --profile minimal --target ${{ matrix.triple }}
rustup default stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.triple }}
- uses: actions/checkout@v3
- name: Install cargo tools
if: runner.os == 'Linux'
uses: taiki-e/install-action@v2
with:
tool: cross
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch --verbose
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --all-features --target ${{ matrix.triple }}
use-cross: ${{ runner.os == 'Linux' }}
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --verbose --target ${{ matrix.triple }}