-
Notifications
You must be signed in to change notification settings - Fork 12
259 lines (229 loc) · 9.08 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
on:
push:
branches:
- main
pull_request:
release:
types:
- created
name: CI
jobs:
lints:
if: false
name: Check and lints
runs-on: ubuntu-latest
env:
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- name: Set up Python
uses: actions/setup-python@v4
- name: Install gdtoolkit 4
run: pip3 install "gdtoolkit==4.*"
- name: Check format GDScript
run: gdformat -d godot/
- name: Install alsa and udev
if: runner.os == 'linux'
run: sudo apt-get update; sudo apt-get install --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 ffmpeg deps (macOs)
if: runner.os == 'macos'
run: brew install ffmpeg pkg-config
- name: set CLANG path for ffmpeg deps (windows)
if: runner.os == '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"
- name: cargo xtask install
working-directory: rust/xtask
run: cargo run -- install --no-templates
- uses: actions-rs/cargo@v1
name: cargo check
with:
command: check
args: --manifest-path rust/Cargo.toml
- uses: actions-rs/cargo@v1
name: cargo fmt
with:
command: fmt
args: --manifest-path rust/Cargo.toml --all -- --check
- uses: actions-rs/cargo@v1
name: cargo clippy
with:
command: clippy
args: --manifest-path rust/Cargo.toml -- -D warnings
coverage:
name: Coverage
if: false
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
env:
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
components: llvm-tools-preview
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/decentraland-godot-lib/target
rust/Cargo.lock
key: coverage-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: coverage-cargo-
- 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 ffmpeg deps (macOs)
if: runner.os == 'macos'
run: brew install ffmpeg pkg-config
- name: set CLANG path for ffmpeg deps (windows)
if: runner.os == '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"
- name: cargo xtask install
working-directory: rust/xtask
run: cargo run -- install --no-templates
- 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
working-directory: rust/xtask
run: cargo run -- coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
files: rust/coverage/*.lcov
build:
name: Build and test
# Comment next line to test this job on PRs
# if: ${{ github.ref == 'refs/heads/main' }}
strategy:
matrix:
os: [windows-latest] # , ubuntu-latest, macos-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
env:
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# Setup Cache
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
rust/decentraland-godot-lib/target/
rust/xtask/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
# Depedencies 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'
# => MacOS
# - name: install ffmpeg deps (macOs)
# if: runner.os == 'macos'
# run: brew install ffmpeg pkg-config
# => Windows
- name: set CLANG path for ffmpeg deps (windows)
if: runner.os == '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"
- name: cargo xtask install
working-directory: rust/xtask
run: cargo run -- install
- name: Set up target platform
if: ${{ matrix.os == 'macos-latest' }}
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
# Build section
- name: cargo build (linux/windows)
if: ${{ matrix.os != 'macos-latest' }}
working-directory: rust/xtask
run: cargo run -- run -r --only-build
- uses: actions-rs/cargo@v1
name: build for x86_64 (macos)
if: ${{ matrix.os == 'macos-latest' }}
with:
command: build
args: --manifest-path rust/decentraland-godot-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 rust/decentraland-godot-lib/Cargo.toml --release --target=aarch64-apple-darwin
- uses: actions-rs/cargo@v1
if: false # TODO: enable tests!
name: cargo test
with:
command: test
args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release
# Package section
# => MacOS
- name: Make universal library
if: ${{ matrix.os == 'macos-latest' }}
run: |
mkdir rust/decentraland-godot-lib/target/release || true
lipo -create rust/decentraland-godot-lib/target/x86_64-apple-darwin/release/libdecentraland_godot_lib.dylib rust/decentraland-godot-lib/target/aarch64-apple-darwin/release/libdecentraland_godot_lib.dylib -output rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib
- name: Copy library (windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
cp rust/decentraland-godot-lib/target/release/decentraland_godot_lib.dll godot/lib/
- name: Copy library (linux/macos)
if: ${{ matrix.os != 'windows-latest' }}
run: |
cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.so godot/lib/ || true
cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib godot/lib/ || true
- name: Export
working-directory: rust/xtask
run: cargo run -- export
- uses: actions/upload-artifact@master
with:
name: decentraland-godot-${{ matrix.os }}
path: |
exports/**/*