ci(rust): improve workflow
This commit is contained in:
+14
-25
@@ -1,4 +1,4 @@
|
||||
name: Test and Build Rust
|
||||
name: Rust
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,11 +6,7 @@ on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Check if it works with current dependencies
|
||||
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_TERM_COLOR: always
|
||||
- cron: "42 2 * * 6" # weekly on Saturday 2:42 UTC
|
||||
|
||||
jobs:
|
||||
rustfmt:
|
||||
@@ -23,7 +19,6 @@ jobs:
|
||||
- run: cargo fmt --check --verbose
|
||||
|
||||
clippy:
|
||||
name: Clippy ${{ matrix.toolchain }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
|
||||
strategy:
|
||||
@@ -36,9 +31,8 @@ jobs:
|
||||
env:
|
||||
RUSTFLAGS: --deny warnings
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
id: rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
components: clippy
|
||||
@@ -52,7 +46,6 @@ jobs:
|
||||
- run: cargo doc --offline --all-features --no-deps
|
||||
|
||||
features:
|
||||
name: Features ${{ matrix.toolchain }} ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -67,16 +60,11 @@ jobs:
|
||||
env:
|
||||
RUSTFLAGS: --allow unknown-lints --deny warnings
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
id: rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
|
||||
- name: Install cargo-hack
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-hack
|
||||
- uses: taiki-e/install-action@cargo-hack
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- run: cargo fetch
|
||||
@@ -92,7 +80,6 @@ jobs:
|
||||
run: cargo hack --keep-going --feature-powerset --no-dev-deps check --offline
|
||||
|
||||
test:
|
||||
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
|
||||
strategy:
|
||||
@@ -107,9 +94,8 @@ jobs:
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
id: rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
- uses: actions/checkout@v4
|
||||
@@ -124,6 +110,8 @@ jobs:
|
||||
release:
|
||||
name: Release ${{ matrix.triple }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -151,11 +139,9 @@ jobs:
|
||||
env:
|
||||
RUSTFLAGS: --deny warnings
|
||||
steps:
|
||||
- name: Setup Rust
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
id: rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: ${{ matrix.triple }}
|
||||
|
||||
- name: Install cargo tools
|
||||
@@ -171,5 +157,8 @@ jobs:
|
||||
key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||
path: target/
|
||||
|
||||
- name: Build
|
||||
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --all-features --target ${{ matrix.triple }}
|
||||
- run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --all-features --target ${{ matrix.triple }}
|
||||
|
||||
- name: Create GitHub release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
||||
Reference in New Issue
Block a user