Skip to content

Commit ff92a02

Browse files
committed
feat(ci): add macOS ARM build, test and release
- Add build-macos job to build.yml (macos-14 ARM runner) - Add build-macos job to release.yml with macdeployqt + DMG - Remove MACOSX_BUNDLE (same CLI/GUI duality fix as Windows) - macOS smoke test: version, project, bus, module import - Release: QSoC.app bundle + standalone CLI in DMG - DMG contains both .app (double-click GUI) and qsoc CLI binary Signed-off-by: Huang Rui <vowstar@gmail.com>
1 parent 042858c commit ff92a02

3 files changed

Lines changed: 147 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,77 @@ jobs:
178178
cd build
179179
ctest -C ${{ env.BUILD_TYPE }} --rerun-failed --output-on-failure -E "test_qsocgui|test_qsocagenttool$|test_qsoccliparsegeneratereportunconnected"
180180
181+
build-macos:
182+
runs-on: macos-14
183+
184+
steps:
185+
- uses: actions/checkout@v4
186+
with:
187+
submodules: recursive
188+
189+
- name: Install Qt
190+
uses: jurplel/install-qt-action@v4
191+
with:
192+
version: ${{ env.QT_VERSION }}
193+
host: 'mac'
194+
target: 'desktop'
195+
arch: 'clang_64'
196+
modules: 'qt5compat'
197+
cache: 'true'
198+
cache-key-prefix: 'install-qt-action-macos'
199+
200+
- name: Install tools
201+
run: brew install ninja pkg-config
202+
203+
- name: Configure CMake (push - no tests)
204+
if: github.event_name == 'push'
205+
run: >-
206+
cmake -B build -G Ninja
207+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
208+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
209+
-DENABLE_UNIT_TEST=OFF
210+
-DENABLE_CLANG_TIDY=OFF
211+
-DENABLE_DOXYGEN=OFF
212+
213+
- name: Configure CMake (PR - with tests)
214+
if: github.event_name == 'pull_request'
215+
run: >-
216+
cmake -B build -G Ninja
217+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
218+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
219+
-DENABLE_CLANG_TIDY=OFF
220+
-DENABLE_DOXYGEN=OFF
221+
222+
- name: Build
223+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
224+
225+
- name: Smoke Test
226+
if: github.event_name == 'push'
227+
run: |
228+
set -e
229+
QSOC=./build/qsoc
230+
TMPD=$(mktemp -d)
231+
trap "rm -rf $TMPD" EXIT
232+
echo "--- version ---"
233+
$QSOC -v
234+
echo "--- help ---"
235+
$QSOC -h | head -3
236+
echo "--- project create ---"
237+
$QSOC project create -d "$TMPD" smoke_test
238+
echo "--- bus import ---"
239+
printf 'Name;Mode;Direction;Width;Qualifier\npclk;slave;in;1;\nprdata;slave;out;32;data\n' > "$TMPD/smoke.csv"
240+
$QSOC bus import -d "$TMPD" -l smoke_lib -b smoke_bus "$TMPD/smoke.csv"
241+
echo "--- module import ---"
242+
printf 'module smoke_mod(input clk, output [7:0] data);\nassign data = 8'\''hFF;\nendmodule\n' > "$TMPD/smoke.v"
243+
$QSOC module import -d "$TMPD" -l smoke_lib "$TMPD/smoke.v"
244+
echo "--- all smoke tests passed ---"
245+
246+
- name: Full Test
247+
if: github.event_name == 'pull_request'
248+
run: |
249+
cd build
250+
ctest -C ${{ env.BUILD_TYPE }} --rerun-failed --output-on-failure
251+
181252
cppcheck:
182253
runs-on: ubuntu-latest
183254

.github/workflows/release.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,81 @@ jobs:
201201
name: windows-exe
202202
path: deploy/
203203

204+
build-macos:
205+
runs-on: macos-14
206+
207+
steps:
208+
- uses: actions/checkout@v4
209+
with:
210+
submodules: recursive
211+
212+
- name: Install Qt
213+
uses: jurplel/install-qt-action@v4
214+
with:
215+
version: ${{ env.QT_VERSION }}
216+
host: 'mac'
217+
target: 'desktop'
218+
arch: 'clang_64'
219+
modules: 'qt5compat'
220+
cache: 'true'
221+
cache-key-prefix: 'install-qt-action-macos'
222+
223+
- name: Install tools
224+
run: brew install ninja pkg-config
225+
226+
- name: Configure CMake
227+
run: >-
228+
cmake -B build -G Ninja
229+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
230+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
231+
-DENABLE_CLANG_TIDY=OFF
232+
-DENABLE_DOXYGEN=OFF
233+
-DENABLE_UNIT_TEST=OFF
234+
235+
- name: Build
236+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
237+
238+
- name: Deploy
239+
run: |
240+
mkdir -p deploy/QSoC.app/Contents/MacOS
241+
cp build/qsoc deploy/QSoC.app/Contents/MacOS/
242+
cat > deploy/QSoC.app/Contents/Info.plist << 'EOF'
243+
<?xml version="1.0" encoding="UTF-8"?>
244+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
245+
<plist version="1.0">
246+
<dict>
247+
<key>CFBundleExecutable</key><string>qsoc</string>
248+
<key>CFBundleIdentifier</key><string>com.vowstar.qsoc</string>
249+
<key>CFBundleName</key><string>QSoC</string>
250+
<key>CFBundleVersion</key><string>1.0.2</string>
251+
<key>CFBundleShortVersionString</key><string>1.0</string>
252+
<key>CFBundlePackageType</key><string>APPL</string>
253+
<key>LSMinimumSystemVersion</key><string>11.0</string>
254+
</dict>
255+
</plist>
256+
EOF
257+
macdeployqt deploy/QSoC.app -verbose=1
258+
# Also keep standalone CLI binary
259+
cp build/qsoc deploy/
260+
261+
- name: Verify deployment
262+
run: |
263+
deploy/qsoc -v
264+
deploy/QSoC.app/Contents/MacOS/qsoc -v
265+
266+
- name: Create DMG
267+
run: |
268+
hdiutil create -volname "QSoC" -srcfolder deploy -ov -format UDZO \
269+
"QSoC-${{ github.ref_name }}-macos-arm64.dmg"
270+
271+
- name: Upload artifact
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: macos-dmg
275+
path: QSoC-*.dmg
276+
204277
release:
205-
needs: [build-linux, build-windows]
278+
needs: [build-linux, build-windows, build-macos]
206279
runs-on: ubuntu-22.04
207280

208281
steps:
@@ -218,13 +291,15 @@ jobs:
218291
run: |
219292
ls -la linux-appimage/
220293
ls -la QSoC-*-windows-x64.zip
294+
ls -la macos-dmg/
221295
222296
- name: Create Release
223297
uses: softprops/action-gh-release@v2
224298
with:
225299
files: |
226300
linux-appimage/QSoC-*-x86_64.AppImage
227301
QSoC-*-windows-x64.zip
302+
macos-dmg/QSoC-*-macos-arm64.dmg
228303
body: |
229304
**Full Changelog**: https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}
230305
draft: false

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
422422
MACOSX_BUNDLE_GUI_IDENTIFIER com.vowstar.${PROJECT_NAME}
423423
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
424424
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
425-
MACOSX_BUNDLE TRUE
426425
)
427426

428427
install(TARGETS ${PROJECT_NAME}

0 commit comments

Comments
 (0)