forked from hydrogen-music/hydrogen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.appveyor.yml
388 lines (312 loc) · 13.9 KB
/
.appveyor.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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# Appveyor configuration
#
# Cache usage
# -----------
#
# The Appveyor build cache is used for:
#
# - ccache on Linux and Windows
# - Howebrew with build prerequisites on macOS
# - State of /usr with installed prerequisites on Linux
#
# The build cache limit is 1Gb which must be shared amongst all platforms,
# so we must take care about sizes, so we allocate:
#
# Homebrew 256Mb (currently uses about 130Mb)
# Linux /var 256Mb (currently uses about 170Mb)
# Linux ccache 256Mb
# Windows64 ccache 256Mb
#
# 32-bit Windows is not cached since it's not regularly built.
#
# Caching the macOS Homebrew configuration is the single largest
# impact on Appveyor build times, since Howebrew on the Appveyor images
# is very out of date, and some prerequisites require rebuilding.
#
# Since the Homebrew installation is much larger than the
# size of cache that Appveyor allows (1GB per project, shared
# between all configurations), so we cache only objects that
# are new or modified relative to the pre-existing 'clean' VM
# state, using `treestate.py` to compare.
#
# For most build jobs, we just unpack the cached Homebrew on top
# of the existing Homebrew installation.
#
# If the cache is cleaned or out of date, we first record the
# state of the Homebrew installation, then update it and install
# prerequisites, and build a new archive of the current Homebrew
# installation.
#
# Currently the necessary changes, compressed with xz, occupy
# about 170Mb of cache space.
#
environment:
GENERATOR: "MinGW Makefiles"
UPLOAD_ARTIFACTS: false
TARGET_VERSION: '1.2.1'
matrix:
- job_name: 'Ubuntu 20.04'
job_group: 'Linux'
appveyor_build_worker_image: Ubuntu2004
- job_name: 'OS X'
job_group: 'Mac OS X'
appveyor_build_worker_image: macos
- job_name: 'Windows64'
job_group: 'Windows'
MSYS: 'C:\msys64\mingw64'
MSYS_REPO: 'mingw64/mingw-w64-x86_64'
BUILD_TYPE: "Release"
CMAKE_FLAGS: "-DWANT_DEBUG:BOOL=OFF -DWIN64:BOOL=ON"
appveyor_build_worker_image: Visual Studio 2019
LIBSSL: libssl-3-x64.dll
LIBCRYPTO: libcrypto-3-x64.dll
- job_name: 'Windows32'
job_group: 'Windows'
MSYS: 'C:\msys64\mingw32'
MSYS_REPO: 'mingw32/mingw-w64-i686'
BUILD_TYPE: "Release"
CMAKE_FLAGS: "-DWANT_DEBUG:BOOL=OFF -DWIN64:BOOL=OFF"
appveyor_build_worker_image: Visual Studio 2019
LIBSSL: libssl-3.dll
LIBCRYPTO: libcrypto-3.dll
build:
verbosity: detailed
# Upload artifacts in case either the branch is named *-artifacts or
# HEAD is located on a tag (affects both Linux and Mac OS jobs).
init:
- sh: |-
if [[ "$APPVEYOR_REPO_TAG_NAME" || "$APPVEYOR_REPO_BRANCH" == *"-artifacts" ]]; then
UPLOAD_ARTIFACTS=true
fi
for:
-
matrix:
only:
- job_group: 'Linux'
cache: $HOME/cache_dir
before_build: |-
cache_tag=usr_cache # this can be modified to rebuild deps
cdir=$HOME/cache_dir
cache_tar=$cdir/$cache_tag.tar
cache=$cache_tar.xz
mkdir -p $cdir/ccache
ln -s $cdir/ccache $HOME/.ccache
if [ -d $cdir ] && [ -f $cache ]; then
echo "=== Unpacking cached /var $cache ==="
(
cd /
sudo tar xf $cache
)
echo "done"
else
echo "=== Building dependencies ==="
mkdir -p $cdir
sudo python3 ./treestate.py scan /usr usr.json
sudo apt-get update
sudo apt-get install -y clang qt5-default qttools5-dev qttools5-dev-tools libqt5xmlpatterns5-dev libarchive-dev libsndfile1-dev libasound2-dev libjack-jackd2-dev libqt5svg5-dev
sudo apt-get install -y liblo-dev libpulse-dev libportmidi-dev portaudio19-dev libcppunit-dev liblrdf-dev librubberband-dev ladspa-sdk ccache
sudo rm /usr/local/bi/doxygen
ccache -M 256M
ccache -s
(
sudo python3 ./treestate.py updates usr.json /usr > updates
echo $(wc -l updates) updates
sudo tar cf $cache_tar -T updates
sudo nice xz -9 -T0 $cache_tar
du -h $cache
) 2>&1 | sed 's/^/CACHE: /' &
fi
build_script: |-
git submodule init && git submodule update
CPUS=$(nproc)
echo "Building with $CPUS cpus"
mkdir build && cd build && \
cmake -DWANT_LASH=1 -DWANT_LRDF=1 -DWANT_RUBBERBAND=1 .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
&& \
make -j $CPUS
ccache -s
wait
echo "=== Build cache usage is " $( du -h $cdir | tail -1 ) "==="
test_script: |-
TMPDIR=/tmp src/tests/tests --appveyor --output-file=testOutput.log
res=$?;
if [ "$res" != "0" ]; then
# The tests failed. Upload all output to ease debugging.
appveyor PushArtifact testOutput.log
fi
( exit $res )
-
cache: /Users/appveyor/cache_dir
matrix:
only:
- job_group: 'Mac OS X'
before_build: |-
###############################################################
# Set up macOS dependencies
export MACOSX_DEPLOYMENT_TARGET=10.12
sudo ln -s /usr/local /opt/local;
cache_tag=usr_local_1 # this can be modified to rebuild deps
cdir=$HOME/cache_dir
cache_tar=$cdir/$cache_tag.tar
cache=$cache_tar.xz
CPUS=$(sysctl -n hw.ncpu)
if [ -d $cdir ] && [ -f $cache ]; then
echo "=== Unpacking cached Homebrew $cache ==="
(
cd /
tar xf $cache
)
echo "done"
else
echo "=== Building dependencies ==="
echo "Couldn't find cache $cache"
ls -alrt "$cdir"
echo "Recording /usr/local state"
python3 ./treestate.py scan /usr/local usrlocal.json
brew update
# Build our own versions of these for macOS 10.12 target systems.
brew install --build-from-source ./macos/HomebrewFormulae/berkeley-db.rb
brew install --build-from-source ./macos/HomebrewFormulae/libogg.rb
brew install --build-from-source ./macos/HomebrewFormulae/libvorbis.rb
brew install --build-from-source ./macos/HomebrewFormulae/libsndfile.rb
brew install qt5 libarchive jack pulseaudio cppunit ruby
# The build environment is now ready for use. We can complete
# the rest of the process of creating the Homebrew archive
# during the rest of the build, using idle CPU time. To minimise
# the amount of space needed for the archive, we compress with
# xz, which adds only about a minute to the non-cached build.
(
echo "=== Creating cache tarball $cache ==="
echo "Check /usr/local for updates"
python3 ./treestate.py updates usrlocal.json /usr/local \
| fgrep -v .git \
> updated_list
echo Need to record $( wc -l updated_list ) updates
mkdir -p $cdir
rm -f $cdir/*
nice tar cf $cache_tar -T updated_list
echo nice xz -9 -T$CPUS $cache_tar
nice xz -9 -T$CPUS $cache_tar
du -h $cdir
) 2>&1 | sed 's/^/CACHE: /' &
fi
export CMAKE_PREFIX_PATH="$(brew --prefix qt5)";
export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig";
build_script: |-
# fix use of register keyword in jack: https://github.com/jackaudio/jack1/issues/84
sed -i '' 's/, int register,/, int,/g' /opt/local/include/jack/types.h
git submodule init && git submodule update
# Do the build
(
mkdir build && \
cd build && \
cmake -DWANT_LASH=1 -DWANT_LRDF=1 -DWANT_RUBBERBAND=1 .. && \
make -j $CPUS
) || exit 1
# Build installation DMG
(
cd build
PATH="$(brew --prefix qt5)/bin:$PATH"
../macos/build_dmg.sh -v src/gui/hydrogen.app Hydrogen${PKG_SUFFIX}.dmg
if [ "$UPLOAD_ARTIFACTS" == "true" ]; then
appveyor PushArtifact Hydrogen*.dmg -DeploymentName Installer;
fi
) || exit 1
test_script: |-
cd build
TMPDIR=/tmp src/tests/tests --appveyor --output-file=testOutput.log
res=$?
wait
if [ "$res" != "0" ]; then
# The tests failed. Upload all output to ease debugging.
appveyor PushArtifact testOutput.log
fi
echo "=== Build cache usage is " $( du -h $cdir | tail -1 ) "==="
( exit $res )
-
matrix:
only:
- job_group: 'Windows'
cache: '%USERPROFILE%\AppData\Roaming\ccache'
before_build:
cmd: |-
REM *** Upload artifacts in case either the branch is named ***
REM *** *-artifacts or HEAD is located on a tag. ***
if defined APPVEYOR_REPO_TAG_NAME (set UPLOAD_ARTIFACTS="true") else (echo No tag name defined)
if not "%APPVEYOR_REPO_BRANCH%"=="%APPVEYOR_REPO_BRANCH:-artifacts=%" set UPLOAD_ARTIFACTS="true"
if not %UPLOAD_ARTIFACTS%=="true" if %job_name%==Windows32 appveyor exit
set QTDIR=%MSYS%
set CMAKE_PREFIX_PATH=%QTDIR%
set PATH=%MSYS%\bin;%PATH%
set PKG_CONFIG_PATH=%MSYS%\lib\pkgconfig
cmake --version
g++ --version
REM *** Install dependencies ***
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-libarchive
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-libsndfile
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-cppunit
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-portaudio
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-portmidi
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-libwinpthread-git
REM *** As of 2022-20-09 the package database refresh (-y) is required to get the newest qt package and to avoid a critical bug in less recent ones. In addition, the refresh _must_ take place _after_ installing libwinpthread (which otherwise fails). ***
c:\msys64\usr\bin\pacman --noconfirm -S -q -y %MSYS_REPO%-qt5
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-ladspa-sdk
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-ccache
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-jack2
c:\msys64\usr\bin\pacman --noconfirm -S -q %MSYS_REPO%-liblo
c:\msys64\usr\bin\pacman --noconfirm -U https://repo.msys2.org/mingw/%MSYS_REPO%-qt5-tools-5.15.9-1-any.pkg.tar.zst
ccache -M 256M
ccache -s
REM *** INIT SUBMODULES ***
git submodule init
git submodule update
REM *** Configure build ***
rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
mkdir build
cd build
cmake -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% %CMAKE_FLAGS% -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ..
build_script:
- cmd: |-
if not %UPLOAD_ARTIFACTS%=="true" if %job_name%==Windows32 exit
REM *** Build ***
set VERBOSE=1
cmake --build . -j %NUMBER_OF_PROCESSORS%
REM *** Run tests and report results ***
set H2_HOME=%APPVEYOR_BUILD_FOLDER%
echo %H2_HOME%
SET CORE_PATH=%cd%\src\core
echo %CORE_PATH%
set PATH=%CORE_PATH%;%PATH%
src\tests\tests.exe --appveyor --output-file=testOutput.log
REM *** In case the test passed, we delete its output. If it fails, the
REM script won't reach this point and the output will be uploaded later on ***
IF %ERRORLEVEL% EQU 0 (del testOutput.log)
7z a %APPVEYOR_BUILD_FOLDER%\testresults.zip %TEMP%\hydrogen || cmd /c "exit /b 1"
if %UPLOAD_ARTIFACTS%=="true" appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\testresults.zip
mkdir %APPVEYOR_BUILD_FOLDER%\build\windows\extralibs
REM *** Deploy Qt ***
%QTDIR%\bin\windeployqt.exe -xmlpatterns --no-patchqt --dir %APPVEYOR_BUILD_FOLDER%\build\windows\extralibs src/gui/hydrogen.exe
REM *** Deploy other libraries ***
set PYTHON=C:\Python38\python
%PYTHON% -m pip install -r %APPVEYOR_BUILD_FOLDER%\windows\ci\requirements.txt
%PYTHON% %APPVEYOR_BUILD_FOLDER%\windows\ci\copy_thirdparty_dlls.py --no-overwrite -V info -L %MSYS%\bin -d %APPVEYOR_BUILD_FOLDER%\build\windows\extralibs src/gui/hydrogen.exe src/core/libhydrogen-core-%TARGET_VERSION%.dll
REM *** libcrypto and libssl are not picked up by the Python script above and needs to be copied manually ***
copy %MSYS%\bin\%LIBSSL% %APPVEYOR_BUILD_FOLDER%\build\windows\extralibs
copy %MSYS%\bin\%LIBCRYPTO% %APPVEYOR_BUILD_FOLDER%\build\windows\extralibs
REM *** Build installer ***
cpack -G NSIS -v
REM *** Run and verify installer ***
set INSTDIR=C:\hydrogen
mkdir %INSTDIR%
FOR %%F IN (Hydrogen-*.exe) DO %%F /S /D=%INSTDIR%
%PYTHON% -m pytest %APPVEYOR_BUILD_FOLDER%\windows\ci\test_installation.py --junitxml=test_installation.xml
ccache -s
on_finish:
- cmd: if %UPLOAD_ARTIFACTS%=="true" appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build\CMakeCache.txt
- cmd: if %UPLOAD_ARTIFACTS%=="true" appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build\CMakeFiles\CMakeConfigureLog.yaml
- cmd: if EXIST %APPVEYOR_BUILD_FOLDER%\build\testOutput.log appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build\testOutput.log
- cmd: if %UPLOAD_ARTIFACTS%=="true" if not %job_name%==Windows32 appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build\Hydrogen-%TARGET_VERSION%-win64.exe || cmd /c "exit /b 1"
- cmd: if %UPLOAD_ARTIFACTS%=="true" if %job_name%==Windows32 appveyor PushArtifact %APPVEYOR_BUILD_FOLDER%\build\Hydrogen-%TARGET_VERSION%-win32.exe || cmd /c "exit /b 1"
- cmd: |
if %UPLOAD_ARTIFACTS%=="true" curl -F file=@%APPVEYOR_BUILD_FOLDER%\build\test_installation.xml https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%