Skip to content

Commit b4212fd

Browse files
robinkrahld-e-s-o
authored andcommitted
Add GitHub Actions configuration
This patch adds a configuration for GitHub Actions that builds and tests nitrocli with the MSRV, stable, beta and nightly Rust, calls clippy and rustfmt and checks the license annotations with reuse-tool.
1 parent e53a298 commit b4212fd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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

Comments
 (0)