Debian Codegraph @

android/app/jni/.github/workflows/build.yml

raw
1 name: Build furnace
2
3 on:
4 push:
5 branches: [master, 0.6-fixes-real]
6 pull_request:
7 branches: master
8
9 defaults:
10 run:
11 shell: bash
12
13 env:
14 BUILD_TYPE: Debug
15
16 jobs:
17 build:
18 strategy:
19 matrix:
20 config:
21 - { name: 'Windows MSVC x86', os: windows-latest, compiler: msvc, arch: x86 }
22 - { name: 'Windows MSVC x86_64', os: windows-latest, compiler: msvc, arch: x86_64 }
23 #- { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 }
24 #- { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 }
25 - { name: 'macOS x86_64', os: macos-13, arch: x86_64 }
26 - { name: 'macOS ARM', os: macos-latest, arch: arm64 }
27 - { name: 'Linux x86_64', os: ubuntu-22.04, arch: x86_64 }
28 #- { name: 'Linux ARM', os: ubuntu-18.04, arch: armhf }
29 fail-fast: true
30
31 name: ${{ matrix.config.name }}
32 runs-on: ${{ matrix.config.os }}
33
34 steps:
35 - name: Checkout
36 uses: actions/[email protected]
37 with:
38 submodules: recursive
39
40 - name: Set Windows arch identifiers
41 id: windows-identify
42 if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }}
43 run: |
44 vswhere_target="${{ matrix.config.arch }}"
45 msvc_target="${{ matrix.config.arch }}"
46 mingw_target="${{ matrix.config.arch }}"
47
48 if [ '${{ matrix.config.arch }}' == 'x86' ]; then
49 msvc_target="Win32"
50 elif [ '${{ matrix.config.arch }}' == 'x86_64' ]; then
51 vswhere_target="amd64"
52 msvc_target="x64"
53 fi
54
55 if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
56 echo "vswhere target: ${vswhere_target}"
57 echo "MSVC target: ${msvc_target}"
58 else
59 echo "MinGW cross target: ${mingw_target}"
60 fi
61
62 echo "vswhere-target=${vswhere_target}" >> $GITHUB_OUTPUT
63 echo "msvc-target=${msvc_target}" >> $GITHUB_OUTPUT
64 echo "mingw-target=${mingw_target}" >> $GITHUB_OUTPUT
65
66 - name: Set package identifier
67 id: package-identify
68 run: |
69 package_name="furnace-${GITHUB_SHA}"
70 package_ext=""
71 if [ '${{ runner.os }}' == 'Windows' ] || [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
72 package_name="${package_name}-Windows"
73 if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
74 package_name="${package_name}-MinGW"
75 else
76 package_name="${package_name}-MSVC"
77 fi
78 package_name="${package_name}-${{ matrix.config.arch }}"
79 package_ext="" # Directory, uploading will automatically zip it
80 elif [ '${{ runner.os }}' == 'macOS' ]; then
81 package_name="${package_name}-macOS-${{ matrix.config.arch }}"
82 package_ext=".dmg"
83 else
84 package_name="${package_name}-Linux-${{ matrix.config.arch }}"
85 package_ext=".tar.gz"
86 fi
87
88 echo "Package identifier: ${package_name}"
89 echo "Package file: ${package_name}${package_ext}"
90
91 echo "id=${package_name}" >> $GITHUB_OUTPUT
92 echo "filename=${package_name}${package_ext}" >> $GITHUB_OUTPUT
93
94 - name: Set build cores amount
95 id: build-cores
96 run: |
97 # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
98 amount=2
99 if [ '${{ runner.os }}' == 'macOS' ]; then
100 amount=3
101 fi
102
103 echo "Amount of cores we can build with: ${amount}"
104
105 echo "amount=${amount}" >> $GITHUB_OUTPUT
106
107 - name: Setup Toolchain [Windows MSVC]
108 if: ${{ matrix.config.compiler == 'msvc' }}
109 uses: lunathir/gha-setup-vsdevenv@avoid-deprecation-warnings
110 with:
111 arch: ${{ steps.windows-identify.outputs.vswhere-target }}
112
113 - name: Setup Toolchain [Windows MinGW]
114 if: ${{ matrix.config.compiler == 'mingw' }}
115 run: |
116 sudo apt update
117 sudo apt install \
118 mingw-w64 \
119 mingw-w64-tools
120
121 - name: Install Dependencies [Linux x86_64]
122 if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' && matrix.config.arch == 'x86_64' }}
123 run: |
124 sudo apt update
125 sudo apt install \
126 libsdl2-dev \
127 libfmt-dev \
128 librtmidi-dev \
129 libsndfile1-dev \
130 zlib1g-dev \
131 libjack-jackd2-dev \
132 gettext
133
134 - name: Install Dependencies [Linux armhf]
135 if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' && matrix.config.arch == 'armhf' }}
136 run: |
137 sudo sed -ri "s/^deb /deb [arch=amd64] /" /etc/apt/sources.list
138 echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main universe" | sudo tee -a /etc/apt/sources.list
139 echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main universe" | sudo tee -a /etc/apt/sources.list
140 sudo dpkg --add-architecture armhf
141 sudo apt update
142 sudo apt install \
143 crossbuild-essential-armhf \
144 appstream \
145 gettext
146 sudo apt install \
147 libsdl2-dev:armhf \
148 libfmt-dev:armhf \
149 librtmidi-dev:armhf \
150 libsndfile1-dev:armhf \
151 zlib1g-dev:armhf \
152 libjack-jackd2-dev:armhf
153 ls /usr/arm-linux-gnueabihf/lib
154
155 - name: Build Language Files
156 if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }}
157 run: |
158 ./scripts/build-po.sh
159
160 - name: Configure
161 run: |
162 export USE_WAE=ON
163 export CMAKE_EXTRA_ARGS=()
164 if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
165 CMAKE_EXTRA_ARGS+=('-DCMAKE_GENERATOR_PLATFORM=${{ steps.windows-identify.outputs.msvc-target }}')
166
167 # Force static linking
168 # 1. Make MSVC runtime configurable
169 CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW')
170 # 2. Use static (debug) runtime
171 if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then
172 CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug')
173 else
174 CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded')
175 fi
176 elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
177 CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-${{ steps.windows-identify.outputs.mingw-target }}.cmake')
178 if [ '${{ matrix.config.arch }}' == 'x86' ]; then
179 CMAKE_EXTRA_ARGS+=('-DSUPPORT_XP=ON')
180 fi
181 elif [ '${{ runner.os }}' == 'macOS' ]; then
182 if [ '${{ matrix.config.arch }}' == 'arm64' ]; then
183 CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0"' '-DCMAKE_OSX_ARCHITECTURES=arm64' '-DMAKE_BUNDLE=ON')
184 else
185 CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"' '-DCMAKE_OSX_ARCHITECTURES=x86_64' '-DMAKE_BUNDLE=ON' '-DCMAKE_C_FLAGS=-march=core2' '-DCMAKE_CXX_FLAGS=-march=core2')
186 fi
187 elif [ '${{ runner.os }}' == 'Linux' ] && [ '${{ matrix.config.arch }}' == 'armhf' ]; then
188 CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-Linux-armhf.cmake')
189 fi
190
191 cmake \
192 -B ${PWD}/build \
193 -DCMAKE_INSTALL_PREFIX=/usr \
194 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
195 -DWARNINGS_ARE_ERRORS=${USE_WAE} \
196 -DWITH_DEMOS=OFF -DWITH_INSTRUMENTS=OFF -DWITH_WAVETABLES=OFF \
197 "${CMAKE_EXTRA_ARGS[@]}"
198
199 - name: Build
200 run: |
201 cmake \
202 --build ${PWD}/build \
203 --config ${{ env.BUILD_TYPE }} \
204 --parallel ${{ steps.build-cores.outputs.amount }}
205
206 - name: Package [Windows]
207 if: ${{ runner.os == 'Windows' || matrix.config.compiler == 'mingw' }}
208 run: |
209 binPath=build
210 if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
211 binPath="${binPath}/${{ env.BUILD_TYPE }}"
212 fi
213 # always strip on MinGW as it generate massive artifacts
214 #if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
215 # # arch-specific strip prefix
216 # # TODO maybe extract from cross toolchain files?
217 # toolPrefix="-w64-mingw32-"
218 # if [ '${{ matrix.config.arch }}' == 'x86_64' ]; then
219 # toolPrefix="x86_64${toolPrefix}"
220 # else
221 # toolPrefix="i686${toolPrefix}"
222 # fi
223 # ${toolPrefix}strip -s "${binPath}/furnace.exe"
224 #fi
225
226 mkdir ${{ steps.package-identify.outputs.filename }}
227 pushd ${{ steps.package-identify.outputs.filename }}
228
229 cp -v ../LICENSE LICENSE.txt
230 cp -v ../res/releaseReadme/unstable-win.txt README.txt
231 cp -vr ../po/locale locale
232 cp -vr ../papers ../${binPath}/furnace.exe ./
233 if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
234 if [ -e ../${binPath}/furnace.pdb ]; then
235 cp -v ../${binPath}/furnace.pdb ./
236 fi
237 fi
238 sha256sum ../${binPath}/furnace.exe > checksum.txt
239
240 popd
241
242 - name: Package [macOS]
243 if: ${{ runner.os == 'macOS' }}
244 run: |
245 pushd build
246
247 echo "preparing bundle"
248 mkdir -p Furnace.app/Contents/Resources
249 cp -v -r ../po/locale Furnace.app/Contents/Resources/locale
250 cp -v ../res/icon.icns Furnace.app/Contents/Resources/Furnace.icns
251
252 codesign --deep -f -s - Furnace.app
253
254 echo "making dirs"
255 mkdir new
256
257 echo "copying"
258 cp -v -r Furnace.app new/Furnace.app
259 ln -s /Applications new/Applications
260 echo "synchronizing"
261 sync
262
263 echo "copying extra stuff"
264 cp -v ../LICENSE new/LICENSE.txt
265 cp -v ../res/releaseReadme/stable-mac.txt new/README
266 cp -v -r ../demos new/demos
267 cp -v -r ../instruments new/instruments
268 cp -v -r ../wavetables new/wavetables
269 cd new
270 wget https://tildearrow.org/furnace/doc/latest/manual.pdf
271 cd ..
272
273 echo "creating new image"
274 retries=0
275 while ! hdiutil create -srcfolder new -volname Furnace -format UDZO -fs HFS+ furnace.dmg; do
276 echo "TRYING AGAIN..."
277 retries=$((retries+1))
278 if [ $retries -gt 5 ]; then
279 echo "OH NO, WE'VE FAILED..."
280 exit 1
281 break
282 fi
283 sleep 5
284 done
285
286 mv furnace.dmg ../${{ steps.package-identify.outputs.filename }}
287 popd
288
289 - name: Package [Linux]
290 if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }}
291 run: |
292 #if [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then
293 # strip -s build/furnace
294 #fi
295
296 mkdir -p target/furnace
297 make -C ${PWD}/build DESTDIR=${PWD}/target/furnace install
298 pushd target/furnace
299
300 cp -v ../../res/logo.png .DirIcon
301
302 cd usr
303
304 mv bin/furnace ..
305 rmdir bin
306
307 rm -r share/applications
308 rm -r share/doc
309 rm -r share/icons
310 rm -r share/licenses
311 rm -r share/metainfo
312 rm -r share/mime
313 mv share/locale ..
314
315 rmdir share
316
317 cd ..
318
319 cp ../../LICENSE .
320 cp ../../res/releaseReadme/unstable-other.txt .
321 cp -r ../../papers papers
322 rmdir usr
323
324 popd
325
326 cd target
327
328 tar -zcv -f ../${{ steps.package-identify.outputs.filename }} furnace
329
330 - name: Upload artifact
331 if: ${{ github.repository == 'tildearrow/furnace' && github.ref_name == 'master' }}
332 uses: actions/[email protected]
333 with:
334 name: ${{ steps.package-identify.outputs.id }}
335 path: ${{ steps.package-identify.outputs.filename }}
336
337 - name: Upload 30xx artifact
338 if: ${{ github.repository == 'tildearrow/furnace' && github.ref_name == 'theUltimateFix' }}
339 uses: actions/[email protected]
340 with:
341 name: ${{ steps.package-identify.outputs.id }}
342 path: ${{ steps.package-identify.outputs.filename }}