Skip to content

LCDWidget: improve screen capture D'n'D. Fix #433. #174

LCDWidget: improve screen capture D'n'D. Fix #433.

LCDWidget: improve screen capture D'n'D. Fix #433. #174

name: Build macOS
on:
push:
branches: [ master, feature/github-actions ]
pull_request:
branches: [ master, feature/github-actions ]
release:
types: [published]
jobs:
build:
name: "Build: ${{ matrix.os }} Qt${{ matrix.qtvershort }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-13, macos-14]
include:
- os: macos-12
qtver: "5.15.2"
qtvershort: "5_intel"
- os: macos-13
qtver: "6.7.1"
qtvershort: "6_intel"
- os: macos-14
qtver: "6.7.1"
qtvershort: "6_arm"
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies
run: |
set -e
brew install libarchive libpng zlib automake autoconf libtool
- name: Install Qt
uses: jurplel/install-qt-action@f03f05556819ceb3781ee2f455ec44c339d683c0 # v4
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
with:
target: desktop
version: "${{ matrix.qtver }}"
setup-python: false
cache: true
# Workaround!
# libarchive.pc now has (lib)iconv in Requires.private, which doesn't work here
# See https://github.com/libarchive/libarchive/pull/1813 and other issues
- name: Fix libarchive pkg-config file
run: |
sudo sed -i '' -E '/^Requires.private: (lib)?iconv/d' $(brew --prefix libarchive)/lib/pkgconfig/libarchive.pc
- name: Build CEmu Qt on macOS
run: |
set -e
export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig:$PKG_CONFIG_PATH"
cd gui/qt/capture ; /bin/bash ./get_libpng-apng.sh ; cd ../../../
mkdir build
cd build
qmake ../gui/qt && make -j4
macdeployqt CEmu.app
mkdir -p /tmp/CEmu-nightly_mac_qt${{matrix.qtvershort}}/
mv CEmu.app /tmp/CEmu-nightly_mac_qt${{matrix.qtvershort}}/
- name: Fixup libarchive deps for some reason
run: |
libDir=/tmp/CEmu-nightly_mac_qt${{matrix.qtvershort}}/CEmu.app/Contents/Frameworks/
libAPath=${libDir}/libarchive.13.dylib
ls -al "$libAPath" || exit 1
for lib in xz zstd lz4 libb2; do cp -a $(brew --prefix ${lib})/lib/lib*.dylib "$libDir"; done
install_name_tool -change "@loader_path/../../../../opt/xz/lib/liblzma.5.dylib" "@executable_path/../Frameworks/liblzma.5.dylib" \
-change "@loader_path/../../../../opt/zstd/lib/libzstd.1.dylib" "@executable_path/../Frameworks/libzstd.1.dylib" \
-change "@loader_path/../../../../opt/lz4/lib/liblz4.1.dylib" "@executable_path/../Frameworks/liblz4.1.dylib" \
-change "@loader_path/../../../../opt/libb2/lib/libb2.1.dylib" "@executable_path/../Frameworks/libb2.1.dylib" "$libAPath" || echo lib path replacement fail
- name: "Codesign CEmu.app"
env:
HAVE_SECRETS: ${{ secrets.MACOS_CERTIFICATE_PWD != '' }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_CODESIGN_IDENT: ${{ secrets.MACOS_CODESIGN_IDENT }}
if: ${{ runner.os == 'macOS' && github.repository == 'CE-Programming/CEmu' && env.HAVE_SECRETS == 'true' }}
run: |
echo $MACOS_CERTIFICATE | base64 -d > certificate.p12
security create-keychain -p $MACOS_KEYCHAIN_PWD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $MACOS_KEYCHAIN_PWD build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PWD build.keychain
/usr/bin/codesign --deep --force --verify --verbose --sign "$MACOS_CODESIGN_IDENT" --timestamp --options runtime /tmp/CEmu-nightly_mac_qt${{matrix.qtvershort}}/CEmu.app
- name: "Create the DMG"
run: |
brew install create-dmg || brew install create-dmg; # we try twice because sometimes it fails...
# The codesign variable may be empty (for forks) but that's fine, create-dmg only does code-signing if it's not empty.
createDmgArgs="--codesign '${{ secrets.MACOS_CODESIGN_IDENT }}' \
--volname 'CEmu-nightly Qt${{matrix.qtvershort}}' \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 64 \
--icon 'CEmu.app' 125 200 \
--app-drop-link 400 200 \
'CEmu-nightly_mac_qt${{matrix.qtvershort}}.dmg' \
'/tmp/CEmu-nightly_mac_qt${{matrix.qtvershort}}/'"
eval "create-dmg $createDmgArgs" || eval "create-dmg $createDmgArgs" # We also retry just in case...
- name: "[macOS] Notarize and staple DMG"
if: ${{ runner.os == 'macOS' && github.repository == 'CE-Programming/CEmu' && env.HAVE_SECRETS == 'true' }}
env:
HAVE_SECRETS: ${{ secrets.APPLE_NOTARIZATION_PASSWORD != '' }}
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
APPLE_NOTARIZATION_TEAMID: ${{ secrets.APPLE_NOTARIZATION_TEAMID }}
run: |
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$APPLE_NOTARIZATION_USERNAME" --team-id "$APPLE_NOTARIZATION_TEAMID" --password "$APPLE_NOTARIZATION_PASSWORD"
xcrun notarytool submit "CEmu-nightly_mac_qt${{matrix.qtvershort}}.dmg" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple "CEmu-nightly_mac_qt${{matrix.qtvershort}}.dmg"
- name: Upload dmg as artifact
uses: actions/upload-artifact@v3
with:
name: CEmu-nightly_mac_qt${{matrix.qtvershort}}
path: CEmu-nightly_mac_qt${{matrix.qtvershort}}.dmg
- name: Update nightly release
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b # latest as of 2023-01-13
with:
tag_name: nightly
prerelease: true
token: ${{secrets.GITHUB_TOKEN}}
files: |
CEmu-nightly_mac_qt${{matrix.qtvershort}}.dmg