From fd933a84d321c433959f74ae2abac8f1d807c12d Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 24 Feb 2021 00:10:02 +0300 Subject: [PATCH] ci: update github actions - move clippy and fmt to another thread - add os to matrix --- .github/workflows/build.yml | 98 +++++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 52 -------------------- 2 files changed, 98 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8192019 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,98 @@ +name: CI + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + rust: + - stable + - beta + - nightly + steps: + - uses: actions/checkout@v2 + + - name: Toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt, clippy + + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('Cargo.lock') }} + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + + - uses: isbang/compose-action@v0.1 + + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: -- --test-threads=1 + + clippy: + name: clippy (ubuntu-latest, stable) + runs-on: ubuntu-latest + steps: + - name: Instal latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: clippy + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('Cargo.lock') }} + - name: Check clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + + fmt: + name: fmt (ubuntu-latest, stable) + runs-on: ubuntu-latest + steps: + - name: Instal latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt + - name: Check format + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index af7731c..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI - -on: [push, pull_request] - -env: - CARGO_TERM_COLOR: always - -jobs: - ci: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - - beta - - nightly - - 1.50.0 # MSRV - steps: - - uses: actions/checkout@v2 - - - name: Toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true - components: rustfmt, clippy - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - - - name: Check format - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - - name: Check clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings - - - uses: isbang/compose-action@v0.1 - - - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: -- --test-threads=1