forked from serenity-rs/serenity
-
Notifications
You must be signed in to change notification settings - Fork 3
272 lines (219 loc) · 7.43 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
name: CI
on: [push, pull_request]
env:
rust_min: 1.74.0
rust_nightly: nightly-2024-03-09
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
- simd-json
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: builder client framework gateway model http standard_framework utils rustls_backend
- name: simd-json
features: default_no_backend rustls_backend simd_json
- name: no gateway
features: model http rustls_backend
- name: chrono
features: chrono
- name: unstable API + typesize
features: default unstable_discord_api typesize
dont-test: true
- name: builder without model
features: builder
dont-test: true
- name: unstable Discord API (no default features)
features: unstable_discord_api
dont-test: true
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: Remove cargo build config
run: rm .cargo/config.toml
- 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 collector,voice,unstable_discord_api
cargo doc --no-deps -p command_attr
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_command_framework
- name: 'Check example 6'
run: cargo check -p e06_sample_bot_structure
- name: 'Check example 7'
run: cargo check -p e07_env_logging
- name: 'Check example 8'
run: cargo check -p e08_shard_manager
- name: 'Check example 9'
run: cargo check -p e09_create_message_builder
- name: 'Check example 10'
run: cargo check -p e10_collectors
- name: 'Check example 11'
run: cargo check -p e11_gateway_intents
- name: 'Check example 12'
run: cargo check -p e12_global_data
- name: 'Check example 13'
run: cargo check -p e13_parallel_loops
- name: 'Check example 14'
run: cargo check -p e14_slash_commands
- name: 'Check example 15'
run: cargo check -p e15_simple_dashboard
- name: 'Check example 16'
run: cargo check -p e16_sqlite_database
- name: 'Check example 17'
run: cargo check -p e17_message_components
- name: 'Check example 18'
run: cargo check -p e18_webhook
- name: 'Check example 19'
run: cargo check -p e19_interactions_endpoint