Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
tesaguri committed Jun 19, 2024
1 parent bd0233b commit e1f5c3c
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 154 deletions.
318 changes: 164 additions & 154 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,27 @@ jobs:
matrix:
toolchain:
- stable
- beta
- nightly
- '1.46.0'
# - 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: stable
# components: clippy
# - toolchain: beta
# components: clippy
# - toolchain: nightly
# components: clippy
# - toolchain: stable
# features: js
# target: wasm32-unknown-unknown
- toolchain: '1.48.0'
msrv: 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.msrv
- run: echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> "$GITHUB_ENV"
if: matrix.target != ''
- name: Clippy `oauth1-request`
Expand All @@ -87,163 +89,171 @@ 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.msrv && 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.msrv
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.msrv && matrix.features == 'js'
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose --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.msrv && matrix.target == '' }}
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --manifest-path examples/Cargo.toml
- name: Test `oauth1-request`
if: ${{ !matrix.msrv && 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`
# (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.
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
# 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`
# # (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.
# 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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"oauth-credentials",
"oauth1-request",
"oauth1-request-derive",
"oauth1-request-test",
]

[patch.crates-io]
Expand Down
20 changes: 20 additions & 0 deletions oauth1-request-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "oauth1-request-test"
version = "0.0.0"
edition = "2018"
authors = ["Daiki Mizukami <tesaguriguma@gmail.com>"]
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 e1f5c3c

Please sign in to comment.