CI #280
Workflow file for this run
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: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: [main] | |
merge_group: | |
types: [checks_requested] | |
env: | |
MSRV: 1.67.0 | |
jobs: | |
ci: | |
name: CI | |
needs: [test, fmt, 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, fmt, 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: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust || env.MSRV }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Test twitch_types | |
run: cargo test --all-targets --all-features ${{matrix.rust == 'nightly' && '--workspace'}} | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- name: Run fmt --all -- --check | |
run: cargo fmt --all -- --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 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run clippy | |
run: cargo clippy --locked | |
- name: Run clippy --all-targets --all-features --workspace | |
run: cargo clippy --locked --all-targets --all-features --workspace | |
docs: | |
name: Docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
# 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 --all-features --locked | |
- name: Check twitch_types docs | |
env: | |
RUSTDOCFLAGS: "--cfg nightly" | |
RUSTFLAGS: "--cfg nightly" | |
run: cargo doc --locked --no-deps --all-features |