Merge pull request #453 from twitch-rs/renovate/all-actions #2055
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 | |
env: | |
CI_TWITCH_API_FEATURES: "twitch_oauth2/all all unsupported deny_unknown_fields ureq" | |
MSRV: 1.77.0 | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: [main] | |
merge_group: | |
types: [checks_requested] | |
jobs: | |
ci: | |
name: CI | |
needs: [test, rustfmt, prettier, clippy, docs, release] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' | |
- name: Done | |
run: exit 0 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [test, rustfmt, clippy, docs] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # fetch tags for publish | |
# ssh-key: "${{ secrets.COMMIT_KEY }}" # use deploy key to trigger workflow on tag | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo xtask release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
test: | |
name: Tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
rust: ["", nightly] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust || env.MSRV }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Test twitch_api | |
run: cargo test --locked --all-targets --features "${{ env.CI_TWITCH_API_FEATURES }}" ${{matrix.rust == 'nightly' && '--workspace' || ''}} | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- name: Run fmt -- --check | |
run: cargo fmt -- --check | |
prettier: | |
name: Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check formatting with Prettier | |
uses: actionsx/prettier@v3 | |
with: | |
args: -c . | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --locked --all-targets --no-default-features -p twitch_api | |
- run: cargo clippy --locked --all-targets --no-default-features --features "helix" -p twitch_api | |
- run: cargo clippy --locked --all-targets --no-default-features --features "helix client" -p twitch_api | |
- run: cargo clippy --locked --all-targets --no-default-features --features "pubsub" -p twitch_api | |
- run: cargo clippy --locked --all-targets --no-default-features --features "eventsub" -p twitch_api | |
- run: cargo clippy --locked --all-targets --features "${{ env.CI_TWITCH_API_FEATURES }} trace_unknown_fields" -p twitch_api | |
- run: cargo clippy --locked --all-targets --features "${{ env.CI_TWITCH_API_FEATURES }} _all" -p twitch_api | |
- run: cargo clippy --locked --all-targets --all-features --workspace | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
- uses: Swatinem/rust-cache@v2 | |
# Check if overviews are up-to-date | |
- name: Generate and check overviews | |
run: cargo xtask overview --check | |
# We do the following to make sure docs.rs can document properly without anything broken, and that docs are working. | |
- name: Run doc tests | |
run: cargo test --doc --features "${{ env.CI_TWITCH_API_FEATURES }} _all" | |
- name: Check twitch_api docs | |
run: cargo xtask doc |