176 lines (157 loc) · 5.64 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
on: [push, pull_request]
name: CI
env:
VCPKG_ROOT: "${{ github.workspace }}/vcpkg"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --check
build_and_test:
name: Other build/test
strategy:
fail-fast: false
matrix:
rust_version: [stable, 1.66.0]
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
components: clippy
- uses: mozilla-actions/sccache-action@v0.0.3
- if: runner.os != 'windows'
run: |
sudo apt-get update && \
sudo apt-get -y install libudev-dev
- if: runner.os == 'windows'
uses: johnwason/vcpkg-action@v4
with:
pkgs: openssl
triplet: x64-windows-static-md
token: ${{ github.token }}
- run: cargo build --workspace --exclude webauthn-authenticator-rs
# Don't run clippy on Windows, we only need to run it on Linux
#
# FIXME: clippy in rust 1.69.0 fails a clap macro expansion
# https://github.com/rust-lang/rust-clippy/issues/10421
- if: runner.os != 'windows' && matrix.rust_version != 'stable'
run: cargo clippy --no-deps --workspace --exclude webauthn-authenticator-rs --all-targets
- run: cargo test --workspace --exclude webauthn-authenticator-rs
authenticator:
name: webauthn-authenticator-rs test
strategy:
fail-fast: false
matrix:
rust_version: [stable, 1.66.0]
features:
- ""
- --features cable
- --features nfc
- --features usb
- --features nfc,usb
- --features cable,nfc,usb
os:
- ubuntu-latest
- windows-latest
include:
- os: windows-latest
features: --features win10
rust_version: stable
- os: windows-latest
features: --features cable,nfc,usb,win10
rust_version: stable
exclude:
- os: windows-latest
rust_version: 1.66.0
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
components: clippy
- uses: mozilla-actions/sccache-action@v0.0.3
- if: runner.os != 'windows'
run: |
sudo apt-get update && \
sudo apt-get -y install libudev-dev
- if: contains(matrix.features, 'nfc') && runner.os != 'windows'
run: sudo apt-get -y install libpcsclite-dev
- if: contains(matrix.features, 'usb') && runner.os != 'windows'
run: sudo apt-get -y install libusb-1.0-0-dev
- if: contains(matrix.features, 'cable') && runner.os != 'windows'
run: sudo apt-get -y install libdbus-1-dev
- if: runner.os == 'windows'
uses: johnwason/vcpkg-action@v4
with:
pkgs: openssl
triplet: x64-windows-static-md
token: ${{ github.token }}
- run: cargo build -p webauthn-authenticator-rs ${{ matrix.features }}
# Don't run clippy on Windows unless it is using a Windows-specific
# feature which wasn't checked on Linux.
#
# FIXME: clippy in rust 1.69.0 fails a clap macro expansion
# https://github.com/rust-lang/rust-clippy/issues/10421
- if: (contains(matrix.features, 'windows') || runner.os != 'windows') && matrix.rust_version != 'stable'
run: cargo clippy --no-deps -p webauthn-authenticator-rs --all-targets ${{ matrix.features }}
- run: cargo test -p webauthn-authenticator-rs ${{ matrix.features }}
docs:
name: Documentation
strategy:
fail-fast: false
matrix:
rust_version: [stable, nightly]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
- uses: mozilla-actions/sccache-action@v0.0.3
- run: |
sudo apt-get update && \
sudo apt-get -y install libudev-dev
# Build documentation with zero dependencies / features
#
# This tests that all the stubs work properly for optional dependencies
- run: cargo ${{ matrix.rust_version == 'nightly' && '+nightly' || '' }} doc --all --no-deps --document-private-items
env:
RUSTDOCFLAGS: ${{ matrix.rust_version == 'nightly' && '--cfg docsrs' || '' }}
- uses: actions/upload-artifact@v3
with:
name: docs-${{ matrix.rust_version }}
path: |
target/doc/
!target/doc/src/
if-no-files-found: error
retention-days: 14
- run: ./.github/check_built_docs.sh
# Build with all features
- run: |
sudo apt-get -y install libpcsclite-dev libusb-1.0-0-dev libdbus-1-dev
- run: cargo ${{ matrix.rust_version == 'nightly' && '+nightly' || '' }} doc --all --no-deps --document-private-items --all-features
env:
RUSTDOCFLAGS: ${{ matrix.rust_version == 'nightly' && '--cfg docsrs' || '' }}
- uses: actions/upload-artifact@v3
with:
name: docs-${{ matrix.rust_version }}-all_features
path: |
target/doc/
!target/doc/src/
if-no-files-found: error
retention-days: 14
- run: ./.github/check_built_docs.sh