|
| 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: 4 |
| 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 | + # Create a disk image for installation |
| 100 | + - name: Create disk image |
| 101 | + run: | |
| 102 | + brew install create-dmg |
| 103 | + mkdir dmg |
| 104 | + cd dmg |
| 105 | + mv ../SerialPrograms.app ./SerialPrograms.app |
| 106 | + create-dmg --volname "SerialPrograms Installer" \ |
| 107 | + --window-pos 150 150 \ |
| 108 | + --window-size 600 400 \ |
| 109 | + --icon-size 128 \ |
| 110 | + --icon "SerialPrograms.app" 140 160 \ |
| 111 | + --hide-extension "SerialPrograms.app" \ |
| 112 | + --app-drop-link 450 160 \ |
| 113 | + "SerialPrograms-Installer.dmg" \ |
| 114 | + "./" |
| 115 | + mv SerialPrograms-Installer.dmg $GITHUB_WORKSPACE/SerialPrograms-Installer.dmg |
| 116 | + |
| 117 | + - name: Upload artifact |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: SerialPrograms-Installer.dmg |
| 121 | + path: SerialPrograms-Installer.dmg |
| 122 | + |
| 123 | + - name: GitHub Release |
| 124 | + uses: softprops/action-gh-release@v2 |
| 125 | + with: |
| 126 | + files: SerialPrograms-Installer.dmg |
| 127 | + # Tag should be automatically set in the case of a tag push |
| 128 | + tag_name: ${{ github.event.inputs.version }} |
| 129 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments