Skip to content

derive: Refactor to use syn::Error::to_compile_error #288

derive: Refactor to use syn::Error::to_compile_error

derive: Refactor to use syn::Error::to_compile_error #288

Workflow file for this run

name: CI
on: [push, pull_request]
env:
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install --no-self-update --profile=minimal --component=rustfmt -- stable
- run: cargo fmt -- --check --color=always
test:
name: Test
runs-on: ubuntu-latest
env:
CARGO_TARGET_DIR: target
RUSTDOCFLAGS: --deny warnings
RUSTFLAGS: --deny warnings
RUST_BACKTRACE: '1'
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
# The old toolchain is tested to detect accidental compatibility breakage, but we don't
# explicitly guarantee minimum toolchain version and this may increase at any time.
- '1.48.0'
target:
-
features:
- js
- js,derive
- js,hmac-sha1
exclude:
- toolchain: '1.48.0'
features: js,derive
- toolchain: '1.48.0'
features: 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@v4
- uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
components: ${{ matrix.components }}
- uses: Swatinem/rust-cache@v2
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')
run: cargo clippy --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' }}
run: cargo doc --verbose --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}' --no-deps
- name: Build `oauth1-request`
if: ${{ !matrix.minimum_rust }}
run: cargo build --verbose --tests --manifest-path oauth1-request/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
- name: Check `oauth1-request`
if: matrix.minimum_rust
# Cargo of toolchain v1.48.0 fails to resolve some dependencies, presumably because of the
# use of the resovler v2 by some the dependencies, even when none of the enabled crate
# features depend on them. To work around this, we instead build `oauth1-request` indirectly
# through `oauth1-request-test` crate, which depends on the crate but without the crate
# features that causes the issue.
run: cargo check --verbose --tests --manifest-path oauth1-request-test/Cargo.toml --no-default-features '--features=${{ matrix.features }}'
- name: Check `examples`
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
run: cargo check --verbose --manifest-path examples/Cargo.toml
- name: Test `oauth1-request`
if: ${{ !matrix.minimum_rust && matrix.target == '' }}
run: cargo test --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@v4
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- name: Build `oauth1-request-derive`
run: cargo build --verbose --tests --manifest-path=oauth1-request-derive/Cargo.toml
- name: Test `oauth1-request-derive`
run: cargo test --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@v4
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v4
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`
# 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.
run: cargo build --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@v4
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update ${{ matrix.toolchain }} --profile=minimal && rustup default ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- name: Build `oauth-credentials`
run: cargo build --verbose --manifest-path oauth-credentials/Cargo.toml --features=${{ matrix.features }}
- name: Test `oauth-credentials`
run: cargo test --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@v4
- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile=minimal && rustup default stable
- uses: Swatinem/rust-cache@v2
- name: Cargo update
run: cargo update -Z minimal-versions
env:
RUSTC_BOOTSTRAP: '1'
- name: Check
run: cargo check --verbose --all-features