-
Notifications
You must be signed in to change notification settings - Fork 125
289 lines (269 loc) · 9.61 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
name: CI
on:
push:
branches: ["main"]
paths-ignore:
- "docs/**"
- "README.md"
pull_request:
branches: ["main"]
paths-ignore:
- "docs/**"
- "README.md"
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
clippy:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --examples --tests
clippy-web:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: Run clippy
working-directory: web
run: cargo clippy --workspace
test-linux:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev
- name: Install run (headless) dependencies
run: |
sudo apt-get update
sudo apt install -y libxcb-xfixes0-dev vulkan-validationlayers-dev mesa-vulkan-drivers libasound2-dev
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- uses: taiki-e/install-action@cargo-nextest
- name: Run tests
uses: actions-rs/cargo@v1
env:
RUSTFLAGS: "-C debuginfo=0"
with:
command: nextest
args: run --workspace
# Provides a history of the cache content builds over build to make troubleshooting easier
- name: Display target directory content
run: tree --du -h target
build-api-and-doc:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Check that guest/rust's documentation is well-formed
run: cd guest/rust && RUSTDOCFLAGS="-Dwarnings" cargo doc --workspace --all-features --no-deps
- name: Check that guest/rust builds under all configurations
run: cargo campfire-slim package check-all --delete-target
build-web:
runs-on: ubuntu-22.04
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Rust cache
uses: Leafwing-Studios/[email protected]
with:
cargo-target-dir: "web/target"
- name: "Build campfire"
uses: actions-rs/cargo@v1
with:
command: build
args: --package campfire --no-default-features
- name: "Build web client"
uses: actions-rs/cargo@v1
with:
command: run
args: --package campfire --no-default-features -- web build --profile release --target standalone
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: ambient-web-standalone
path: ./web/pkg
build:
strategy:
matrix:
include:
- os: macos-latest
- os: windows-latest
- os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- name: Free up disk space
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install build dependencies
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y tree libasound2-dev libglib2.0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libcairo-dev libgtk2.0-dev libsoup2.4-dev libgtk-3-dev libwebkit2gtk-4.0-dev xorg-dev ninja-build libxcb-render0-dev clang nodejs
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- name: Build
run: cargo build --workspace --release
- name: Upload ambient executable artifact
uses: actions/upload-artifact@v3
with:
name: ambient-${{ matrix.os }}
path: |
target/release/ambient
target/release/ambient.exe
build-guest-rust:
strategy:
matrix:
include:
- os: macos-latest
- os: windows-latest
- os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- name: Free up disk space
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Leafwing-Studios/[email protected]
with:
cargo-target-dir: "guest/rust/target"
- name: Build guest/rust
run: cd guest/rust && cargo build --workspace
golden-image-tests:
needs: build
runs-on: ubuntu-22.04
env:
RUST_LOG: ambient_gpu=info
EXAMPLES_ASSETS_HOST: ${{ secrets.EXAMPLES_ASSETS_HOST }}
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add --toolchain stable wasm32-wasi
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- name: Download ambient executable
uses: actions/download-artifact@v3
with:
name: ambient-ubuntu-22.04
- run: chmod a+x ambient
- name: Install run (headless) dependencies
run: |
sudo apt-get update
sudo apt install -y libxcb-xfixes0-dev vulkan-validationlayers-dev mesa-vulkan-drivers libasound2-dev
- name: Run golden image tests
run: cargo campfire-slim golden-images --ambient-path=./ambient check
- uses: actions/upload-artifact@v3
if: always()
with:
name: screenshots
path: |
guest/rust/examples/*/*/screenshot.png
guest/rust/examples/*/*/fail_screenshot.png
test-new-package-works:
needs: build
strategy:
matrix:
include:
- os: macos-latest
# We run out of storage space when trying to build and run the package on Windows.
# It would be nice to fix this at some point.
# - os: windows-latest
- os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: dtolnay/rust-toolchain@stable
- run: rustup target add --toolchain stable wasm32-wasi
- uses: actions/checkout@v3
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- name: Download ambient executable
uses: actions/download-artifact@v3
with:
name: ambient-${{ matrix.os }}
- run: chmod a+x ambient
- name: Check that new-package works
run: |
mkdir tmp
./ambient new --api-path $(pwd)/guest/rust/api /tmp/ci_test_package
cd /tmp/ci_test_package
cargo check -F client,server