ci(actions): improve rust workflow
- use cargo action over run - run clippy and test on all OS - remove caches caches dont improve speed that much (about a minute better?) and might lead to side effects (happened)
This commit is contained in:
+63
-67
@@ -5,84 +5,80 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
clippy:
|
||||||
name: Lint
|
name: Clippy ${{ matrix.os }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macOS-latest
|
||||||
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: 'Log versions'
|
|
||||||
run: |
|
- name: Setup Rust
|
||||||
rustc --version
|
uses: actions-rs/toolchain@v1
|
||||||
cargo --version
|
|
||||||
- name: Cache cargo
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
with:
|
||||||
path: |
|
toolchain: stable
|
||||||
~/.cargo/registry
|
override: true
|
||||||
~/.cargo/git
|
profile: minimal
|
||||||
target
|
components: clippy
|
||||||
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Run clippy
|
- name: Run clippy
|
||||||
run: cargo clippy --verbose --all-targets --all-features -- -D warnings -D clippy::pedantic
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: --verbose --all-targets --all-features -- -D clippy::all -D clippy::pedantic
|
||||||
|
|
||||||
|
rustfmt:
|
||||||
|
name: Rustfmt
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
profile: minimal
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
- name: Check format
|
- name: Check format
|
||||||
run: cargo fmt -- --check --verbose
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: -- --check --verbose
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test ${{ matrix.os }} ${{ matrix.toolchain }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
needs: clippy
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macOS-latest
|
||||||
|
- windows-latest
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
- nightly
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: 'Log versions'
|
|
||||||
run: |
|
|
||||||
rustc --version
|
|
||||||
cargo --version
|
|
||||||
- name: Cache cargo
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build
|
- name: Setup Rust
|
||||||
run: cargo build --verbose --all-targets
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose --all-targets
|
uses: actions-rs/cargo@v1
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release ${{ matrix.config.triple }}
|
|
||||||
runs-on: ${{ matrix.config.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
config:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
triple: x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Log versions
|
|
||||||
run: |
|
|
||||||
rustc --version
|
|
||||||
cargo --version
|
|
||||||
|
|
||||||
- name: Add Target
|
|
||||||
run: rustup target add ${{ matrix.config.triple }}
|
|
||||||
|
|
||||||
- name: Cache cargo
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
with:
|
||||||
path: |
|
command: test
|
||||||
~/.cargo/registry
|
args: --verbose --locked --all-features
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
key: ${{ matrix.config.triple }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build release
|
|
||||||
run: cargo build --release --verbose --all-targets --target ${{ matrix.config.triple }}
|
|
||||||
|
|
||||||
- name: inspect target dir
|
|
||||||
if: runner.os == 'Linux' || runner.os == 'macOS'
|
|
||||||
run: ls -al target/*/release
|
|
||||||
|
|||||||
Reference in New Issue
Block a user