ci(rust): improve workflow
This commit is contained in:
@@ -8,17 +8,11 @@ jobs:
|
|||||||
coverage:
|
coverage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
id: rust
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
|
||||||
components: llvm-tools-preview
|
components: llvm-tools-preview
|
||||||
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
- name: Install cargo-llvm-cov
|
|
||||||
uses: taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: cargo-llvm-cov
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: cargo fetch
|
- run: cargo fetch
|
||||||
@@ -27,11 +21,9 @@ jobs:
|
|||||||
key: coverage-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
key: coverage-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
path: target/
|
path: target/
|
||||||
|
|
||||||
- name: Run cargo-llvm-cov
|
- run: cargo llvm-cov --all-features --html
|
||||||
run: cargo llvm-cov --all-features --html
|
|
||||||
|
|
||||||
- name: Upload Report
|
- uses: actions/upload-artifact@v4
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: coverage-report
|
name: coverage-report
|
||||||
path: target/llvm-cov/html
|
path: target/llvm-cov/html
|
||||||
|
|||||||
+14
-25
@@ -1,4 +1,4 @@
|
|||||||
name: Test and Build Rust
|
name: Rust
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,11 +6,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
# 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:
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rustfmt:
|
rustfmt:
|
||||||
@@ -23,7 +19,6 @@ jobs:
|
|||||||
- run: cargo fmt --check --verbose
|
- run: cargo fmt --check --verbose
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
name: Clippy ${{ matrix.toolchain }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
|
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
|
||||||
strategy:
|
strategy:
|
||||||
@@ -36,9 +31,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUSTFLAGS: --deny warnings
|
RUSTFLAGS: --deny warnings
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- uses: dtolnay/rust-toolchain@master
|
||||||
id: rust
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
components: clippy
|
components: clippy
|
||||||
@@ -52,7 +46,6 @@ jobs:
|
|||||||
- run: cargo doc --offline --all-features --no-deps
|
- run: cargo doc --offline --all-features --no-deps
|
||||||
|
|
||||||
features:
|
features:
|
||||||
name: Features ${{ matrix.toolchain }} ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -67,16 +60,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUSTFLAGS: --allow unknown-lints --deny warnings
|
RUSTFLAGS: --allow unknown-lints --deny warnings
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- uses: dtolnay/rust-toolchain@master
|
||||||
id: rust
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
- uses: taiki-e/install-action@cargo-hack
|
||||||
- name: Install cargo-hack
|
|
||||||
uses: taiki-e/install-action@v2
|
|
||||||
with:
|
|
||||||
tool: cargo-hack
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: cargo fetch
|
- run: cargo fetch
|
||||||
@@ -92,7 +80,6 @@ jobs:
|
|||||||
run: cargo hack --keep-going --feature-powerset --no-dev-deps check --offline
|
run: cargo hack --keep-going --feature-powerset --no-dev-deps check --offline
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
|
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
|
||||||
strategy:
|
strategy:
|
||||||
@@ -107,9 +94,8 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- uses: dtolnay/rust-toolchain@master
|
||||||
id: rust
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -124,6 +110,8 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: Release ${{ matrix.triple }}
|
name: Release ${{ matrix.triple }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -151,11 +139,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUSTFLAGS: --deny warnings
|
RUSTFLAGS: --deny warnings
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
id: rust
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
|
||||||
targets: ${{ matrix.triple }}
|
targets: ${{ matrix.triple }}
|
||||||
|
|
||||||
- name: Install cargo tools
|
- name: Install cargo tools
|
||||||
@@ -171,5 +157,8 @@ jobs:
|
|||||||
key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
path: target/
|
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