From 68aa04926ea37e75381bcbc41ee5572350a24880 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 26 Oct 2025 12:31:33 -0500 Subject: [PATCH] Switch to GitHub Actions for Windows and macOS builds --- .github/workflows/build-win-mac.yml | 113 ++++++++++++++++++++++++++++ README.md | 1 + appveyor.yml | 32 +------- scripts/build-appimage.sh | 7 +- scripts/build-arch.bat | 10 ++- scripts/build-steamlink-app.sh | 7 +- scripts/generate-bundle.bat | 10 ++- scripts/generate-dmg.sh | 17 +++-- 8 files changed, 157 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/build-win-mac.yml diff --git a/.github/workflows/build-win-mac.yml b/.github/workflows/build-win-mac.yml new file mode 100644 index 00000000..a390da79 --- /dev/null +++ b/.github/workflows/build-win-mac.yml @@ -0,0 +1,113 @@ +name: Build Windows and macOS + +on: + push: + pull_request: + branches: [ "master" ] + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + # Windows + - os: windows-2025 + qt_version: 6.10.0 + # macOS + - os: macos-15 + qt_version: 6.10.0 + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: 1 + + - name: Set CI version + shell: bash + run: | + CI_VERSION=`echo $GITHUB_SHA | cut -c1-6` + echo "CI_VERSION=$CI_VERSION" >> $GITHUB_ENV + + - name: Install create-dmg (macOS) + if: runner.os == 'macOS' + run: | + brew install node + npm install --global create-dmg + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + cache: true + set-env: ${{ runner.os != 'Windows' }} + add-tools-to-path: ${{ runner.os != 'Windows' }} + version: ${{ matrix.qt_version }} + + - name: Install Qt ARM64 (Windows) + if: runner.os == 'Windows' + uses: jurplel/install-qt-action@v4 + with: + cache: true + set-env: false + add-tools-to-path: false + arch: win64_msvc2022_arm64_cross_compiled + version: ${{ matrix.qt_version }} + + - name: Build x64 binaries (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + set "PATH=%QT_PATH%;%PATH%" + scripts\build-arch.bat Release x64 + env: + QT_PATH: ${{ runner.workspace }}\Qt\${{ matrix.qt_version }}\msvc2022_64\bin + + - name: Build ARM64 binaries (Windows) + if: runner.os == 'Windows' + shell: cmd + run: | + set "PATH=%QT_PATH%;%PATH%" + scripts\build-arch.bat Release arm64 + env: + QT_PATH: ${{ runner.workspace }}\Qt\${{ matrix.qt_version }}\msvc2022_arm64\bin + + - name: Build Package + shell: pwsh + run: | + if ($Env:RUNNER_OS -eq "Windows") { + cmd /c scripts\generate-bundle.bat Release + } else { + bash scripts/generate-dmg.sh Release + } + + - name: Collect Artifacts + shell: pwsh + run: | + New-Item -Path archive -ItemType Directory + if ($Env:RUNNER_OS -eq "Windows") { + Copy-Item -Path "build/installer-x64-release/*" -Destination archive + Copy-Item -Path "build/installer-arm64-release/*" -Destination archive + } else { + Copy-Item -Path "build/installer-Release/*.dmg" -Destination archive + } + + - name: Upload Binaries + uses: actions/upload-artifact@v4 + with: + name: Moonlight-${{ runner.os }}-${{ env.CI_VERSION }} + path: archive/* + compression-level: 0 + if-no-files-found: error + + - name: Upload Symbols + uses: actions/upload-artifact@v4 + with: + name: zDevDbgSyms-${{ runner.os }}-${{ env.CI_VERSION }} + path: | + build/installer-*/*.dsym/* + build/symbols-*/*.pdb + if-no-files-found: error diff --git a/README.md b/README.md index 8a0ecca3..ac7bb2d2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Moonlight also has mobile versions for [Android](https://github.com/moonlight-st You can follow development on our [Discord server](https://moonlight-stream.org/discord) and help translate Moonlight into your language on [Weblate](https://hosted.weblate.org/projects/moonlight/moonlight-qt/). + [![Windows and macOS CI Builds](https://github.com/moonlight-stream/moonlight-qt/actions/workflows/build-win-mac.yml/badge.svg?branch=master)](https://github.com/moonlight-stream/moonlight-qt/actions/workflows/build-win-mac.yml?query=branch%3Amaster) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/glj5cxqwy2w3bglv/branch/master?svg=true)](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master) [![Downloads](https://img.shields.io/github/downloads/moonlight-stream/moonlight-qt/total)](https://github.com/moonlight-stream/moonlight-qt/releases) [![Translation Status](https://hosted.weblate.org/widgets/moonlight/-/moonlight-qt/svg-badge.svg)](https://hosted.weblate.org/projects/moonlight/moonlight-qt/) diff --git a/appveyor.yml b/appveyor.yml index f3eecc8d..3dc3800e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,11 +4,6 @@ clone_depth: 1 environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - QTDIR: C:\Qt\6.9 - - APPVEYOR_BUILD_WORKER_IMAGE: macOS-Sonoma - BUILD_TARGET: macos - QTDIR: Qt/6.6 - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604 BUILD_TARGET: steamlink - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 @@ -16,11 +11,6 @@ environment: FFMPEG_CONFIGURE_ARGS: --enable-pic --disable-static --enable-shared --disable-all --enable-avcodec --enable-avformat --enable-swscale --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=av1_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau --enable-hwaccel=av1_vdpau --enable-libdrm --enable-hwaccel=h264_vulkan --enable-hwaccel=hevc_vulkan --enable-hwaccel=av1_vulkan --enable-libdav1d --enable-decoder=libdav1d install: - - cmd: 'copy /y scripts\appveyor\qmake.bat %QTDIR%\msvc2022_arm64\bin\' - - cmd: 'copy /y scripts\appveyor\qtpaths.bat %QTDIR%\msvc2022_arm64\bin\' - - cmd: 'copy /y scripts\appveyor\target_qt.conf %QTDIR%\msvc2022_arm64\bin\' - - sh: '[ "$BUILD_TARGET" != macos ] || nvm use node' - - sh: '[ "$BUILD_TARGET" != macos ] || npm install --global create-dmg' - sh: '[ "$BUILD_TARGET" != steamlink ] || sudo apt install -y libc6:i386 libstdc++6:i386' - sh: '[ "$BUILD_TARGET" != steamlink ] || git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk' - sh: '[ "$BUILD_TARGET" != linux ] || wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -' @@ -37,30 +27,16 @@ install: - sh: 'if [[ "$BUILD_TARGET" = linux ]]; then mkdir $HOME/bin && wget -O $HOME/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage && chmod a+x $HOME/bin/linuxdeployqt; fi' before_build: - - 'git -c submodule.libs.update=none submodule update --init --recursive' - - cmd: 'git submodule update --init --recursive' + - sh: 'git -c submodule.libs.update=none submodule update --init --recursive' - sh: '[ "$BUILD_TARGET" = linux ] || git submodule update --init --recursive' - - cmd: 'set OLDPATH=%PATH%' - - cmd: 'set /p VERSION=/dev/null 2>&1 || fail "Unable to find 'qmake6' in your PATH!" command -v linuxdeployqt >/dev/null 2>&1 || fail "Unable to find 'linuxdeployqt' in your PATH!" diff --git a/scripts/build-arch.bat b/scripts/build-arch.bat index 329eb7d3..d13d22a5 100644 --- a/scripts/build-arch.bat +++ b/scripts/build-arch.bat @@ -96,7 +96,13 @@ set BUILD_FOLDER=%BUILD_ROOT%\build-%ARCH%-%BUILD_CONFIG% set DEPLOY_FOLDER=%BUILD_ROOT%\deploy-%ARCH%-%BUILD_CONFIG% set INSTALLER_FOLDER=%BUILD_ROOT%\installer-%ARCH%-%BUILD_CONFIG% set SYMBOLS_FOLDER=%BUILD_ROOT%\symbols-%ARCH%-%BUILD_CONFIG% -set /p VERSION=<%SOURCE_ROOT%\app\version.txt + +rem Allow CI to override the version.txt with an environment variable +if defined CI_VERSION ( + set VERSION=%CI_VERSION% +) else ( + set /p VERSION=<%SOURCE_ROOT%\app\version.txt +) rem Use the correct VC tools for the specified architecture if /I "%ARCH%" EQU "x64" ( @@ -237,7 +243,7 @@ if "%ML_SYMBOL_STORE%" NEQ "" ( ) echo Building MSI -msbuild -Restore %SOURCE_ROOT%\wix\Moonlight\Moonlight.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=%ARCH% /p:MSBuildProjectExtensionsPath=%BUILD_FOLDER%\ +cmd /c "set VERSION= && msbuild -Restore %SOURCE_ROOT%\wix\Moonlight\Moonlight.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=%ARCH% /p:MSBuildProjectExtensionsPath=%BUILD_FOLDER%\" if !ERRORLEVEL! NEQ 0 goto Error echo Copying application binary to deployment directory diff --git a/scripts/build-steamlink-app.sh b/scripts/build-steamlink-app.sh index e6197496..be0abe30 100755 --- a/scripts/build-steamlink-app.sh +++ b/scripts/build-steamlink-app.sh @@ -16,7 +16,12 @@ SOURCE_ROOT=$PWD BUILD_FOLDER=$BUILD_ROOT/build-$BUILD_CONFIG DEPLOY_FOLDER=$BUILD_ROOT/deploy-$BUILD_CONFIG INSTALLER_FOLDER=$BUILD_ROOT/installer-$BUILD_CONFIG -VERSION=`cat $SOURCE_ROOT/app/version.txt` + +if [ -n "$CI_VERSION" ]; then + VERSION=$CI_VERSION +else + VERSION=`cat $SOURCE_ROOT/app/version.txt` +fi echo Cleaning output directories rm -rf $BUILD_FOLDER diff --git a/scripts/generate-bundle.bat b/scripts/generate-bundle.bat index 185fdb16..ec32c1cd 100644 --- a/scripts/generate-bundle.bat +++ b/scripts/generate-bundle.bat @@ -38,7 +38,13 @@ set BUILD_ROOT=%cd%\build set SOURCE_ROOT=%cd% set BUILD_FOLDER=%BUILD_ROOT%\build-%BUILD_CONFIG% set INSTALLER_FOLDER=%BUILD_ROOT%\installer-%BUILD_CONFIG% -set /p VERSION=<%SOURCE_ROOT%\app\version.txt + +rem Allow CI to override the version.txt with an environment variable +if defined CI_VERSION ( + set VERSION=%CI_VERSION% +) else ( + set /p VERSION=<%SOURCE_ROOT%\app\version.txt +) rem Ensure that all architectures have been built before the final bundle if not exist "%BUILD_ROOT%\build-x64-%BUILD_CONFIG%\Moonlight.msi" ( @@ -67,7 +73,7 @@ if !ERRORLEVEL! NEQ 0 goto Error echo Building bundle rem Bundles are always x86 binaries -msbuild -Restore %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86 /p:MSBuildProjectExtensionsPath=%BUILD_FOLDER%\ +cmd /c "set VERSION= && msbuild -Restore %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86 /p:MSBuildProjectExtensionsPath=%BUILD_FOLDER%\" if !ERRORLEVEL! NEQ 0 goto Error rem Rename the installer to match the publishing convention diff --git a/scripts/generate-dmg.sh b/scripts/generate-dmg.sh index 12cacf97..a6cde650 100755 --- a/scripts/generate-dmg.sh +++ b/scripts/generate-dmg.sh @@ -15,7 +15,12 @@ BUILD_ROOT=$PWD/build SOURCE_ROOT=$PWD BUILD_FOLDER=$BUILD_ROOT/build-$BUILD_CONFIG INSTALLER_FOLDER=$BUILD_ROOT/installer-$BUILD_CONFIG -VERSION=`cat $SOURCE_ROOT/app/version.txt` + +if [ -n "$CI_VERSION" ]; then + VERSION=$CI_VERSION +else + VERSION=`cat $SOURCE_ROOT/app/version.txt` +fi if [ "$SIGNING_PROVIDER_SHORTNAME" == "" ]; then SIGNING_PROVIDER_SHORTNAME=$SIGNING_IDENTITY @@ -65,9 +70,9 @@ fi echo Creating DMG if [ "$SIGNING_IDENTITY" != "" ]; then - create-dmg $BUILD_FOLDER/app/Moonlight.app $INSTALLER_FOLDER --identity="$SIGNING_IDENTITY" || fail "create-dmg failed!" + create-dmg $BUILD_FOLDER/app/Moonlight.app $INSTALLER_FOLDER --identity="$SIGNING_IDENTITY" --no-version-in-filename || fail "create-dmg failed!" else - create-dmg $BUILD_FOLDER/app/Moonlight.app $INSTALLER_FOLDER + create-dmg $BUILD_FOLDER/app/Moonlight.app $INSTALLER_FOLDER --no-version-in-filename case $? in 0) ;; 2) ;; @@ -77,11 +82,11 @@ fi if [ "$NOTARY_KEYCHAIN_PROFILE" != "" ]; then echo Uploading to App Notary service - xcrun notarytool submit --keychain-profile "$NOTARY_KEYCHAIN_PROFILE" --wait $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg || fail "Notary submission failed" + xcrun notarytool submit --keychain-profile "$NOTARY_KEYCHAIN_PROFILE" --wait $INSTALLER_FOLDER/Moonlight.dmg || fail "Notary submission failed" echo Stapling notary ticket to DMG - xcrun stapler staple -v $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg || fail "Notary ticket stapling failed!" + xcrun stapler staple -v $INSTALLER_FOLDER/Moonlight.dmg || fail "Notary ticket stapling failed!" fi -mv $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg $INSTALLER_FOLDER/Moonlight-$VERSION.dmg +mv $INSTALLER_FOLDER/Moonlight.dmg $INSTALLER_FOLDER/Moonlight-$VERSION.dmg echo Build successful \ No newline at end of file