Skip to content

Commit e61f12c

Browse files
committed
fix 103
1 parent ccb7f33 commit e61f12c

1 file changed

Lines changed: 26 additions & 96 deletions

File tree

.github/workflows/build.yml

Lines changed: 26 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build and create packages
2-
32
on:
43
push:
54
branches:
@@ -10,7 +9,6 @@ on:
109
pull_request:
1110
branches:
1211
- main
13-
1412
jobs:
1513
build-cmake:
1614
name: Build ${{ matrix.config.name }} Qt ${{ matrix.qt_version }}
@@ -39,19 +37,23 @@ jobs:
3937
os: ubuntu-22.04
4038
cc: "clang"
4139
cxx: "clang++"
42-
- name: "macOS"
43-
build_dir: "macos"
40+
- name: "macOS Intel (x86_64)"
41+
build_dir: "macos-x86_64"
4442
os: macos-latest
4543
cc: "clang"
4644
cxx: "clang++"
47-
45+
cmake_arch_args: "-DCMAKE_OSX_ARCHITECTURES=x86_64" #
46+
- name: "macOS Apple Silicon (arm64)" # Added for ARM64 build
47+
build_dir: "macos-arm64"
48+
os: macos-latest
49+
cc: "clang"
50+
cxx: "clang++"
51+
cmake_arch_args: "-DCMAKE_OSX_ARCHITECTURES=arm64"
4852
qt_version:
4953
- "6.9.1"
50-
5154
include:
5255
- generators: "Ninja"
5356
- build_type: "Release"
54-
5557
steps:
5658
- uses: actions/checkout@v4
5759
- uses: lukka/get-cmake@latest
@@ -83,7 +85,7 @@ jobs:
8385
- name: Configure
8486
working-directory: ${{ github.workspace }}
8587
id: runcmake
86-
run: cmake -B "build/${{ matrix.config.build_dir }}" -G "${{ matrix.generators }}" -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
88+
run: cmake -B "build/${{ matrix.config.build_dir }}" -G "${{ matrix.generators }}" -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} ${{ matrix.config.cmake_arch_args }}
8789
- name: Build
8890
working-directory: ${{ github.workspace }}
8991
id: runcmakebuild
@@ -94,7 +96,6 @@ jobs:
9496
id: runcmakeinstall
9597
run: |
9698
cmake --install "build/${{ matrix.config.build_dir }}" --prefix="dist/${{ matrix.config.build_dir }}/usr"
97-
9899
- name: Set version tag or commit SHA
99100
id: version
100101
run: |
@@ -104,94 +105,76 @@ jobs:
104105
echo "version=${GITHUB_SHA::7}" >> $GITHUB_ENV
105106
fi
106107
shell: bash
107-
108108
- name: Create TGZ archive (Linux)
109109
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
110110
run: |
111111
mkdir -p dist/qtedit4/
112112
ln -s ../${{ matrix.config.build_dir }}/usr/ "dist/qtedit4/qtedit4-${{ matrix.config.build_dir }}-${{ env.version }}"
113113
tar -czhf "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz" -C "dist/qtedit4/" .
114114
shell: bash
115-
116115
- name: Create AppImage (Linux)
117116
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
118117
run: |
119118
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/"
120119
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/"
121120
cp -arv ${QT_ROOT_DIR}/plugins/iconengines/* "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/"
122121
cp -arv ${QT_ROOT_DIR}/plugins/platforms/libqwayland-*.so "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/"
123-
124122
export LD_LIBRARY_PATH=dist/${{ matrix.config.build_dir }}/usr/lib:$LD_LIBRARY_PATH
125123
export OUTPUT=build/qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.AppImage
126-
127124
sudo apt install fuse libxkbcommon-x11-0 libxcb-cursor-dev libxkbcommon-dev
128-
129125
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
130126
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
131-
132127
chmod +x linuxdeploy*.AppImage
133-
134128
./linuxdeploy-x86_64.AppImage --appdir "dist/${{ matrix.config.build_dir }}" --plugin qt --output appimage
135-
136129
- name: Upload AppImage (Linux)
137130
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
138131
uses: actions/upload-artifact@v4
139132
with:
140133
name: qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.AppImage
141134
path: build/qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.AppImage
142-
143135
- name: Upload TGZ archive (Linux)
144136
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
145137
uses: actions/upload-artifact@v4
146138
with:
147139
name: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz
148140
path: "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz"
149-
150141
- name: windeployqt (Windows)
151142
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
152143
run: |
153144
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.exe
154-
155145
- name: Create setup (Windows)
156146
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
157147
uses: Minionguyjpro/Inno-Setup-Action@v1.2.4
158148
with:
159149
path: "setup_script.iss"
160150
options: /O+
161-
162151
- name: Rename and upload setup (Windows)
163152
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
164153
run: |
165154
copy dist\qtedit4-win64.exe dist\qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe
166155
shell: cmd
167-
168156
- name: Upload renamed setup (Windows)
169157
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
170158
uses: actions/upload-artifact@v4
171159
with:
172160
name: qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe
173161
path: dist/qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe
174-
175162
- name: macdeployqt (macOS)
176163
if: matrix.config.os == 'macos-latest'
177164
run: |
178165
# First, find where the actual binary was installed
179166
echo "Looking for qtedit4 binary:"
180167
find "dist/${{ matrix.config.build_dir }}" -name "qtedit4" -type f
181-
182168
# Check if we have an app bundle or just a binary
183169
if [ -d "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" ]; then
184170
echo "Found existing app bundle"
185171
APP_PATH="dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app"
186172
else
187-
echo "Creating app bundle structure"
188173
APP_PATH="dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app"
189174
mkdir -p "$APP_PATH/Contents/MacOS"
190175
mkdir -p "$APP_PATH/Contents/Resources"
191176
mkdir -p "$APP_PATH/Contents/Frameworks"
192177
mkdir -p "$APP_PATH/Contents/PlugIns"
193-
194-
# Copy the binary to the app bundle
195178
if [ -f "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4" ]; then
196179
cp "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4" "$APP_PATH/Contents/MacOS/"
197180
chmod +x "$APP_PATH/Contents/MacOS/qtedit4"
@@ -200,35 +183,18 @@ jobs:
200183
echo "ERROR: Could not find qtedit4 binary!"
201184
exit 1
202185
fi
203-
204-
# Create Info.plist
205-
echo '<?xml version="1.0" encoding="UTF-8"?>' > "$APP_PATH/Contents/Info.plist"
206-
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> "$APP_PATH/Contents/Info.plist"
207-
echo '<plist version="1.0">' >> "$APP_PATH/Contents/Info.plist"
208-
echo '<dict>' >> "$APP_PATH/Contents/Info.plist"
209-
echo ' <key>CFBundleExecutable</key>' >> "$APP_PATH/Contents/Info.plist"
210-
echo ' <string>qtedit4</string>' >> "$APP_PATH/Contents/Info.plist"
211-
echo ' <key>CFBundleIdentifier</key>' >> "$APP_PATH/Contents/Info.plist"
212-
echo ' <string>com.qtedit4.app</string>' >> "$APP_PATH/Contents/Info.plist"
213-
echo ' <key>CFBundleName</key>' >> "$APP_PATH/Contents/Info.plist"
214-
echo ' <string>QTEdit4</string>' >> "$APP_PATH/Contents/Info.plist"
215-
echo ' <key>CFBundleVersion</key>' >> "$APP_PATH/Contents/Info.plist"
216-
echo ' <string>1.0</string>' >> "$APP_PATH/Contents/Info.plist"
217-
echo ' <key>CFBundleShortVersionString</key>' >> "$APP_PATH/Contents/Info.plist"
218-
echo ' <string>1.0</string>' >> "$APP_PATH/Contents/Info.plist"
219-
echo ' <key>CFBundlePackageType</key>' >> "$APP_PATH/Contents/Info.plist"
220-
echo ' <string>APPL</string>' >> "$APP_PATH/Contents/Info.plist"
221-
echo '</dict>' >> "$APP_PATH/Contents/Info.plist"
222-
echo '</plist>' >> "$APP_PATH/Contents/Info.plist"
186+
if [ -f "Info.plist" ]; then
187+
cp "Info.plist" "$APP_PATH/Contents/Info.plist"
188+
echo "Copied Info.plist to app bundle"
189+
else
190+
echo "ERROR: Info.plist not found in the repository root!"
191+
exit 1
192+
fi
223193
fi
224-
225-
# Copy resources to the app bundle
226194
if [ -d "resources" ]; then
227195
cp -r resources/* "$APP_PATH/Contents/Resources/"
228196
echo "Copied resources to app bundle"
229197
fi
230-
231-
# Copy icon theme to the app bundle (similar to Windows/Linux)
232198
if [ -d "share/icons" ]; then
233199
mkdir -p "$APP_PATH/Contents/Resources/share/icons"
234200
cp -r share/icons/* "$APP_PATH/Contents/Resources/share/icons/"
@@ -240,16 +206,8 @@ jobs:
240206
else
241207
echo "Warning: No icon theme found in share/icons or ../share/icons"
242208
fi
243-
244-
# Verify binary is in place
245-
echo "Checking for binary in app bundle:"
246209
ls -la "$APP_PATH/Contents/MacOS/"
247-
248-
# Run macdeployqt
249-
echo "Running macdeployqt..."
250210
macdeployqt "$APP_PATH" -verbose=2 -always-overwrite
251-
252-
# Verify Qt frameworks were bundled
253211
echo "App bundle contents after macdeployqt:"
254212
ls -la "$APP_PATH/Contents/"
255213
if [ -d "$APP_PATH/Contents/Frameworks" ]; then
@@ -258,39 +216,21 @@ jobs:
258216
else
259217
echo "WARNING: No Frameworks directory found!"
260218
fi
261-
262-
# Check app bundle size
263-
echo "Final app bundle size:"
264-
du -sh "$APP_PATH"
265-
266219
- name: Create ZIP archive (macOS)
267220
if: matrix.config.os == 'macos-latest'
268221
run: |
269222
cd "dist/${{ matrix.config.build_dir }}/usr/bin"
270-
zip -r "../../../../qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.zip" qtedit4.app
223+
zip -r "../../../../qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.zip" qtedit4.app # Updated filename
271224
shell: bash
272-
273225
- name: Create DMG (macOS)
274226
if: matrix.config.os == 'macos-latest'
275227
run: |
276-
# Install create-dmg if not available
277228
brew install create-dmg
278-
279-
# Verify app bundle size before DMG creation
280-
echo "Final app bundle size before DMG creation:"
281229
du -sh "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app"
282-
283-
# Create a temporary directory for DMG contents
284230
mkdir -p dmg_temp
285231
cp -r "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" dmg_temp/
286-
287-
# Verify copied app size
288-
echo "App size in DMG temp directory:"
289-
du -sh dmg_temp/qtedit4.app
290-
291-
# Create the DMG with larger initial size
292232
create-dmg \
293-
--volname "QTEdit4" \
233+
--volname "qtedit4" \
294234
--volicon "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app/Contents/Resources/qtedit4.icns" \
295235
--window-pos 200 120 \
296236
--window-size 600 300 \
@@ -300,34 +240,24 @@ jobs:
300240
--app-drop-link 425 120 \
301241
--disk-image-size 500 \
302242
--skip-jenkins \
303-
"qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" \
243+
"qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" \
304244
"dmg_temp/" || true
305-
306-
# Fallback: create simple DMG if create-dmg fails, with larger size
307-
if [ ! -f "qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" ]; then
245+
if [ ! -f "qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" ]; then
308246
echo "create-dmg failed, using hdiutil fallback..."
309-
hdiutil create -volname "QTEdit4" -srcfolder dmg_temp -ov -format UDZO -fs HFS+ -size 500m "qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg"
247+
hdiutil create -volname "qtedit4" -srcfolder dmg_temp -ov -format UDZO -fs HFS+ -size 500m "qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.dmg"
310248
fi
311-
312-
# Verify final DMG size
313-
echo "Final DMG size:"
314-
ls -lh "qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg"
315-
316249
- name: Upload ZIP archive (macOS)
317250
if: matrix.config.os == 'macos-latest'
318251
uses: actions/upload-artifact@v4
319252
with:
320-
name: qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.zip
321-
path: qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.zip
322-
253+
name: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.zip
254+
path: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.zip
323255
- name: Upload DMG (macOS)
324256
if: matrix.config.os == 'macos-latest'
325257
uses: actions/upload-artifact@v4
326258
with:
327-
name: qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg
328-
path: qtedit4-macos-101-qt${{ matrix.qt_version }}-${{ env.version }}.dmg
329-
330-
259+
name: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.dmg
260+
path: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.dmg
331261
create-release:
332262
name : Draft GitHub Release
333263
needs : build-cmake

0 commit comments

Comments
 (0)