Fix clippy warning on next (#3078) #5869
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
env: | |
rust_min: 1.82.0 | |
rust_nightly: nightly-2024-11-01 | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- stable | |
- beta | |
# The build matrix doesn't support the `env` variable in expressions | |
# see: jobs.nightly | |
# - nightly | |
- Windows | |
- native-tls | |
- no default features | |
- no cache | |
- no gateway | |
- unstable Discord API features | |
- zlib compression | |
- zstd compression | |
- zlib and zstd compression | |
include: | |
- name: beta | |
toolchain: beta | |
- name: Windows | |
os: windows-latest | |
- name: native-tls | |
features: default_native_tls | |
- name: no default features | |
features: " " | |
- name: no cache | |
features: framework rustls_backend | |
- name: no gateway | |
features: model rustls_backend | |
- name: chrono | |
features: chrono | |
- name: unstable API + typesize | |
features: default unstable typesize | |
dont-test: true | |
- name: builder without model | |
features: builder | |
dont-test: true | |
- name: unstable Discord API (no default features) | |
features: unstable | |
dont-test: true | |
- name: zlib compression | |
features: default transport_compression_zlib | |
- name: zstd compression | |
features: default transport_compression_zstd | |
- name: zlib and zstd compression | |
features: default transport_compression_zlib transport_compression_zstd | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain || 'stable' }} | |
- name: Add problem matchers | |
shell: bash | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build all features | |
if: matrix.features == '' | |
run: cargo build --features full | |
- name: Test all features | |
if: matrix.features == '' | |
run: cargo test --features full | |
- name: Build some features | |
if: matrix.features | |
run: cargo build --no-default-features --features "${{ matrix.features }}" | |
- name: Test some features | |
if: ${{ !matrix.dont-test && matrix.features }} | |
run: cargo test --no-default-features --features "${{ matrix.features }}" | |
nightly: | |
name: Test (nightly) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain (${{ env.rust_nightly }}) | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.rust_nightly }} | |
- name: Add problem matchers | |
shell: bash | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build all features | |
run: cargo build --features full | |
- name: Test all features | |
run: cargo test --features full | |
macOS: | |
name: Test (macOS) | |
runs-on: macos-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Add problem matchers | |
shell: bash | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cargo build | |
- name: Test | |
run: cargo test | |
MSRV: | |
runs-on: ubuntu-latest | |
# We only run this job on the current branch as keeping MSRV the same is not important on next. | |
if: (github.event_name == 'push' && github.ref_name == 'current') || | |
(github.event_name == 'pull_request' && github.base_ref == 'current') | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain (${{ env.rust_min }}) | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.rust_min }} | |
- name: Add problem matchers | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check | |
run: cargo check --features full | |
min_versions: | |
name: Check minimal versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain (${{ env.rust_nightly }}) | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.rust_nightly }} | |
- name: Add problem matchers | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check minimal versions | |
run: | | |
cargo update -Z minimal-versions | |
cargo check | |
doc: | |
name: Build docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain (${{ env.rust_nightly }}) | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.rust_nightly }} | |
- name: Add problem matchers | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build docs | |
run: | | |
cargo doc --no-deps --features full,unstable | |
env: | |
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links | |
examples: | |
name: Examples | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Add problem matchers | |
run: echo "::add-matcher::.github/matchers/rust.json" | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: 'Check example 1' | |
run: cargo check -p e01_basic_ping_bot | |
- name: 'Check example 2' | |
run: cargo check -p e02_transparent_guild_sharding | |
- name: 'Check example 3' | |
run: cargo check -p e03_struct_utilities | |
- name: 'Check example 4' | |
run: cargo check -p e04_message_builder | |
- name: 'Check example 5' | |
run: cargo check -p e05_sample_bot_structure | |
- name: 'Check example 6' | |
run: cargo check -p e06_env_logging | |
- name: 'Check example 7' | |
run: cargo check -p e07_shard_manager | |
- name: 'Check example 8' | |
run: cargo check -p e08_create_message_builder | |
- name: 'Check example 09' | |
run: cargo check -p e09_collectors | |
- name: 'Check example 10' | |
run: cargo check -p e10_gateway_intents | |
- name: 'Check example 11' | |
run: cargo check -p e11_global_data | |
- name: 'Check example 12' | |
run: cargo check -p e12_parallel_loops | |
- name: 'Check example 13' | |
run: cargo check -p e13_sqlite_database | |
- name: 'Check example 14' | |
run: cargo check -p e14_message_components | |
- name: 'Check example 15' | |
run: cargo check -p e15_webhook | |
- name: 'Check example 16' | |
run: cargo check -p e16_interactions_endpoint |