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