-
Notifications
You must be signed in to change notification settings - Fork 106
214 lines (203 loc) · 6.81 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: ci
on:
push:
pull_request:
merge_group:
schedule:
- cron: '0 18 * * *'
env:
RUSTFLAGS: -D warnings
jobs:
lint:
name: Format & clippy
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- run: cargo fmt -- --check
- run: cargo clippy --all-features --all-targets
# rustls-cert-gen require either aws_lc_rs or ring feature
- run: cargo clippy -p rcgen --no-default-features --all-targets
- run: cargo clippy --no-default-features --features ring --all-targets
- run: cargo clippy --no-default-features --features aws_lc_rs --all-targets
- run: cargo clippy --no-default-features --features aws_lc_rs,pem --all-targets
rustdoc:
name: Documentation
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [stable, nightly]
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo doc (all features)
run: cargo doc --all-features --document-private-items
env:
RUSTDOCFLAGS: ${{ matrix.toolchain == 'nightly' && '-Dwarnings --cfg=docsrs' || '-Dwarnings' }}
check-external-types:
name: Validate external types appearing in public API
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-06-30
# ^ sync with https://github.com/awslabs/cargo-check-external-types/blob/main/rust-toolchain.toml
- run: cargo install --locked cargo-check-external-types
- name: run cargo-check-external-types for rcgen/
working-directory: rcgen/
run: cargo check-external-types --all-features
semver:
name: Check semver compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
exclude: rustls-cert-gen
build-windows:
runs-on: windows-latest
env:
# botan doesn't build on windows if the source is
# on a different drive than the artifacts
# https://github.com/randombit/botan-rs/issues/82
BOTAN_CONFIGURE_LINK_METHOD: copy
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
$VCPKG_DEFAULT_BINARY_CACHE
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
- uses: egor-tensin/vs-shell@v2
with:
arch: amd64
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install NASM for aws-lc-rs on Windows
uses: ilammy/setup-nasm@v1
- run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
- run: vcpkg install openssl:x64-windows-static-md
- name: Run cargo check
run: cargo check --all-targets
- name: Run the tests
run: cargo test
- name: Run the tests with x509-parser enabled
run: cargo test --verbose --features x509-parser
- name: Run the tests with aws_lc_rs backend enabled
run: cargo test --verbose --no-default-features --features aws_lc_rs,pem
# rustls-cert-gen require either aws_lc_rs or ring feature
- name: Run the tests with no features enabled
run: cargo test -p rcgen --verbose --no-default-features
build:
strategy:
matrix:
os: [macOS-latest, ubuntu-latest]
toolchain: [stable, beta, nightly, stable 7 months ago]
exclude:
- os: macOS-latest
toolchain: beta
- os: macOS-latest
toolchain: nightly
- os: macOS-latest
toolchain: stable 7 months ago
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{matrix.toolchain}}-${{ hashFiles('Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Run cargo check
run: cargo check --all-targets
- name: Run the tests
run: cargo test
- name: Run the tests with x509-parser enabled
run: cargo test --verbose --features x509-parser
- name: Run the tests with aws_lc_rs backend enabled
run: cargo test --verbose --no-default-features --features aws_lc_rs,pem
# Build rustls-cert-gen as a standalone package, see this PR for why it's needed:
# https://github.com/rustls/rcgen/pull/206#pullrequestreview-1816197358
build-rustls-cert-gen-standalone:
name: Build rustls-cert-gen as a standalone package
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run the tests
run: cargo test --package rustls-cert-gen
coverage:
name: Measure coverage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Measure coverage
run: cargo llvm-cov --all-features --lcov --output-path ./lcov.info
- name: Report to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info
fail_ci_if_error: false
verbose: true