-
-
Notifications
You must be signed in to change notification settings - Fork 14
190 lines (177 loc) · 6.15 KB
/
push.yaml
File metadata and controls
190 lines (177 loc) · 6.15 KB
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
# Happens on push to main, and all PRs
name: push
on:
push:
branches:
- main
pull_request:
env:
# For setup-rust, see https://github.com/moonrepo/setup-rust/issues/22
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_GPU_COMMITSH: 31153a8edd3bc626d4b9fb0cd7bdb7a8b30797d3
jobs:
# Installs cargo deps and sets the cache directory for subsequent jobs
install-cargo-gpu:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
RUST_LOG: debug
RUNNER_OS: ${{ matrix.os }}
outputs:
cachepath-macOS: ${{ steps.cachepathstep.outputs.cachepath-macOS }}
cachepath-Linux: ${{ steps.cachepathstep.outputs.cachepath-Linux }}
cachepath-Windows: ${{ steps.cachepathstep.outputs.cachepath-Windows }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v4
with:
path: ~/.cargo
# THIS KEY MUST MATCH BELOW
key: cargo-cache-${{ env.CARGO_GPU_COMMITSH }}-${{ matrix.os }}
- uses: moonrepo/setup-rust@v1
- run: rustup default stable
- run: rustup update
- run: |
cargo install --git https://github.com/rust-gpu/cargo-gpu --rev $CARGO_GPU_COMMITSH cargo-gpu
- run: cargo gpu show commitsh
- id: cachepathstep
run: |
CACHE_PATH=`cargo gpu show cache-directory`
echo $CACHE_PATH
echo "cachepath-$RUNNER_OS=$CACHE_PATH" >> "$GITHUB_OUTPUT"
# Builds the shaders and ensures there is no git diff
renderling-build-shaders:
needs: install-cargo-gpu
strategy:
fail-fast: false
matrix:
# temporarily skip windows, revisit after a fix for this error is found:
# https://github.com/rust-lang/cc-rs/issues/1331
os: [ubuntu-latest, ubuntu-24.04, macos-latest] #, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
RUST_LOG: debug
steps:
- uses: actions/checkout@v2
# Run moonrepo/setup-rust BEFORE restoring ~/.cargo cache, because
# moonrepo restores its own ~/.cargo cache which would overwrite
# the cargo-gpu binary installed by the install-cargo-gpu job.
- uses: moonrepo/setup-rust@v1
- uses: actions/cache@v4
with:
path: ~/.cargo
# THIS KEY MUST MATCH ABOVE
key: cargo-cache-${{ env.CARGO_GPU_COMMITSH }}-${{ matrix.os }}
- uses: actions/cache@v4
with:
path: |
${{ needs.install-cargo-gpu.outputs.cachepath-macOS }}
${{ needs.install-cargo-gpu.outputs.cachepath-Linux }}
${{ needs.install-cargo-gpu.outputs.cachepath-Windows }}
key: rust-gpu-cache-0-${{ matrix.os }}
- run: rustup install nightly
- run: rustup component add --toolchain nightly rustfmt
- run: cargo gpu show commitsh
- run: rm -rf crates/renderling/src/linkage/* crates/renderling/shaders
- run: cargo shaders
- run: cargo linkage
- run: cargo build -p renderling
- run: git diff --exit-code --no-ext-diff
# Ensures code is properly formatted with nightly rustfmt
renderling-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v4
with:
path: ~/.cargo
# THIS KEY MUST MATCH ABOVE
key: cargo-cache-${{ env.CARGO_GPU_COMMITSH }}-ubuntu-latest
- run: mkdir -p $HOME/.cargo/bin
- uses: moonrepo/setup-rust@v1
- run: rustup install nightly
- run: rustup component add --toolchain nightly rustfmt
- run: cargo +nightly fmt -- --check
# BAU clippy lints
renderling-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: moonrepo/setup-rust@v1
- run: cargo clippy
# Ensures the example glTF viewer compiles
renderling-build-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: moonrepo/setup-rust@v1
- run: cargo build -p example
# BAU tests
renderling-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: moonrepo/setup-rust@v1
- uses: actions/cache@v4
with:
path: ~/.cargo
key: ${{ matrix.os }}-test-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ matrix.os }}-cargo-
- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install mesa-vulkan-drivers libvulkan1 vulkan-tools vulkan-validationlayers
- name: Install cargo-nextest
run: cargo install --locked cargo-nextest || true
- name: Test
run: cargo nextest run -j 1
env:
RUST_BACKTRACE: 1
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-output-${{ matrix.os }}
path: test_output
## WASM tests, commented out until we can get a proper headless browser on CI
# renderling-wasm-test:
# # strategy:
# # matrix:
# # # empty string means ff, --chrome is chrome
# # browser: ["", "--chrome"]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: moonrepo/setup-rust@v1
# - uses: actions/cache@v4
# with:
# path: ~/.cargo
# key: ${{ runner.os }}-test-cargo-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.os }}-cargo-
# - name: Install linux deps
# if: runner.os == 'Linux'
# run: |
# sudo apt-get -y update
# sudo apt-get -y install mesa-vulkan-drivers libvulkan1 vulkan-tools vulkan-validationlayers
# - name: Install wasm-pack
# run: cargo install --locked wasm-pack || true
# - name: Test WASM
# env:
# RUST_LOG: info
# run: cargo test-wasm --chrome #${{ matrix.browser }}
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: test-output-${{ runner.os }}-wasm
# path: test_output