-
Notifications
You must be signed in to change notification settings - Fork 352
254 lines (211 loc) · 7.59 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
name: CI
on:
pull_request:
merge_group:
push:
branches:
- 'staging'
- 'trying'
concurrency:
# Only the same workflows on the same branch can cancel each other.
group: ${{ github.workflow }}-${{ github.ref }}
# Only cancel runs in a PR; we don't want to cancel commit checks on main.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
mega-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `mega-linter`
fetch-depth: 0
- name: Run Mega Linter
uses: oxsecurity/megalinter/flavors/javascript@v7
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
test-code-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Build & run doc tests
run: cd learning-code-examples && ./validate_examples.sh
check-hide-lines:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Check hide-lines
run: cd write-rustdoc-hide-lines && cargo run --release -- check ../content
lint-tools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Check formatting
run: cargo fmt --check --all
- name: Check clippy
run: cargo clippy --workspace -- -Dwarnings
typos:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/[email protected]
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
echo 'if you use VSCode, you can also install `Typos Spell Checker'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
generate-assets:
needs: [mega-linter, test-code-examples, lint-tools, check-hide-lines, typos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
# Uses the generate-assets cache, which is updated in deploy.yml
- name: Restore cached assets
# Do not use cache when in merge queue
if: ${{ github.event_name != 'merge_group' }}
id: restore-cached-assets
uses: actions/cache/restore@v4
with:
# Must be kept in sync with deploy.yml
path: content/assets
key: assets-${{ steps.date.outputs.date }}-${{ hashFiles('generate-assets/**/*.rs', 'generate-assets/Cargo.toml', 'generate-assets/generate_assets.sh') }}
- name: "Build Bevy Assets"
# Only run if in merge queue or if no cache was found. `cache-hit` is a string, so we
# cannot use normal boolean operators on it, as `!'false' == true`.
if: ${{ github.event_name == 'merge_group' || steps.restore-cached-assets.outputs.cache-hit != 'true' }}
working-directory: generate-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./generate_assets.sh
- uses: actions/upload-artifact@v4
with:
name: generated-assets
path: content/assets
retention-days: 1
generate-errors:
needs: [mega-linter, test-code-examples, lint-tools, check-hide-lines, typos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
generate-errors/target/
key: ${{ runner.os }}-generate-errors-${{ hashFiles('generate-errors/Cargo.toml') }}
- name: "Build Bevy Error Codes"
run: >
cd generate-errors &&
./generate_errors.sh
- uses: actions/upload-artifact@v4
with:
name: generated-errors
path: content/learn/errors
retention-days: 1
generate-wasm-examples:
needs: [mega-linter, test-code-examples, lint-tools, check-hide-lines, typos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: "Build Bevy Examples"
run: |
cd generate-wasm-examples &&
./generate_wasm_examples.sh
- uses: actions/upload-artifact@v4
with:
name: generated-wasm-examples
path: content/examples
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: generated-wasm-examples-webgpu
path: content/examples-webgpu
retention-days: 1
generate-community:
needs: [mega-linter, test-code-examples, lint-tools, check-hide-lines, typos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
generate-community/target/
key: ${{ runner.os }}-generate-community-${{ hashFiles('generate-community/Cargo.toml') }}
- name: "Build Bevy Community"
run: >
cd generate-community &&
./generate_community.sh
- uses: actions/upload-artifact@v4
with:
name: generated-community
path: content/community/people
retention-days: 1
build-website:
runs-on: ubuntu-latest
needs: [mega-linter, test-code-examples, lint-tools, check-hide-lines, typos, generate-assets, generate-errors, generate-wasm-examples, generate-community]
steps:
- uses: actions/checkout@v4
- name: Checkout Bevy repo for asset access
uses: actions/checkout@v4
with:
repository: 'bevyengine/bevy'
ref: 'latest'
path: 'bevy'
- name: Move Bevy assets to static files
# during the real build, this is handled by the generate_wasm_examples.sh script.
run: mv bevy/assets static/assets/examples/
- uses: actions/download-artifact@v4
with:
name: generated-assets
path: content/assets
- uses: actions/download-artifact@v4
with:
name: generated-errors
path: content/learn/errors
- uses: actions/download-artifact@v4
with:
name: generated-wasm-examples
path: content/examples
- uses: actions/download-artifact@v4
with:
name: generated-wasm-examples-webgpu
path: content/examples-webgpu
- uses: actions/download-artifact@v4
with:
name: generated-community
path: content/community/people
- name: "Build website"
uses: shalzz/[email protected]
env:
PAGES_BRANCH: gh-pages
BUILD_DIR: .
BUILD_ONLY: true
TOKEN: fake-secret