-
Notifications
You must be signed in to change notification settings - Fork 8
261 lines (259 loc) · 9.01 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
name: CI
on: [push, pull_request]
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
- name: cargo fmt -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
test:
name: Test
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEBUG_DEBUG: 0
CARGO_TARGET_DIR: target
RUSTDOCFLAGS: --deny warnings
RUSTFLAGS: --deny warnings
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
- '1.48.0'
target:
-
features:
- js
- js,derive
- js,hmac-sha1
include:
- toolchain: stable
components: clippy
- toolchain: beta
components: clippy
- toolchain: nightly
components: clippy
- toolchain: stable
features: js
target: wasm32-unknown-unknown
- toolchain: '1.48.0'
minimum_rust: true
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
profile: minimal
override: true
components: ${{ matrix.components }}
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Install `wasm-bindgen-test-runner`
if: matrix.target == 'wasm32-unknown-unknown'
run: |
VER=0.2.78
NAME="wasm-bindgen-$VER-x86_64-unknown-linux-musl"
DIGEST=14f1b0ef9225370f0d270efbdbbfe2cf5eb191d57b8eec14ade69c98c71e226f
curl -fLOsS "https://github.com/rustwasm/wasm-bindgen/releases/download/$VER/$NAME.tar.gz"
sha256sum --check --quiet <<< "$DIGEST $NAME.tar.gz"
tar -xzf "$NAME.tar.gz" "$NAME/wasm-bindgen-test-runner"
mv "$NAME/wasm-bindgen-test-runner" /usr/local/bin/
- run: echo "RUSTFLAGS=$RUSTFLAGS --allow unknown_lints" >> "$GITHUB_ENV"
if: matrix.minimum_rust
- run: echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> "$GITHUB_ENV"
if: matrix.target != ''
- name: Clippy `oauth1-request`
if: contains(matrix.components, 'clippy')
uses: actions-rs/cargo@v1
with:
command: clippy
args: --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
- name: Check docs of `oauth1-request`
if: ${{ !matrix.minimum_rust && matrix.features == 'js,derive' }}
uses: actions-rs/cargo@v1
with:
command: doc
args: --verbose --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}' --no-deps
- name: Build `oauth1-request`
if: ${{ !matrix.minimum_rust }}
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
- name: Check `oauth1-request`
if: matrix.minimum_rust && !contains(matrix.features, 'derive')
uses: actions-rs/cargo@v1
with:
command: check
# Cargo of toolchain v1.48.0 cannot parse the registry information for
# `oauth1-request-derive` even when the `derive` feature is disabled, potentially because
# of the use of the resovler v2 by its dependencies, so we instead build `oauth1-request`
# indirectly through `oauth1-request-test` crate, which depends on the crate.
args: --verbose --tests --manifest-path oauth1-request-test/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
- name: Build `examples`
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --manifest-path examples/Cargo.toml
- name: Test `oauth1-request`
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
derive-test:
name: Test `oauth1-request-derive`
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
# UI test results changes frequently and sometimes there may not be any way to
# make the test pass for all toolchains at the same time.
# Also, we don't want the workflow to break nightly :)
continue-on-error: ${{ matrix.toolchain != 'stable' }}
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build `oauth1-request-derive`
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --tests --manifest-path oauth1-request-derive/Cargo.toml
- name: Test `oauth1-request-derive`
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --manifest-path oauth1-request-derive/Cargo.toml
credentials-msrv:
name: Build `oauth-credentials` on MSRV
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- '1.0.0'
- '1.6.0'
- '1.36.0'
include:
- toolchain: '1.0.0'
features: std
- toolchain: '1.6.0'
- toolchain: '1.36.0'
features: alloc
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions/checkout@v2
with:
repository: rust-lang/crates.io-index
ref: 46a429eac9f70fd7281922780d7dd42e2fb7ab77
path: crates.io-index
- name: Workaround compatibility issues of Cargo
run: |
# Remove the virtual manifest because Rust 1.13.0 run fails when built as a workspace member.
rm Cargo.toml
# Reference: <https://github.com/mcgoo/vcpkg-rs/blob/f75707b/.github/workflows/rust-1.12.yml>
mkdir -p oauth-credentials/.cargo
cat <<EOF >> oauth-credentials/.cargo/config
[source.crates-io]
registry = "file://$GITHUB_WORKSPACE/crates.io-index"
EOF
- name: Build `oauth-credentials`
uses: actions-rs/cargo@v1
with:
command: build
# Toolchains older than 1.8.0 cannot compile `oauth-credentials` directly
# because the toolchains do not understand Cargo registry's information for `serde`, so we
# use the same trick that we used for `oauth1-request`'s minimum tested toolchain.
args: --verbose --manifest-path oauth-credentials-test/Cargo.toml --no-default-features --features=${{ matrix.features }}
credentials-test:
name: Test `oauth-credentials`
runs-on: ubuntu-latest
env:
RUSTFLAGS: --allow unknown_lints
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
features:
- serde
- std
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build `oauth-credentials`
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
- name: Test `oauth-credentials`
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
min-deps:
name: Check with `-Z minimal-versions`
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Cargo update
uses: actions-rs/cargo@v1
with:
command: update
args: -Z minimal-versions
env:
RUSTC_BOOTSTRAP: 1
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose --all-features