From da264539119c70afcbcab1e48fc4641e4201e6cd Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Thu, 28 Dec 2023 15:03:44 +0100 Subject: [PATCH] CI stuff (#1935) Add new macOS CI using vcpkg --- .github/workflows/build-appimage.yml | 2 +- .github/workflows/build-macos-universal.yml | 76 ------------------- .github/workflows/build-macos.yml | 84 +++++++++++++++++++++ .github/workflows/build-ubuntu-aarch64.yml | 3 +- .github/workflows/build-ubuntu.yml | 3 +- .github/workflows/build-windows.yml | 2 +- 6 files changed, 90 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/build-macos-universal.yml create mode 100644 .github/workflows/build-macos.yml diff --git a/.github/workflows/build-appimage.yml b/.github/workflows/build-appimage.yml index 7e7df583..be4494e8 100644 --- a/.github/workflows/build-appimage.yml +++ b/.github/workflows/build-appimage.yml @@ -1,4 +1,4 @@ -name: CMake Build (AppImage x86-64) +name: AppImage on: push: diff --git a/.github/workflows/build-macos-universal.yml b/.github/workflows/build-macos-universal.yml deleted file mode 100644 index 4416ce7a..00000000 --- a/.github/workflows/build-macos-universal.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: CMake Build (macOS Universal) - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - prepare: - runs-on: [self-hosted, macOS, ARM64] - - steps: - - name: Clean workspace - run: rm -rf ${{runner.workspace}}/build - - - uses: actions/checkout@v3 - - - build-arm64: - needs: prepare - runs-on: [self-hosted, macOS, ARM64] - env: - homebrew_prefix: /opt/homebrew - - steps: - - name: Create build directory - run: mkdir -p ${{runner.workspace}}/build/arm64 - - - name: Configure - working-directory: ${{runner.workspace}}/build/arm64 - run: arch -arm64 ${{env.homebrew_prefix}}/bin/cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH="${{env.homebrew_prefix}}/opt/qt@6;${{env.homebrew_prefix}}/opt/libarchive" -DPKG_CONFIG_EXECUTABLE=${{env.homebrew_prefix}}/bin/pkg-config -DMACOS_BUNDLE_LIBS=ON -DUSE_QT6=ON - - - name: Make - working-directory: ${{runner.workspace}}/build/arm64 - run: arch -arm64 make -j$(sysctl -n hw.logicalcpu) - - build-x86_64: - needs: prepare - runs-on: [self-hosted, macOS, ARM64] - env: - homebrew_prefix: /usr/local - - steps: - - name: Create build directory - run: mkdir -p ${{runner.workspace}}/build/x86_64 - - - name: Configure - working-directory: ${{runner.workspace}}/build/x86_64 - run: arch -x86_64 ${{env.homebrew_prefix}}/bin/cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH="${{env.homebrew_prefix}}/opt/qt@6;${{env.homebrew_prefix}}/opt/libarchive" -DPKG_CONFIG_EXECUTABLE=${{env.homebrew_prefix}}/bin/pkg-config -DMACOS_BUNDLE_LIBS=ON -DUSE_QT6=ON - - - name: Make - working-directory: ${{runner.workspace}}/build/x86_64 - run: arch -x86_64 make -j$(sysctl -n hw.logicalcpu) - - universal-binary: - needs: [build-arm64, build-x86_64] - runs-on: [self-hosted, macOS, ARM64] - - steps: - - name: Merge binaries - run: $GITHUB_WORKSPACE/tools/mac-universal.py ${{runner.workspace}}/build/arm64/melonDS.app ${{runner.workspace}}/build/x86_64/melonDS.app ${{runner.workspace}}/build/universal/melonDS.app - - - name: Codesign app - run: codesign -s - --deep -f ${{runner.workspace}}/build/universal/melonDS.app - - - name: Create DMG - run: hdiutil create -fs HFS+ -volname melonDS -srcfolder ${{runner.workspace}}/build/universal/melonDS.app -ov -format UDBZ ${{runner.workspace}}/build/universal/melonDS.dmg - - - uses: actions/upload-artifact@v3 - with: - name: macOS-universal - path: ${{runner.workspace}}/build/universal/melonDS.dmg - diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 00000000..6d5693a1 --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,84 @@ +name: macOS + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build-macos: + strategy: + matrix: + arch: [x86_64, arm64] + + name: ${{ matrix.arch }} + runs-on: macos-13 + steps: + - name: Check out sources + uses: actions/checkout@v3 + - name: Install dependencies for package building + run: | + brew install autoconf automake autoconf-archive libtool && pip3 install setuptools + - name: Set up CMake + uses: lukka/get-cmake@latest + - name: Set up vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: c8696863d371ab7f46e213d8f5ca923c4aef2a00 + - name: Build + uses: lukka/run-cmake@v10 + with: + configurePreset: release-mac-${{ matrix.arch }} + buildPreset: release-mac-${{ matrix.arch }} + - name: Compress app bundle + shell: bash + run: | + cd build/release-mac-${{ matrix.arch }} + zip -r -y ../../macOS-${{ matrix.arch }}.zip melonDS.app + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: macOS-${{ matrix.arch }} + path: macOS-${{ matrix.arch }}.zip + + universal-binary: + name: Universal binary + needs: [build-macos] + runs-on: macos-13 + steps: + - name: Download x86_64 + uses: actions/download-artifact@v4 + with: + name: macOS-x86_64 + path: x86_64 + - name: Download arm64 + uses: actions/download-artifact@v4 + with: + name: macOS-arm64 + path: arm64 + - name: Combine app bundles + shell: bash + run: | + unzip x86_64/*.zip -d x86_64 + unzip arm64/*.zip -d arm64 + lipo {x86_64,arm64}/melonDS.app/Contents/MacOS/melonDS -create -output melonDS + cp -a arm64/melonDS.app melonDS.app + cp melonDS melonDS.app/Contents/MacOS/melonDS + codesign -s - --deep melonDS.app + zip -r -y macOS-universal.zip melonDS.app + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: macOS-universal + path: macOS-universal.zip + - name: Clean up architecture-specific artifacts + uses: geekyeggo/delete-artifact@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + failOnError: false + name: | + macOS-x86_64 + macOS-arm64 diff --git a/.github/workflows/build-ubuntu-aarch64.yml b/.github/workflows/build-ubuntu-aarch64.yml index 096bc0b9..43f4d8b6 100644 --- a/.github/workflows/build-ubuntu-aarch64.yml +++ b/.github/workflows/build-ubuntu-aarch64.yml @@ -1,4 +1,4 @@ -name: CMake Build (Ubuntu aarch64) +name: Ubuntu on: push: @@ -13,6 +13,7 @@ env: jobs: build: + name: aarch64 runs-on: ubuntu-20.04 container: ubuntu:20.04 diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index b6c50e9a..438fddd0 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -1,4 +1,4 @@ -name: CMake Build (Ubuntu x86-64) +name: Ubuntu on: push: @@ -10,6 +10,7 @@ on: jobs: build: + name: x86_64 runs-on: ubuntu-20.04 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 70b11c05..e6846da7 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -1,4 +1,4 @@ -name: CMake Build (Windows x86-64) +name: Windows on: push: