Skip to content

Commit 9c9388f

Browse files
committed
Initial Mac Release Workflow
1 parent 1eac1d0 commit 9c9388f

File tree

2 files changed

+116
-1
lines changed

2 files changed

+116
-1
lines changed

.github/workflows/mac-release.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: SerialPrograms MacOS Release
2+
3+
on:
4+
push:
5+
tags:
6+
# Start MacOS release flow when a new version tag is created
7+
- 'v*'
8+
workflow_dispatch:
9+
# Manual release / testing
10+
inputs:
11+
version:
12+
description: 'Version for the manual release'
13+
required: true
14+
jobs:
15+
description: 'Number of parallel jobs to build with'
16+
default: 1
17+
type: number
18+
qt_version:
19+
description: 'Qt version to use'
20+
required: true
21+
default: '6.8.2'
22+
type: choice
23+
options:
24+
- '6.8.2'
25+
- '6.5.3'
26+
runner:
27+
description: "MacOS Runner"
28+
required: true
29+
default: "macos-13"
30+
type: choice
31+
options:
32+
- "macos-15"
33+
- "macos-13"
34+
35+
36+
jobs:
37+
build:
38+
runs-on: ${{ github.event.inputs.runner }}
39+
steps:
40+
- name: Checkout Arduino-Source
41+
uses: actions/checkout@v4
42+
with:
43+
path: Arduino-Source
44+
45+
- name: Checkout Packages
46+
uses: actions/checkout@v4
47+
with:
48+
repository: 'PokemonAutomation/Packages'
49+
path: Packages
50+
51+
# MacOS runners have Homebrew, Xcode, and Cmake already installed
52+
- name: Install Dependencies
53+
run: |
54+
brew install tesseract
55+
brew install tesseract-lang
56+
brew install opencv
57+
58+
- uses: jurplel/install-qt-action@v4
59+
with:
60+
version: ${{ github.event.inputs.qt_version }}
61+
modules: 'qtmultimedia qtserialport'
62+
63+
- name: Build SerialPrograms.app
64+
run: |
65+
cd Arduino-Source/SerialPrograms
66+
mkdir bin
67+
cd bin
68+
cmake .. -DUNIX_LINK_TESSERACT:BOOL=true -DCMAKE_BUILD_TYPE:STRING=Release
69+
cmake --build . -j ${{ github.event.inputs.jobs }}
70+
cp -r SerialPrograms.app ../../../SerialPrograms.app
71+
72+
# Important: GitHub MacOS runners do not have the lib area in its rpath by default. It must manually be added for frameworks to be discovered and added to the bundle
73+
# Some libraries are not copied in QT deployment on the runner but will still be proprely linked if they're added prior to deployment
74+
- name: rpath resolution
75+
run: |
76+
BREW_PREFIX=$(brew --prefix)
77+
install_name_tool -add_rpath $BREW_PREFIX/lib SerialPrograms.app/Contents/MacOS/SerialPrograms
78+
otool -l SerialPrograms.app/Contents/MacOS/SerialPrograms | grep -A2 LC_RPATH
79+
mkdir SerialPrograms.app/Contents/Frameworks
80+
cp $BREW_PREFIX/Cellar/protobuf/29.3/lib/libutf8_validity.dylib SerialPrograms.app/Contents/Frameworks
81+
cp $BREW_PREFIX/Cellar/webp/1.5.0/lib/libsharpyuv.0.dylib SerialPrograms.app/Contents/Frameworks
82+
cp $BREW_PREFIX/Cellar/jpeg-xl/0.11.1/lib/libjxl_cms.0.11.dylib SerialPrograms.app/Contents/Frameworks
83+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkCommonComputationalGeometry-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
84+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkFiltersVerdict-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
85+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkfmt-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
86+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkFiltersGeometry-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
87+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkFiltersCore-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
88+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkCommonCore-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
89+
cp $BREW_PREFIX/Cellar/vtk/9.4.1_2/lib/libvtkCommonSystem-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
90+
91+
# Use macdeployqt to bundle the app with dependencies
92+
- name: Run macdeployqt
93+
run: macdeployqt SerialPrograms.app -verbose=3
94+
95+
# Dummy codesign
96+
- name: Codesign
97+
run: codesign --force --deep --sign - SerialPrograms.app
98+
99+
# Read-write format in case Resources needs to be updated
100+
- name: Create disk image
101+
run: hdiutil create -volname "SerialPrograms" -format UDRW -srcfolder SerialPrograms.app SerialPrograms.dmg
102+
103+
- name: Upload artifact
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: SerialPrograms.dmg
107+
path: SerialPrograms.dmg
108+
109+
- name: GitHub Release
110+
uses: softprops/action-gh-release@v2
111+
with:
112+
files: SerialPrograms.dmg
113+
# Tag should be automatically set in the case of a tag push
114+
tag_name: ${{ github.event.inputs.version }}
115+
token: ${{ secrets.GITHUB_TOKEN }}

SerialPrograms/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ if (APPLE)
22042204
TARGET SerialPrograms
22052205
POST_BUILD
22062206
COMMAND ${CMAKE_COMMAND} -E copy_directory
2207-
"${CMAKE_CURRENT_SOURCE_DIR}/../Resources"
2207+
"${CMAKE_CURRENT_SOURCE_DIR}/../../Packages/SerialPrograms/Resources"
22082208
"$<TARGET_FILE_DIR:SerialPrograms>/../Resources"
22092209
)
22102210
else() # WIN and Linux:

0 commit comments

Comments
 (0)