Improve CI setup

This commit is contained in:
Dominik Nakamura 2022-04-09 11:08:40 +09:00
parent 5d25e9e0c6
commit 8f5fa81f12
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910

View File

@ -2,6 +2,7 @@ name: CI
on: [pull_request, push]
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C debuginfo=0 -D warnings"
jobs:
check:
@ -11,22 +12,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
uses: taiki-e/github-actions/install-rust@main
with:
toolchain: stable
override: true
- name: Configure cache
uses: Swatinem/rust-cache@v1
- name: Install cargo-hack
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-hack
run: cargo install cargo-hack
- name: Check feature combinations
uses: actions-rs/cargo@v1
with:
command: hack
args: clippy --feature-powerset --no-dev-deps
run: cargo hack clippy --feature-powerset --no-dev-deps
test:
name: Test
runs-on: ${{ matrix.os }}
@ -38,17 +32,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
uses: taiki-e/github-actions/install-rust@main
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- name: Configure cache
uses: Swatinem/rust-cache@v1
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
run: cargo test
lint:
name: Lint
runs-on: ubuntu-latest
@ -56,28 +46,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Rust (nightly)
uses: actions-rs/toolchain@v1
uses: taiki-e/github-actions/install-rust@main
with:
toolchain: nightly
override: true
components: rustfmt
component: rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt -- --check
- name: Setup Rust (stable)
uses: actions-rs/toolchain@v1
uses: taiki-e/github-actions/install-rust@main
with:
toolchain: stable
override: true
component: clippy
- name: Configure cache
uses: Swatinem/rust-cache@v1
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings
run: cargo clippy -- -D warnings
cargo-deny:
name: Cargo Deny
runs-on: ubuntu-latest
@ -91,6 +74,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check ${{ matrix.checks }}
uses: EmbarkStudios/cargo-deny-action@v1
uses: dnaka91/actions/deny-check@main
with:
command: check ${{ matrix.checks }}
checks: ${{ matrix.checks }}