Skip to content

Cherrypick fixes.

Cherrypick fixes. #7

Workflow file for this run

name: SerialPrograms MacOS Release
on:
push:
branches:
- 'v*'
workflow_dispatch:
# Manual release / testing
inputs:
version:
description: 'Version for the manual release'
required: true
jobs:
description: 'Number of parallel jobs to build with'
default: 4
type: number
qt_version:
description: 'Qt version to use'
required: true
default: '6.8.2'
type: choice
options:
- '6.8.2'
- '6.5.3'
runner:
description: "MacOS Runner"
required: true
default: "macos-13"
type: choice
options:
- "macos-15"
- "macos-13"
jobs:
build:
# Run when manually triggered, when a new version branch is created, or when a version branch is updated
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/v'))
runs-on: ${{ github.event.inputs.runner || 'macos-13'}}
steps:
- name: Checkout Arduino-Source
uses: actions/checkout@v4
with:
path: Arduino-Source
- name: Checkout Packages
uses: actions/checkout@v4
with:
repository: 'PokemonAutomation/Packages'
path: Packages
# MacOS runners have Homebrew, Xcode, and Cmake already installed
- name: Install Dependencies
run: |
brew install tesseract
brew install tesseract-lang
brew install opencv
- name: Get QT Version
run: echo "QT_VERSION=${{ github.event.inputs.qt_version || '6.8.2' }}" >> $GITHUB_ENV
- uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
modules: 'qtmultimedia qtserialport'
- name: Build SerialPrograms.app
run: |
cd Arduino-Source/SerialPrograms
mkdir bin
cd bin
cmake .. -DUNIX_LINK_TESSERACT:BOOL=true -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build . -j ${{ github.event.inputs.jobs || 4}}
cp -r SerialPrograms.app ../../../SerialPrograms.app
# 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
# Some libraries are not copied in QT deployment on the runner but will still be proprely linked if they're added prior to deployment
- name: rpath resolution
run: |
BREW_PREFIX=$(brew --prefix)
install_name_tool -add_rpath $BREW_PREFIX/lib SerialPrograms.app/Contents/MacOS/SerialPrograms
otool -l SerialPrograms.app/Contents/MacOS/SerialPrograms | grep -A2 LC_RPATH
mkdir SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/protobuf/lib/libutf8_validity.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/webp/lib/libsharpyuv.0.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/jpeg-xl/lib/libjxl_cms.0.11.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkCommonComputationalGeometry-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkFiltersVerdict-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkfmt-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkFiltersGeometry-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkFiltersCore-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkCommonCore-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
cp $BREW_PREFIX/opt/vtk/lib/libvtkCommonSystem-9.4.1.dylib SerialPrograms.app/Contents/Frameworks
# Use macdeployqt to bundle the app with dependencies
- name: Run macdeployqt
run: macdeployqt SerialPrograms.app -verbose=3
# Dummy codesign
- name: Codesign
run: codesign --force --deep --sign - SerialPrograms.app
# Create a disk image for installation
- name: Create disk image
run: |
brew install create-dmg
mkdir dmg
cd dmg
mv ../SerialPrograms.app ./SerialPrograms.app
create-dmg --volname "SerialPrograms Installer" \
--window-pos 150 150 \
--window-size 600 400 \
--icon-size 128 \
--icon "SerialPrograms.app" 140 160 \
--hide-extension "SerialPrograms.app" \
--app-drop-link 450 160 \
"SerialPrograms-Installer.dmg" \
"./"
mv SerialPrograms-Installer.dmg $GITHUB_WORKSPACE/SerialPrograms-Installer.dmg
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: SerialPrograms-Installer.dmg
path: SerialPrograms-Installer.dmg
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
SerialPrograms-Installer.dmg
Packages/PABotBase/PABotBase-Switch/*
# Tag should be automatically set in the case of a tag push
tag_name: ${{ github.event.inputs.version || github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}