-
Notifications
You must be signed in to change notification settings - Fork 33
119 lines (116 loc) · 3.95 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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