-
Notifications
You must be signed in to change notification settings - Fork 1
283 lines (278 loc) · 10 KB
/
libpupdmd.yml
File metadata and controls
283 lines (278 loc) · 10 KB
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
name: libpupdmd
on:
push:
pull_request:
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
version:
name: Detect version
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- id: version
run: |
VERSION_MAJOR=$(grep -Eo "PUPDMD_VERSION_MAJOR\s+[0-9]+" src/pupdmd.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "PUPDMD_VERSION_MINOR\s+[0-9]+" src/pupdmd.h | grep -Eo "[0-9]+")
VERSION_PATCH=$(grep -Eo "PUPDMD_VERSION_PATCH\s+[0-9]+" src/pupdmd.h | grep -Eo "[0-9]+")
TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
echo "${TAG}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
name: Build libpupdmd-${{ matrix.platform }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
needs: [ version ]
strategy:
fail-fast: false
matrix:
include:
- { os: windows-2025, platform: win, arch: x64 }
- { os: windows-2025, platform: win, arch: x86 }
- { os: windows-2025, platform: win-mingw, arch: x64 }
- { os: macos-15, platform: macos, arch: arm64 }
- { os: macos-15, platform: macos, arch: x64 }
- { os: ubuntu-24.04, platform: linux, arch: x64 }
- { os: ubuntu-24.04-arm, platform: linux, arch: aarch64 }
- { os: ubuntu-24.04, platform: android, arch: arm64-v8a }
- { os: macos-15, platform: ios, arch: arm64 }
- { os: macos-15, platform: ios-simulator, arch: arm64 }
- { os: macos-15, platform: tvos, arch: arm64 }
steps:
- uses: actions/checkout@v6
#
# install dependencies
#
- if: (matrix.platform == 'win')
uses: microsoft/setup-msbuild@v2
- if: (matrix.platform == 'win-mingw')
run: |
/c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-cmake"
#
# build (win)
#
- if: (matrix.platform == 'win')
name: Build (win)
run: |
if [[ "${{ matrix.arch }}" == "x64" ]]; then
cmake \
-G "Visual Studio 17 2022" \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
else
cmake \
-G "Visual Studio 17 2022" \
-A Win32 \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
fi
cmake --build build --config Release
#
# build (win-mingw)
#
- if: (matrix.platform == 'win-mingw')
name: Build (win-mingw)
run: |
CURRENT_DIR="$(pwd)"
MSYSTEM=UCRT64 /c/msys64/usr/bin/bash.exe -l -c "
cd \"${CURRENT_DIR}\" &&
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build &&
cmake --build build -- -j\$(nproc)
"
#
# build (macos)
#
- if: (matrix.platform == 'macos')
name: Build (macos)
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
cmake --build build -- -j$(sysctl -n hw.ncpu)
#
# build (linux)
#
- if: (matrix.platform == 'linux')
name: Build (linux)
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
cmake --build build -- -j$(nproc)
#
# build (ios/tvos)
#
- if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos')
name: Build (ios/tvos)
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
cmake --build build -- -j$(sysctl -n hw.ncpu)
#
# build (android)
#
- if: (matrix.platform == 'android')
name: Build (android)
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM=${{ matrix.platform }} \
-DARCH=${{ matrix.arch }} \
-B build
cmake --build build -- -j$(nproc)
#
# test
#
- if: (!(matrix.arch == 'arm64' || matrix.arch == 'arm64-v8a' || matrix.arch == 'aarch64' || matrix.platform == 'win' || matrix.platform == 'win-mingw'))
name: pupdmd_test
run: build/pupdmd_test
#
# prepare artifacts
#
- if: (matrix.platform == 'win')
name: Prepare artifacts (win)
run: |
mkdir tmp
cp build/Release/*.lib tmp/
cp build/Release/*.dll tmp/
cp build/Release/*.exe tmp/
cp -r test tmp/
cd tmp && 7z a -r ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip *
- if: (matrix.platform == 'win-mingw')
name: Prepare artifacts (win-mingw)
run: |
mkdir tmp
cp build/*.dll tmp/
cp build/*.dll.a tmp/
cp build/pupdmd_static.a tmp/
cp build/*.exe tmp/
cp -r test tmp/
UCRT64_BIN="/c/msys64/ucrt64/bin"
cp "${UCRT64_BIN}/libgcc_s_seh-1.dll" tmp/
cp "${UCRT64_BIN}/libstdc++-6.dll" tmp/
cd tmp && 7z a -r ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip *
- if: (matrix.platform == 'macos')
name: Prepare artifacts (macos)
run: |
mkdir tmp
cp build/libpupdmd.a tmp/
cp -a build/*.dylib tmp/
cp build/pupdmd_test_s tmp/
cp build/pupdmd_test tmp/
cp -r test tmp/
cd tmp && tar -czvf ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz *
- if: (matrix.platform == 'linux')
name: Prepare artifacts (linux)
run: |
mkdir tmp
cp build/libpupdmd.a tmp/
cp -a build/*.so tmp/
cp -a build/*.so.* tmp/
cp build/pupdmd_test_s tmp/
cp build/pupdmd_test tmp/
cp -r test tmp/
cd tmp && tar -czvf ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz *
- if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos')
name: Prepare artifacts (ios/tvos)
run: |
mkdir tmp
cp build/libpupdmd.a tmp/
cp -a build/*.dylib tmp/
cd tmp && tar -czvf ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz *
- if: (matrix.platform == 'android')
name: Prepare artifacts (android)
run: |
mkdir tmp
cp build/libpupdmd.a tmp/
cp build/libpupdmd.so tmp/
cd tmp && tar -czvf ../libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz *
#
# upload artifacts
#
- if: (matrix.platform == 'win' || matrix.platform == 'win-mingw')
uses: actions/upload-artifact@v7
with:
name: libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
path: libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
archive: false
- if: (matrix.platform != 'win' && matrix.platform != 'win-mingw')
uses: actions/upload-artifact@v7
with:
name: libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
path: libpupdmd-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
archive: false
post-build:
runs-on: macos-15
needs: [ version, build ]
name: Build libpupdmd-macos
steps:
- uses: actions/download-artifact@v8
with:
name: libpupdmd-${{ needs.version.outputs.tag }}-macos-x64.tar.gz
skip-decompress: true
- uses: actions/download-artifact@v8
with:
name: libpupdmd-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz
skip-decompress: true
- name: Combine macos architectures
run: |
mkdir macos-x64 macos-arm64
tar -xzvf libpupdmd-${{ needs.version.outputs.tag }}-macos-x64.tar.gz -C macos-x64
tar -xzvf libpupdmd-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz -C macos-arm64
mkdir tmp
find macos-arm64 -name "*.dylib" | while read -r file; do
if [ -L "$file" ]; then
cp -a "$file" "tmp/"
elif [ -f "$file" ]; then
filename=$(basename "$file")
lipo -create -output "tmp/$filename" \
"macos-arm64/$filename" \
"macos-x64/$filename"
fi
done
lipo -create -output tmp/pupdmd_test \
macos-arm64/pupdmd_test \
macos-x64/pupdmd_test
lipo -create -output tmp/pupdmd_test_s \
macos-arm64/pupdmd_test_s \
macos-x64/pupdmd_test_s
cp -r macos-arm64/test tmp
cd tmp && tar -czvf ../libpupdmd-${{ needs.version.outputs.tag }}-macos.tar.gz * && cd ..
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: libpupdmd-${{ needs.version.outputs.tag }}-macos.tar.gz
path: libpupdmd-${{ needs.version.outputs.tag }}-macos.tar.gz
archive: false
- if: startsWith(github.ref, 'refs/tags/')
uses: actions/download-artifact@v8
with:
path: release
skip-decompress: true
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: release/**/*