-
Notifications
You must be signed in to change notification settings - Fork 0
341 lines (292 loc) · 11.5 KB
/
Copy pathbuild.yml
File metadata and controls
341 lines (292 loc) · 11.5 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
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
name: Build
on:
push:
paths-ignore:
- 'README.md'
branches: [ "main" ]
pull_request:
paths-ignore:
- 'README.md'
branches: [ "main" ]
workflow_dispatch:
jobs:
license:
name: Generate License
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache LICENSE.md
id: cache-license
uses: actions/cache@v4
with:
path: LICENSE.md
key: license-${{ hashFiles('Cargo.lock', 'about.hbs', 'about.toml') }}
- name: Install cargo-about
if: steps.cache-license.outputs.cache-hit != 'true'
uses: taiki-e/install-action@v2
with:
tool: cargo-about
- name: Generate LICENSE.md
if: steps.cache-license.outputs.cache-hit != 'true'
run: |
cargo about generate about.hbs | perl -0777 -pe 's/\s+$/\n/' | tee -a LICENSE.md > /dev/null
- name: Upload LICENSE.md
uses: actions/upload-artifact@v4
with:
name: generated-license
path: LICENSE.md
build:
name: Build (${{ matrix.artifact }})
runs-on: ${{ matrix.os }}
needs: license
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
# Linux x64 GNU
- os: ubuntu-22.04 # using an older version of Ubuntu for linuxdeployqt
target: x86_64-unknown-linux-gnu
artifact: linux-x86_64
cli: packobf_cli
gui: packobf_gui
java-lib: librust.so
qt-arch: linux_gcc_64
# Linux x64 MUSL
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact: linux-x86_64-musl
cli: packobf_cli
gui: ""
java-lib: librust.so
qt-arch: ""
# Linux ARM64
- os: ubuntu-22.04 # using an older version of Ubuntu for linuxdeployqt
target: aarch64-unknown-linux-gnu
artifact: linux-aarch64
cli: packobf_cli
gui: ""
java-lib: librust.so
qt-arch: ""
# macOS Intel
- os: macos-latest
target: x86_64-apple-darwin
artifact: macos-x86_64
cli: packobf_cli
gui: packobf_gui
java-lib: librust.dylib
qt-arch: clang_64
# macOS Apple Silicon
- os: macos-latest
target: aarch64-apple-darwin
artifact: macos-aarch64
cli: packobf_cli
gui: packobf_gui
java-lib: librust.dylib
qt-arch: clang_64
# Windows x64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: windows-x86_64
cli: packobf_cli.exe
gui: packobf_gui.exe
java-lib: rust.dll
qt-arch: win64_msvc2022_64
# Windows ARM64
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact: windows-aarch64
cli: packobf_cli.exe
gui: ""
java-lib: rust.dll
qt-arch: ""
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust-qt-6.8.3-${{ matrix.os }}-${{ matrix.target }}"
- name: Install Qt
if: matrix.gui != ''
uses: jurplel/install-qt-action@v4
with:
version: '6.8.3'
arch: ${{ matrix.qt-arch }}
- name: Install cross (linux-x86_64-musl and linux-aarch64)
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'x86_64-unknown-linux-musl'
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build
if: matrix.target != 'aarch64-unknown-linux-gnu' && matrix.target != 'x86_64-unknown-linux-musl' && matrix.target != 'aarch64-pc-windows-msvc'
run: cargo build --release --target ${{ matrix.target }}
- name: Build (linux-aarch64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: cross build --release --target ${{ matrix.target }} -p packobf_cli -p rust
- name: Build (linux-x86_64-musl)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: cross build --release --target ${{ matrix.target }} -p packobf_cli
- name: Build (aarch64-pc-windows-msvc)
if: matrix.target == 'aarch64-pc-windows-msvc'
run: cargo build --release --target ${{ matrix.target }} -p packobf_cli -p rust
- name: Download LICENSE.md
uses: actions/download-artifact@v4
with:
name: generated-license
- name: Prepare CLI Executable
# Always make sure files that are published contain the license files
run: |
rm -rf dist && mkdir -p dist
cp target/${{ matrix.target }}/release/${{ matrix.cli }} dist/
cp LICENSE.md dist/
- name: Upload CLI Executable
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.artifact }}
path: dist/*
- name: Prepare GUI Executable
if: matrix.gui != ''
# Always make sure files that are published contain the license files
run: |
rm -rf dist && mkdir -p dist
cp target/${{ matrix.target }}/release/${{ matrix.gui }} dist/
cp LICENSE.md dist/
- name: Deploy Qt Dependencies (Windows)
if: runner.os == 'Windows' && matrix.gui != ''
run: |
windeployqt --qmldir packobf_gui --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime dist/${{ matrix.gui }}
cp /c/Windows/System32/msvcp140.dll dist/
cp /c/Windows/System32/vcruntime140.dll dist/
cp /c/Windows/System32/msvcp140_1.dll dist/
cp /c/Windows/System32/msvcp140_2.dll dist/
cp /c/Windows/System32/vcruntime140_1.dll dist/
# Removing all unused DLLs
rm -rf dist/generic dist/iconengines dist/imageformats dist/networkinformation dist/qmltooling dist/tls dist/Qt6LabsFolderListModel.dll dist/Qt6QuickControls2BasicStyleImpl.dll dist/Qt6QuickControls2FluentWinUI3StyleImpl.dll dist/Qt6QuickControls2Imagine.dll dist/Qt6QuickControls2ImagineStyleImpl.dll dist/Qt6QuickControls2Material.dll dist/Qt6QuickControls2MaterialStyleImpl.dll dist/Qt6QuickControls2Universal.dll dist/Qt6QuickControls2UniversalStyleImpl.dll dist/Qt6QuickControls2WindowsStyleImpl.dll dist/Qt6QuickEffects.dll dist/Qt6QuickShapes.dll dist/Qt6Svg.dll
- name: Deploy Qt Dependencies (macOS)
if: runner.os == 'macOS' && matrix.gui != ''
run: |
mkdir -p dist/PackOBF\ GUI.app/Contents/MacOS
cp dist/${{ matrix.gui }} dist/PackOBF\ GUI.app/Contents/MacOS/PackOBF\ GUI
mkdir -p dist/PackOBF\ GUI.app/Contents/Resources
mv dist/LICENSE.md dist/PackOBF\ GUI.app/Contents/Resources/
cd dist
macdeployqt PackOBF\ GUI.app -dmg -qmldir=../packobf_gui
cd ..
rm -rf dist/PackOBF\ GUI.app
rm -f dist/${{ matrix.gui }}
- name: Deploy Qt Dependencies (Linux)
if: runner.os == 'Linux' && matrix.gui != ''
run: |
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod +x linuxdeployqt-continuous-x86_64.AppImage
# Cleanup Qt installation
rm -rf ../Qt/6.8.3/gcc_64/plugins/printsupport
rm -rf ../Qt/6.8.3/gcc_64/plugins/sqldrivers
rm -rf ../Qt/6.8.3/gcc_64/plugins/help
rm -rf ../Qt/6.8.3/gcc_64/plugins/designer
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmltooling
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmlls
rm -rf ../Qt/6.8.3/gcc_64/plugins/qmllint
rm -rf ../Qt/6.8.3/gcc_64/plugins/platformthemes/libqgtk3.so
cat <<EOF > dist/packobf_gui.desktop
[Desktop Entry]
Type=Application
Name=packobf
Exec=packobf_gui
Icon=packobf_gui
Categories=Utility;
EOF
touch dist/packobf_gui.png
export APPIMAGE_EXTRACT_AND_RUN=1
./linuxdeployqt-continuous-x86_64.AppImage dist/${{ matrix.gui }} -appimage -qmldir=packobf_gui -no-translations -exclude-libs=networkinformation,qmltooling,tls -extra-plugins=platformthemes/libqxdgdesktopportal.so
# The AppImage will already contain the license file
rm -rf dist && mkdir -p dist
mv packobf-*.AppImage dist/packobf-gui-${{ matrix.artifact }}.AppImage
- name: Upload GUI Executable
if: matrix.gui != ''
uses: actions/upload-artifact@v4
with:
name: gui-${{ matrix.artifact }}
path: dist/*
- name: Prepare Java Native Library
if: matrix.target != 'x86_64-unknown-linux-musl'
run: |
rm -rf dist && mkdir -p dist
cp target/${{ matrix.target }}/release/${{ matrix.java-lib }} dist/
cp LICENSE.md dist/
- name: Upload Java Native Library
if: matrix.target != 'x86_64-unknown-linux-musl'
uses: actions/upload-artifact@v4
with:
name: java-lib-${{ matrix.artifact }}
path: dist/*
buildJava:
name: Build Java Library
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Java
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
cache: 'gradle'
- name: Download Linux x64
uses: actions/download-artifact@v4
with:
name: java-lib-linux-x86_64
path: artifacts/native/linux-x86_64
- name: Download Linux ARM64
uses: actions/download-artifact@v4
with:
name: java-lib-linux-aarch64
path: artifacts/native/linux-aarch64
- name: Download macOS Intel
uses: actions/download-artifact@v4
with:
name: java-lib-macos-x86_64
path: artifacts/native/macos-x86_64
- name: Download macOS ARM
uses: actions/download-artifact@v4
with:
name: java-lib-macos-aarch64
path: artifacts/native/macos-aarch64
- name: Download Windows x64
uses: actions/download-artifact@v4
with:
name: java-lib-windows-x86_64
path: artifacts/native/windows-x86_64
- name: Download Windows ARM
uses: actions/download-artifact@v4
with:
name: java-lib-windows-aarch64
path: artifacts/native/windows-aarch64
- name: Copy native libraries
run: |
mkdir -p java/build/external-natives
cp -r artifacts/native/linux-x86_64 java/build/external-natives/
cp -r artifacts/native/linux-aarch64 java/build/external-natives/
cp -r artifacts/native/macos-x86_64 java/build/external-natives/
cp -r artifacts/native/macos-aarch64 java/build/external-natives/
cp -r artifacts/native/windows-x86_64 java/build/external-natives/
cp -r artifacts/native/windows-aarch64 java/build/external-natives/
- name: Build
run: |
cd java
./gradlew build
- name: Upload jar
uses: actions/upload-artifact@v4
with:
name: java-package
path: java/build/libs/*.jar