-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
327 lines (317 loc) · 17.4 KB
/
.gitlab-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
322
323
324
325
326
327
# Copyright © 2020-2021 Jeremy Carter <[email protected]>
#
# By using this software, you agree to the LICENSE TERMS
# outlined in the file titled LICENSE.md contained in the
# top-level directory of this project. If you don't agree
# to the LICENSE TERMS, you aren't allowed to use this
# software.
# The GitLab CI/CD pipeline configuration lives in this
# file.
image: "rust:latest"
# NOTE: Install some compilers and build tools if necessary.
# You may need this if your project depends on C code.
# before_script:
# - apt-get update
# - apt-get install -y build-essential
# These are the GitLab CI/CD pipeline stages we want to run.
stages:
# - test
# - docs
- debug-linux-x86_64
- debug-windows-x86_64
- release-linux-x86_64
- release-windows-x86_64
# Pipeline "test" stage - Use cargo to test the project, and kcov to generate a
# test coverage report.
# test:
# stage: test
# script:
# - ./update.sh # Clone all the git submodules.
# - apt-get update && apt-get install -y lsb-release bash binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev build-essential cmake libx11-dev libvulkan-dev libxcb1-dev xorg-dev
# - lsb_release -a
# - git clone https://github.com/SimonKagstrom/kcov.git
# - cd kcov && mkdir build && cd build && cmake .. && make -j2 && make install && cd ../..
# - rustc --version && cargo --version # Display rustc and cargo versions.
# - cd nov
# - RUSTFLAGS='-C link-dead-code' cargo test --workspace --verbose # Run the project's test suite with cargo. If any of these tests fail, we stop here.
# - for i in `ls -rt target/debug/deps/libnov-* | sed '/\./d' | tail -n 1`; do kcov --exclude-pattern=/usr target/cov $i; done # Generate the test coverage report with kcov for library.
# - for i in `find target/cov -maxdepth 1 -type l`; do unlink $i; done # Remove bad symlinks which are made by kcov for some reason.
# - "COVERAGE=$(grep -Po 'percent_covered\":\\s+\\\"\\d+.\\d+\\\"' target/cov/libnov*/coverage.json | grep -Po '\\d+.\\d+' | tail -n 1)"
# - echo "Coverage:" $COVERAGE # Output the amount of test coverage in percent. This exact output format is expected by a setting we set on the GitLab CI/CD website.
# - cd ..
# artifacts:
# expire_in: never # Keep this stage's output artifacts forever.
# paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
# - nov/target/cov
# # Pipeline "docs" stage - Use cargo to auto-generate the docs for this project.
# docs:
# stage: docs
# needs: [ # Wait for a previous stage to finish before running this stage.
# # "test",
# ]
# script:
# - ./update.sh # Clone all the git submodules.
# - apt-get update && apt-get install -y libx11-dev libvulkan-dev libxcb1-dev xorg-dev cmake # Install OS-specific dependencies.
# - rustc --version && cargo --version # Display rustc and cargo versions.
# - cd nob && cargo doc --workspace --verbose && cd .. # Generate the project's docs with the cargo doc command.
# - cd nov && cargo doc --workspace --verbose && cd ..
# artifacts:
# expire_in: never # Keep this stage's output artifacts forever.
# paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
# - nob/target/doc
# - nov/target/doc
# Pipeline "debug-linux-x86_64" stage - Use cargo to build the Linux x86_64 debug binary for this project.
debug-linux-x86_64:
stage: debug-linux-x86_64
timeout: 3h
needs: # Wait for a previous stage to finish before running this stage.
[]
# "test",
script:
- ./update.sh # Clone all the git submodules.
- apt-get update && apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev python-openssl libx11-dev libvulkan-dev libxcb1-dev xorg-dev cmake # Install OS-specific dependencies.
- unset PYENV_ROOT
- cd libnov && source ./install-python.sh && cd ..
- export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
- echo "PATH=\"$PATH\""
- python -V
- pyenv rehash
- python -V
- pyenv version
- pyenv which python
- echo $(pyenv which python)
- $(pyenv which python) -V
- export PYTHON_SYS_EXECUTABLE="$(pyenv which python)"
- export PYTHONPATH="$PWD/libnov/data/src:$PYTHONPATH"
- ls -al "$HOME/.pyenv/bin"
- ls -al "$HOME/.pyenv/shims"
- rustc --version && cargo --version # Display rustc and cargo versions.
- cd nob && RUST_BACKTRACE=full cargo build --verbose && cd .. # Build the project with the cargo build command.
- cd nov
- export LIBPYTHON_DIR="$(pyenv prefix)/lib"
- ls -al "$LIBPYTHON_DIR"
- cd ..
- cd nov && RUST_BACKTRACE=full cargo build --features vulkan,python --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-gl cargo build --features gl,python --verbose && cd ..
- mkdir -p hobnob
- cp -r libnov/data hobnob
- cp -r libnov/shader hobnob
- cp nob/target/debug/nob hobnob
- cp nov/target/debug/nov hobnob
- cp nov/target-gl/debug/nov hobnob/nov-gl
- chmod 755 hobnob/nob
- chmod 755 hobnob/nov
- chmod 755 hobnob/nov-gl
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nob\n" | tee hobnob/nob.sh
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nov\n" | tee hobnob/hobnob.sh
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nov-gl\n" | tee hobnob/hobnob-gl.sh
- chmod 755 hobnob/nob.sh
- chmod 755 hobnob/hobnob.sh
- chmod 755 hobnob/hobnob-gl.sh
artifacts:
name: hobnob-debug-linux-x86_64
# expire_in: never # Keep this stage's output artifacts forever.
paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
- hobnob
# Pipeline "debug-windows-x86_64" - Use cargo to build the cross-compiled Windows x86_64 debug binary for this project.
debug-windows-x86_64:
stage: debug-windows-x86_64
timeout: 3h
needs: # Wait for a previous stage to finish before running this stage.
[]
# "test",
script:
- ./update.sh # Clone all the git submodules.
- apt-get update && apt-get install -y --no-install-recommends make build-essential mingw-w64 libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev python-openssl libx11-dev libvulkan-dev libxcb1-dev xorg-dev cmake # Install OS-specific dependencies.
- unset PYENV_ROOT
- cd libnov && source ./install-python.sh && cd ..
- cd libnov && ./install-python-cross-win64.sh && cd ..
- export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
- echo "PATH=\"$PATH\""
- python -V
- pyenv rehash
- python -V
- pyenv version
- pyenv which python
- echo $(pyenv which python)
- $(pyenv which python) -V
- echo "Setting Python variables..."
- echo "PWD=$PWD"
- echo ""
- ls -al "$PWD"
- echo ""
- ls -al "$PWD/nov"
- echo ""
- ls -al "$PWD/nov/python-cross-win64"
- echo ""
- export PYO3_CROSS_INCLUDE_DIR="$(pyenv prefix)/include/python3.9"
- export PYO3_CROSS_LIB_DIR="$PWD/nov/python-cross-win64"
- export PYTHON_SYS_EXECUTABLE="$PWD/nov/python-cross-win64/python.exe"
- export PYTHONHOME="$PWD/nov/python-cross-win64/Python-3.9.1"
- cd $PWD/nov/python-cross-win64
- cp -r ../../libnov/data/src/* .
# - ln -sf ../../../libnov/data/src/nov
- cd ../..
- export PYTHONPATH="$PWD/nov/python-cross-win64"
- ls -al "$HOME/.pyenv/bin"
- ls -al "$HOME/.pyenv/shims"
- rustup target add x86_64-pc-windows-gnu # Add the mingw-w64 Rust target to cargo with the rustup command.
- rustup toolchain install stable-x86_64-pc-windows-gnu # Install the Rust Windows cross-compiling tools for cargo with the rustup command.
- rustc --version && cargo --version # Display rustc and cargo versions.
- cd nob && RUST_BACKTRACE=full cargo build --target x86_64-pc-windows-gnu --verbose && cd .. # Cross-compile the project for Windows, from Linux, with the cargo build command.
- cd nov
- cd ..
- cd nov && RUST_BACKTRACE=full cargo build --features vulkan,python --target x86_64-pc-windows-gnu --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-dx12 cargo build --features dx12,python --target x86_64-pc-windows-gnu --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-dx11 cargo build --features dx11,python --target x86_64-pc-windows-gnu --verbose && cd ..
- mkdir -p hobnob
- cp nov/target/x86_64-pc-windows-gnu/debug/nov.exe hobnob
- cp nob/target/x86_64-pc-windows-gnu/debug/nob.exe hobnob
- cp -r libnov/data hobnob
- cp -r libnov/shader hobnob
- cp -r nov/python-cross-win64 hobnob/python
# - mv hobnob/data/src/nov hobnob/python/Python-3.9.1/nov
- cp nov/target-dx12/x86_64-pc-windows-gnu/debug/nov.exe hobnob/nov-dx12.exe
- cp nov/target-dx11/x86_64-pc-windows-gnu/debug/nov.exe hobnob/nov-dx11.exe
- cp nov/target/x86_64-pc-windows-gnu/debug/python39.dll hobnob
- cp nov/target/x86_64-pc-windows-gnu/debug/python3.9.dll hobnob
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nob.exe\nendlocal\n" | tee hobnob/nob.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov.exe\nendlocal\n" | tee hobnob/hobnob.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov-dx12.exe\nendlocal\n" | tee hobnob/hobnob-dx12.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov-dx11.exe\nendlocal\n" | tee hobnob/hobnob-dx11.bat
artifacts:
name: hobnob-debug-windows-x86_64
# expire_in: never # Keep this stage's output artifacts forever.
paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
- hobnob
# Pipeline "release-linux-x86_64" stage - Use cargo to build the Linux x86_64 release binary for this project.
release-linux-x86_64:
stage: release-linux-x86_64
timeout: 3h
needs: # Wait for a previous stage to finish before running this stage.
[]
# "test",
script:
- ./update.sh # Clone all the git submodules.
- apt-get update && apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev python-openssl libx11-dev libvulkan-dev libxcb1-dev xorg-dev cmake # Install OS-specific dependencies.
- unset PYENV_ROOT
- cd libnov && source ./install-python.sh && cd ..
- export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
- echo "PATH=\"$PATH\""
- python -V
- pyenv rehash
- python -V
- pyenv version
- pyenv which python
- echo $(pyenv which python)
- $(pyenv which python) -V
- export PYTHON_SYS_EXECUTABLE="$(pyenv which python)"
- export PYTHONPATH="$PWD/libnov/data/src:$PYTHONPATH"
- ls -al "$HOME/.pyenv/bin"
- ls -al "$HOME/.pyenv/shims"
- rustc --version && cargo --version # Display rustc and cargo versions.
- cd nob && RUST_BACKTRACE=full cargo build --release --verbose && cd .. # Build the project with the cargo build command.
- cd nov
- export LIBPYTHON_DIR="$(pyenv prefix)/lib"
- ls -al "$LIBPYTHON_DIR"
- cd ..
- cd nov && RUST_BACKTRACE=full cargo build --release --features vulkan,python --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-gl cargo build --release --features gl,python --verbose && cd ..
- strip -s nob/target/release/nob
- strip -s nov/target/release/nov
- strip -s nov/target-gl/release/nov
- mkdir -p hobnob
- cp -r libnov/data hobnob
- cp -r libnov/shader hobnob
- cp nob/target/release/nob hobnob
- cp nov/target/release/nov hobnob
- cp nov/target-gl/release/nov hobnob/nov-gl
- chmod 755 hobnob/nob
- chmod 755 hobnob/nov
- chmod 755 hobnob/nov-gl
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nob\n" | tee hobnob/nob.sh
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nov\n" | tee hobnob/hobnob.sh
- printf "#!/bin/bash\n\nPYTHONPATH=\"\$PWD/data/src:\$PYTHONPATH\" ./nov-gl\n" | tee hobnob/hobnob-gl.sh
- chmod 755 hobnob/nob.sh
- chmod 755 hobnob/hobnob.sh
- chmod 755 hobnob/hobnob-gl.sh
artifacts:
name: hobnob-release-linux-x86_64
# expire_in: never # Keep this stage's output artifacts forever.
paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
- hobnob
# Pipeline "release-windows-x86_64" - Use cargo to build the cross-compiled Windows x86_64 release binary for this project.
release-windows-x86_64:
stage: release-windows-x86_64
timeout: 3h
needs: # Wait for a previous stage to finish before running this stage.
[]
# "test",
script:
- ./update.sh # Clone all the git submodules.
- apt-get update && apt-get install -y --no-install-recommends make build-essential mingw-w64 libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev python-openssl libx11-dev libvulkan-dev libxcb1-dev xorg-dev cmake # Install OS-specific dependencies.
- unset PYENV_ROOT
- cd libnov && source ./install-python.sh && cd ..
- cd libnov && ./install-python-cross-win64.sh && cd ..
- export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
- echo "PATH=\"$PATH\""
- python -V
- pyenv rehash
- python -V
- pyenv version
- pyenv which python
- echo $(pyenv which python)
- $(pyenv which python) -V
- echo "Setting Python variables..."
- echo "PWD=$PWD"
- echo ""
- ls -al "$PWD"
- echo ""
- ls -al "$PWD/nov"
- echo ""
- ls -al "$PWD/nov/python-cross-win64"
- echo ""
- export PYO3_CROSS_INCLUDE_DIR="$(pyenv prefix)/include/python3.9"
- export PYO3_CROSS_LIB_DIR="$PWD/nov/python-cross-win64"
- export PYTHON_SYS_EXECUTABLE="$PWD/nov/python-cross-win64/python.exe"
- export PYTHONHOME="$PWD/nov/python-cross-win64/Python-3.9.1"
- cd $PWD/nov/python-cross-win64
- cp -r ../../libnov/data/src/* .
# - ln -sf ../../../libnov/data/src/nov
- cd ../..
- export PYTHONPATH="$PWD/nov/python-cross-win64"
- ls -al "$HOME/.pyenv/bin"
- ls -al "$HOME/.pyenv/shims"
- rustup target add x86_64-pc-windows-gnu # Add the mingw-w64 Rust target to cargo with the rustup command.
- rustup toolchain install stable-x86_64-pc-windows-gnu # Install the Rust Windows cross-compiling tools for cargo with the rustup command.
- rustc --version && cargo --version # Display rustc and cargo versions.
- cd nob && RUST_BACKTRACE=full cargo build --release --target x86_64-pc-windows-gnu --verbose && cd .. # Cross-compile the project for Windows, from Linux, with the cargo build command.
- cd nov
- cd ..
- cd nov && RUST_BACKTRACE=full cargo build --release --features vulkan,python --target x86_64-pc-windows-gnu --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-dx12 cargo build --release --features dx12,python --target x86_64-pc-windows-gnu --verbose && cd ..
- cd nov && RUST_BACKTRACE=full CARGO_TARGET_DIR=target-dx11 cargo build --release --features dx11,python --target x86_64-pc-windows-gnu --verbose && cd ..
- strip -s nob/target/x86_64-pc-windows-gnu/release/nob.exe
- strip -s nov/target/x86_64-pc-windows-gnu/release/nov.exe
- strip -s nov/target-dx12/x86_64-pc-windows-gnu/release/nov.exe
- strip -s nov/target-dx11/x86_64-pc-windows-gnu/release/nov.exe
- mkdir -p hobnob
- cp -r libnov/data hobnob
- cp -r libnov/shader hobnob
- cp -r nov/python-cross-win64 hobnob/python
# - mv hobnob/data/src/nov hobnob/python/Python-3.9.1/nov
- cp nob/target/x86_64-pc-windows-gnu/release/nob.exe hobnob
- cp nov/target/x86_64-pc-windows-gnu/release/nov.exe hobnob
- cp nov/target-dx12/x86_64-pc-windows-gnu/release/nov.exe hobnob/nov-dx12.exe
- cp nov/target-dx11/x86_64-pc-windows-gnu/release/nov.exe hobnob/nov-dx11.exe
- cp nov/target/x86_64-pc-windows-gnu/release/python39.dll hobnob
- cp nov/target/x86_64-pc-windows-gnu/release/python3.9.dll hobnob
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nob.exe\nendlocal\n" | tee hobnob/nob.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov.exe\nendlocal\n" | tee hobnob/hobnob.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov-dx12.exe\nendlocal\n" | tee hobnob/hobnob-dx12.bat
- printf "@echo off\nsetlocal\nset PYTHONPATH=%%cd%%\\python&& set PYTHONHOME=%%cd%%\\python\\Python-3.9.1&& nov-dx11.exe\nendlocal\n" | tee hobnob/hobnob-dx11.bat
artifacts:
name: hobnob-release-windows-x86_64
# expire_in: never # Keep this stage's output artifacts forever.
paths: # The files found at these paths will be added to the artifacts archive for this pipeline stage.
- hobnob