Skip to content

Commit

Permalink
Fix CI for minimum tested toolchain version
Browse files Browse the repository at this point in the history
  • Loading branch information
tesaguri committed Jun 19, 2024
1 parent d8d6630 commit e9e6917
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- stable
- beta
- nightly
- '1.46.0'
- '1.48.0'
target:
-
features:
Expand All @@ -53,6 +53,8 @@ jobs:
- toolchain: stable
features: js
target: wasm32-unknown-unknown
- toolchain: '1.48.0'
minimum_rust: true
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
Expand All @@ -77,7 +79,7 @@ jobs:
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.toolchain == '1.46.0'
if: matrix.minimum_rust
- run: echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> "$GITHUB_ENV"
if: matrix.target != ''
- name: Clippy `oauth1-request`
Expand All @@ -87,23 +89,35 @@ jobs:
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.features == 'js,derive'
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.target == '' && matrix.toolchain != '1.46.0' }}
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
Expand Down Expand Up @@ -185,10 +199,8 @@ jobs:
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`
# (see <https://github.com/rust-lang/cargo/issues/3763>).
# So, with these toolchains, we instead build a dependant crate of `oauth-credentials`
# without `serde` feature.
# 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`
Expand Down
22 changes: 22 additions & 0 deletions oauth1-request-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[workspace]

[package]
name = "oauth1-request-test"
version = "0.0.0"
edition = "2018"
authors = ["Daiki Mizukami <[email protected]>"]
description = "A hack to make the CI work with older toolchains."
publish = false

[dependencies]
oauth1-request = { path = "../oauth1-request", default-features = false }

[features]
default = ["hmac-sha1", "std"]
alloc = ["oauth1-request/alloc"]
hmac-sha1 = ["oauth1-request/hmac-sha1"]
rsa-sha1-06 = ["oauth1-request/rsa-sha1-06"]
js = ["oauth1-request/js"]
serde = ["oauth1-request/serde"]
std = ["oauth1-request/std"]
test = ["oauth1-request/test"]
1 change: 1 addition & 0 deletions oauth1-request-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use oauth1_request::*;

0 comments on commit e9e6917

Please sign in to comment.