Skip to content

Commit d8bc554

Browse files
committed
Update CI
1 parent 97bca36 commit d8bc554

File tree

1 file changed

+52
-112
lines changed

1 file changed

+52
-112
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,37 @@ name: CI
22

33
on: [push, pull_request]
44

5+
env:
6+
CARGO_INCREMENTAL: '0'
7+
CARGO_PROFILE_DEV_DEBUG: '0'
8+
CARGO_PROFILE_TEST_DEBUG: '0'
9+
CARGO_TERM_COLOR: always
10+
511
jobs:
612
fmt:
713
name: Rustfmt
814
runs-on: ubuntu-latest
915
steps:
10-
- uses: actions/checkout@v2
11-
- name: Install Rust toolchain
12-
uses: actions-rs/toolchain@v1
13-
with:
14-
toolchain: stable
15-
profile: minimal
16-
components: rustfmt
17-
- name: cargo fmt -- --check
18-
uses: actions-rs/cargo@v1
19-
with:
20-
command: fmt
21-
args: -- --check
16+
- uses: actions/checkout@v4
17+
- run: rustup install stable --profile=minimal --components=rustfmt
18+
- run: cargo fmt -- --check --color=always
2219
test:
2320
name: Test
2421
runs-on: ubuntu-latest
2522
env:
26-
CARGO_INCREMENTAL: 0
27-
CARGO_PROFILE_DEBUG_DEBUG: 0
2823
CARGO_TARGET_DIR: target
2924
RUSTDOCFLAGS: --deny warnings
3025
RUSTFLAGS: --deny warnings
31-
RUST_BACKTRACE: 1
26+
RUST_BACKTRACE: '1'
3227
strategy:
3328
fail-fast: false
3429
matrix:
3530
toolchain:
3631
- stable
3732
- beta
3833
- nightly
34+
# The old toolchain is tested to detect accidental compatibility breakage, but we don't
35+
# explicitly guarantee minimum toolchain version and this may increase at any time.
3936
- '1.48.0'
4037
target:
4138
-
@@ -61,16 +58,13 @@ jobs:
6158
- toolchain: '1.48.0'
6259
minimum_rust: true
6360
steps:
64-
- uses: actions/checkout@v2
65-
- name: Install Rust toolchain
66-
uses: actions-rs/toolchain@v1
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
6763
with:
6864
toolchain: ${{ matrix.toolchain }}
69-
target: ${{ matrix.target }}
70-
profile: minimal
71-
override: true
65+
targets: ${{ matrix.target }}
7266
components: ${{ matrix.components }}
73-
- uses: Swatinem/rust-cache@v1
67+
- uses: Swatinem/rust-cache@v2
7468
with:
7569
key: ${{ matrix.target }}
7670
- name: Install `wasm-bindgen-test-runner`
@@ -89,45 +83,27 @@ jobs:
8983
if: matrix.target != ''
9084
- name: Clippy `oauth1-request`
9185
if: contains(matrix.components, 'clippy')
92-
uses: actions-rs/cargo@v1
93-
with:
94-
command: clippy
95-
args: --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
86+
run: cargo clippy --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
9687
- name: Check docs of `oauth1-request`
9788
if: ${{ !matrix.minimum_rust && matrix.features == 'js,derive' }}
98-
uses: actions-rs/cargo@v1
99-
with:
100-
command: doc
101-
args: --verbose --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}' --no-deps
89+
run: cargo doc --verbose --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}' --no-deps
10290
- name: Build `oauth1-request`
10391
if: ${{ !matrix.minimum_rust }}
104-
uses: actions-rs/cargo@v1
105-
with:
106-
command: build
107-
args: --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
92+
run: cargo build --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
10893
- name: Check `oauth1-request`
10994
if: matrix.minimum_rust
110-
uses: actions-rs/cargo@v1
111-
with:
112-
command: check
113-
# Cargo of toolchain v1.48.0 cannot parse the registry information because of the use of
114-
# the resovler v2 by some of its dependencies, even when none of the enabled crate
115-
# features depend on them. To work around this, we instead build `oauth1-request`
116-
# indirectly through `oauth1-request-test` crate, which depends on the crate but without
117-
# the crate features that causes the issue.
118-
args: --verbose --tests --manifest-path oauth1-request-test/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
119-
- name: Build `examples`
95+
# Cargo of toolchain v1.48.0 cannot parse the registry information because of the use of the
96+
# resovler v2 by some of its dependencies, even when none of the enabled crate features
97+
# depend on them. To work around this, we instead build `oauth1-request` indirectly through
98+
# `oauth1-request-test` crate, which depends on the crate but without the crate features
99+
# that causes the issue.
100+
run: cargo check --verbose --tests --manifest-path oauth1-request-test/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
101+
- name: Check `examples`
120102
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
121-
uses: actions-rs/cargo@v1
122-
with:
123-
command: build
124-
args: --verbose --manifest-path examples/Cargo.toml
103+
run: cargo check --verbose --manifest-path examples/Cargo.toml
125104
- name: Test `oauth1-request`
126105
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
127-
uses: actions-rs/cargo@v1
128-
with:
129-
command: test
130-
args: --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
106+
run: cargo test --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
131107
derive-test:
132108
name: Test `oauth1-request-derive`
133109
runs-on: ubuntu-latest
@@ -143,24 +119,14 @@ jobs:
143119
# Also, we don't want the workflow to break nightly :)
144120
continue-on-error: ${{ matrix.toolchain != 'stable' }}
145121
steps:
146-
- uses: actions/checkout@v2
122+
- uses: actions/checkout@v4
147123
- name: Install Rust toolchain
148-
uses: actions-rs/toolchain@v1
149-
with:
150-
toolchain: ${{ matrix.toolchain }}
151-
profile: minimal
152-
override: true
153-
- uses: Swatinem/rust-cache@v1
124+
run: rustup install ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
125+
- uses: Swatinem/rust-cache@v2
154126
- name: Build `oauth1-request-derive`
155-
uses: actions-rs/cargo@v1
156-
with:
157-
command: build
158-
args: --verbose --tests --manifest-path oauth1-request-derive/Cargo.toml
127+
run: cargo build --verbose --tests --manifest-path=oauth1-request-derive/Cargo.toml
159128
- name: Test `oauth1-request-derive`
160-
uses: actions-rs/cargo@v1
161-
with:
162-
command: test
163-
args: --verbose --manifest-path oauth1-request-derive/Cargo.toml
129+
run: cargo test --verbose --manifest-path oauth1-request-derive/Cargo.toml
164130
credentials-msrv:
165131
name: Build `oauth-credentials` on MSRV
166132
runs-on: ubuntu-latest
@@ -177,15 +143,11 @@ jobs:
177143
- toolchain: '1.36.0'
178144
features: alloc
179145
steps:
180-
- uses: actions/checkout@v2
146+
- uses: actions/checkout@v4
181147
- name: Install Rust toolchain
182-
uses: actions-rs/toolchain@v1
183-
with:
184-
toolchain: ${{ matrix.toolchain }}
185-
profile: minimal
186-
override: true
187-
- uses: Swatinem/rust-cache@v1
188-
- uses: actions/checkout@v2
148+
run: rustup install ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
149+
- uses: Swatinem/rust-cache@v2
150+
- uses: actions/checkout@v4
189151
with:
190152
repository: rust-lang/crates.io-index
191153
ref: 46a429eac9f70fd7281922780d7dd42e2fb7ab77
@@ -201,13 +163,10 @@ jobs:
201163
registry = "file://$GITHUB_WORKSPACE/crates.io-index"
202164
EOF
203165
- name: Build `oauth-credentials`
204-
uses: actions-rs/cargo@v1
205-
with:
206-
command: build
207-
# Toolchains older than 1.8.0 cannot compile `oauth-credentials` directly
208-
# because the toolchains do not understand Cargo registry's information for `serde`, so we
209-
# use the same trick that we used for `oauth1-request`'s minimum tested toolchain.
210-
args: --verbose --manifest-path oauth-credentials-test/Cargo.toml --no-default-features --features=${{ matrix.features }}
166+
# Toolchains older than 1.8.0 cannot compile `oauth-credentials` directly
167+
# because the toolchains do not understand Cargo registry's information for `serde`, so we
168+
# use the same trick that we used for `oauth1-request`'s minimum tested toolchain.
169+
run: cargo build --verbose --manifest-path oauth-credentials-test/Cargo.toml --no-default-features --features=${{ matrix.features }}
211170
credentials-test:
212171
name: Test `oauth-credentials`
213172
runs-on: ubuntu-latest
@@ -224,44 +183,25 @@ jobs:
224183
- serde
225184
- std
226185
steps:
227-
- uses: actions/checkout@v2
186+
- uses: actions/checkout@v4
228187
- name: Install Rust toolchain
229-
uses: actions-rs/toolchain@v1
230-
with:
231-
toolchain: ${{ matrix.toolchain }}
232-
profile: minimal
233-
override: true
234-
- uses: Swatinem/rust-cache@v1
188+
run: rustup install ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
189+
- uses: Swatinem/rust-cache@v2
235190
- name: Build `oauth-credentials`
236-
uses: actions-rs/cargo@v1
237-
with:
238-
command: build
239-
args: --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
191+
run: cargo build --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
240192
- name: Test `oauth-credentials`
241-
uses: actions-rs/cargo@v1
242-
with:
243-
command: test
244-
args: --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
193+
run: cargo test --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
245194
min-deps:
246195
name: Check with `-Z minimal-versions`
247196
runs-on: ubuntu-latest
248197
steps:
249-
- uses: actions/checkout@v2
198+
- uses: actions/checkout@v4
250199
- name: Install Rust toolchain
251-
uses: actions-rs/toolchain@v1
252-
with:
253-
toolchain: stable
254-
profile: minimal
255-
- uses: Swatinem/rust-cache@v1
200+
run: rustup install stable --profile=minimal && rustup default
201+
- uses: Swatinem/rust-cache@v2
256202
- name: Cargo update
257-
uses: actions-rs/cargo@v1
258-
with:
259-
command: update
260-
args: -Z minimal-versions
203+
run: cargo update -Z minimal-versions
261204
env:
262-
RUSTC_BOOTSTRAP: 1
205+
RUSTC_BOOTSTRAP: '1'
263206
- name: Check
264-
uses: actions-rs/cargo@v1
265-
with:
266-
command: check
267-
args: --verbose --all-features
207+
run: cargo check --verbose --all-features

0 commit comments

Comments
 (0)