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