-
Notifications
You must be signed in to change notification settings - Fork 12
321 lines (279 loc) · 10.7 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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
on:
push:
branches:
- main
pull_request:
release:
types:
- created
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lints:
name: Check and lints
runs-on: ubuntu-22.04
env:
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78
override: true
components: clippy, rustfmt
- run: rustup component add rustfmt
- name: Set up Python
uses: actions/setup-python@v4
- name: Install gdtoolkit 4
run: pip3 install git+https://github.com/kuruk-mm/godot-gdscript-toolkit.git
- name: Check format GDScript
run: gdformat -d godot/
- name: GDScript Linter
run: gdlint godot/
# Dependencies section
# => Linux
- name: Install alsa and udev
if: runner.os == 'linux'
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev
- name: install ffmpeg deps (linux)
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev
if: runner.os == 'linux'
- name: cargo xtask install
run: cargo run -- install --no-templates
- name: cargo check
working-directory: lib
run: cargo check
- name: cargo fmt
working-directory: lib
run: cargo fmt --all -- --check
- name: cargo clippy
working-directory: lib
run: cargo clippy -- -D warnings
coverage:
name: Coverage
runs-on: ubuntu-22.04
env:
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin
steps:
- name: Checkout sources
uses: actions/checkout@v2
# To host test-realm local server
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Prepare and run local test-realm
run: |
mkdir -p tests/server
cd tests/server
npm init -y
npm install @dcl/[email protected]
sed -i 's|https://decentraland.github.io/scene-explorer-tests/|http://localhost:7666/|g' node_modules/@dcl/scene-explorer-tests/static/scene-explorer-tests/about
npm i -g http-server
http-server node_modules/@dcl/scene-explorer-tests/static -p 7666 &
# /changerealm http://localhost:7666/scene-explorer-tests/
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.76
override: true
components: llvm-tools-preview
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
lib/target/
lib/Cargo.lock
target/
Cargo.lock
key: coverage-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: coverage-cargo-
- name: Prepare graphics renderering
run: |
sudo apt-get -y install xvfb
sudo /usr/bin/Xvfb :0 -screen 0 1280x1024x24 &
# Dependencies section
# => Linux
- name: Install alsa and udev
if: runner.os == 'linux'
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev
- name: install ffmpeg deps (linux)
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev
if: runner.os == 'linux'
- name: install livekit deps (linux)
run: sudo apt update -y; sudo apt install -y libssl-dev libx11-dev libgl1-mesa-dev libxext-dev
if: runner.os == 'linux'
- name: cargo xtask install
run: cargo run -- install --no-templates
# Build section
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run xtask coverage
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
cargo run -- coverage
- name: Upload to codecov.io
if: success() || failure()
uses: codecov/codecov-action@v3
with:
files: rust/coverage/*.lcov
- name: Upload artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: snapshots
path: tests/snapshots/comparison/**/*
build:
name: Build and test
# Comment next line to test this job on PRs
if: ${{ github.ref == 'refs/heads/main' }}
strategy:
fail-fast: false
matrix:
os: [self-hosted-windows, ubuntu-22.04, macos-14-xlarge]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76
override: true
- name: Set up cargo cache
if: runner.os != 'macos'
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
lib/target/
lib/Cargo.lock
target/
Cargo.lock
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
# Dependencies section
# => Linux
- name: Install alsa and udev
if: runner.os == 'linux'
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev
- name: install ffmpeg deps (linux)
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev
if: runner.os == 'linux'
- name: install livekit deps (linux)
run: sudo apt update -y; sudo apt install -y libssl-dev libx11-dev libgl1-mesa-dev libxext-dev
if: runner.os == 'linux'
# => MacOS
- name: install ffmpeg deps (macOs)
if: runner.os == 'macos'
run: |
brew install ffmpeg@6 pkg-config
echo "PKG_CONFIG_PATH=/opt/homebrew/opt/ffmpeg@6/lib/pkgconfig" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/ffmpeg@6/include" >> $GITHUB_ENV
echo "LDFLAGS=-L/opt/homebrew/opt/ffmpeg@6/lib" >> $GITHUB_ENV
# TODO: cross-build deprecated with the ffmpeg integration
# - name: Set up target platform
# if: ${{ matrix.os == 'macos-latest' }}
# run: |
# rustup target add x86_64-apple-darwin
# rustup target add aarch64-apple-darwin
# => Windows
- name: set CLANG path for ffmpeg deps (windows)
if: runner.os == 'windows' && matrix.os != 'self-hosted-windows'
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z
7z x ffmpeg-release-full-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
# => All platforms
- name: cargo xtask install
run: cargo run -- install
# Build section
- name: cargo build
working-directory: lib
run: cargo build --release
# TODO: cross-build deprecated with the ffmpeg integration
# - uses: actions-rs/cargo@v1
# name: build for x86_64 (macos)
# if: ${{ matrix.os == 'macos-latest' }}
# with:
# command: build
# args: --manifest-path lib/Cargo.toml --release --target=x86_64-apple-darwin
# - uses: actions-rs/cargo@v1
# name: build for arm64 (macos)
# if: ${{ matrix.os == 'macos-latest' }}
# with:
# command: build
# args: --manifest-path lib/Cargo.toml --release --target=aarch64-apple-darwin
- name: cargo build
working-directory: lib
run: cargo test --release -- --skip auth
# TODO: cross-build deprecated with the ffmpeg integration
# Package section
# # => MacOS
# - name: Make universal library
# if: ${{ matrix.os == 'macos-latest' }}
# run: |
# mkdir lib/target/release || true
# lipo -create lib/target/x86_64-apple-darwin/release/libdclgodot.dylib lib/target/aarch64-apple-darwin/release/libdclgodot.dylib -output lib/target/release/libdclgodot.dylib
# => Linux/MacOS (unix)
- name: Copy library (linux/macos)
if: runner.os != 'windows'
run: |
cp lib/target/release/libdclgodot.so godot/lib/ || true
cp lib/target/release/libdclgodot.dylib godot/lib/ || true
# => Windows
- name: Copy library (windows)
if: runner.os == 'windows'
run: |
cp lib/target/release/dclgodot.dll godot/lib/
cp .bin/ffmpeg/ffmpeg-6.0-full_build-shared/bin/*.dll godot/lib/
# Export section (multi platform)
- name: Export
run: cargo run -- export
- uses: actions/upload-artifact@v4
with:
name: decentraland-godot-${{ matrix.os }}
path: |
exports/**/*
- name: Build Docker Image
if: matrix.os == 'ubuntu-22.04'
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: godot-explorer
tags: ${{ github.sha }} ${{ inputs.docker-tag }}
dockerfiles: |
./Dockerfile
build-args: |
${{ inputs.build-args }}
COMMIT_HASH=${{ github.sha }}
- name: Push To quay.io
if: matrix.os == 'ubuntu-22.04'
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/decentraland
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"