|
| 1 | +# Copyright (C) 2021 The Nitrocli Developers |
| 2 | +# SPDX-License-Identifier: CC0-1.0 |
| 3 | + |
| 4 | +# TODO: |
| 5 | +# - Test with system libnitrokey (USE_SYSTEM_LIBNITROKEY=1)? |
| 6 | +# - Add support for macos and windows |
| 7 | + |
| 8 | +name: CI |
| 9 | + |
| 10 | +on: [push, pull_request] |
| 11 | + |
| 12 | +env: |
| 13 | + RUST_BACKTRACE: 1 |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + name: Compile and test Rust ${{ matrix.rust }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + rust: [1.42.0, stable, beta, nightly] |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + - uses: actions-rs/toolchain@v1 |
| 26 | + with: |
| 27 | + toolchain: ${{ matrix.rust }} |
| 28 | + profile: minimal |
| 29 | + override: true |
| 30 | + - run: sudo apt-get install libhidapi-dev |
| 31 | + - run: cargo build --workspace --bins --tests --verbose |
| 32 | + - run: cargo build --workspace --bins --tests --verbose --release |
| 33 | + - run: cargo test --workspace --verbose |
| 34 | + |
| 35 | + clippy: |
| 36 | + name: Lint with clippy |
| 37 | + runs-on: ubuntu-latest |
| 38 | + env: |
| 39 | + RUSTFLAGS: -Dwarnings |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + - uses: actions-rs/toolchain@v1 |
| 43 | + with: |
| 44 | + toolchain: 1.42.0 |
| 45 | + components: clippy |
| 46 | + override: true |
| 47 | + - run: cargo clippy --workspace --all-targets --all-features --verbose -- -A unknown_lints -D warnings |
| 48 | + |
| 49 | + reuse: |
| 50 | + name: Check license annotations |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + - uses: actions/setup-python@v2 |
| 55 | + - run: pip3 install reuse |
| 56 | + - run: reuse lint |
| 57 | + |
| 58 | + rustfmt: |
| 59 | + name: Verify code formatting |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v2 |
| 63 | + - uses: actions-rs/toolchain@v1 |
| 64 | + with: |
| 65 | + toolchain: 1.42.0 |
| 66 | + components: rustfmt |
| 67 | + override: true |
| 68 | + - run: cargo fmt --all -- --check |
0 commit comments