From 5b2e025aa44f1c8df373960d2ff7bf40768e636b Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sun, 18 Oct 2020 07:26:57 -0700 Subject: [PATCH] CI: simplify configuration Uses a trick to simplify and unify the CI configuration --- .github/workflows/ci.yml | 88 +++++++++++++++++++++ .github/workflows/rust.yml | 152 ------------------------------------- README.md | 2 +- 3 files changed, 89 insertions(+), 153 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3bf43b2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI + +on: + pull_request: {} + push: + branches: develop + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Dwarnings" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: sudo apt-get install libpcsclite-dev + - run: cargo check + + test: + strategy: + matrix: + include: + - platform: ubuntu-latest + toolchain: stable + deps: sudo apt-get install libpcsclite-dev + - platform: windows-latest + toolchain: stable + deps: true + - platform: macos-latest + toolchain: stable + deps: true + - platform: ubuntu-latest + toolchain: 1.44.0 # MSRV + deps: sudo apt-get install libpcsclite-dev + - platform: windows-latest + toolchain: 1.44.0 # MSRV + deps: true + - platform: macos-latest + toolchain: 1.44.0 # MSRV + deps: true + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + override: true + - run: ${{ matrix.deps }} + - run: cargo build --all --all-features --release + - run: cargo test --all --all-features --release + + rustfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.44.0 # MSRV + components: clippy + - run: sudo apt-get install libpcsclite-dev + - run: cargo clippy --all --exclude crypto_box --all-features -- -D warnings diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 755a93a..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,152 +0,0 @@ -# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md - -on: - pull_request: {} - push: - branches: develop - -name: Rust - -jobs: - check: - name: Check - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v1 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Install libpcsclite-dev - run: sudo apt-get install libpcsclite-dev - - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - - # Need to install `libpscslite-dev` on Linux - linux: - name: Test Suite - strategy: - matrix: - toolchain: - - 1.44.0 # MSRV - - stable - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v1 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Install libpcsclite-dev - run: sudo apt-get install libpcsclite-dev - - - name: Run cargo test - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: -D warnings - with: - command: test - args: --all --release - - - name: Run cargo build --all-features - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: -D warnings - with: - command: build - args: --all --all-features - - test: - name: Test Suite - strategy: - matrix: - platform: - - macos-latest - - windows-latest - toolchain: - - 1.44.0 # MSRV - - stable - runs-on: ${{ matrix.platform }} - steps: - - name: Checkout sources - uses: actions/checkout@v1 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Run cargo test - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: -D warnings - with: - command: test - args: --all --release - - - name: Run cargo build --all-features - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: -D warnings - with: - command: build - args: --all --all-features - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v1 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Install rustfmt - run: rustup component add rustfmt - - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v1 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.44.0 # MSRV - override: true - - - name: Install libpcsclite-dev - run: sudo apt-get install libpcsclite-dev - - - name: Install clippy - run: rustup component add clippy - - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all --all-features -- -D warnings diff --git a/README.md b/README.md index 19ea4a7..f62bd84 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ or conditions. [maintenance-image]: https://img.shields.io/badge/maintenance-experimental-blue.svg [safety-image]: https://img.shields.io/badge/unsafe-forbidden-success.svg [safety-link]: https://github.com/rust-secure-code/safety-dance/ -[build-image]: https://github.com/iqlusioninc/yubikey-piv.rs/workflows/Rust/badge.svg?branch=develop&event=push +[build-image]: https://github.com/iqlusioninc/yubikey-piv.rs/workflows/CI/badge.svg?branch=develop&event=push [build-link]: https://github.com/iqlusioninc/yubikey-piv.rs/actions [gitter-image]: https://badges.gitter.im/badge.svg [gitter-link]: https://gitter.im/iqlusioninc/community