From b90ae7890a1629d278b77ca5245f718542a119bf Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 7 May 2023 13:00:55 +0100 Subject: [PATCH] Automate macOS x86_64 release Also cleans up CPack files in other workflows after building (to avoid saving them to cache) --- .github/workflows/Linux_aarch64.yml | 2 +- .github/workflows/Linux_x86.yml | 2 +- .github/workflows/Linux_x86_64.yml | 2 +- .github/workflows/Linux_x86_64_SDL1.yml | 2 +- .github/workflows/MacOSX.yml | 63 ----------------------- .github/workflows/iOS.yml | 16 +++--- .github/workflows/macOS_x86_64.yml | 67 +++++++++++++++++++++++++ README.md | 2 +- 8 files changed, 81 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/MacOSX.yml create mode 100644 .github/workflows/macOS_x86_64.yml diff --git a/.github/workflows/Linux_aarch64.yml b/.github/workflows/Linux_aarch64.yml index 41a6c0dc3..25f7c2ba6 100644 --- a/.github/workflows/Linux_aarch64.yml +++ b/.github/workflows/Linux_aarch64.yml @@ -87,4 +87,4 @@ jobs: overwrite: true - name: Clean up artifacts - run: rm -rf build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz + run: rm -rf build/_CPack_Packages build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz diff --git a/.github/workflows/Linux_x86.yml b/.github/workflows/Linux_x86.yml index b5c8a5136..2b2905b07 100644 --- a/.github/workflows/Linux_x86.yml +++ b/.github/workflows/Linux_x86.yml @@ -88,4 +88,4 @@ jobs: overwrite: true - name: Clean up artifacts - run: rm -rf build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz + run: rm -rf build/_CPack_Packages build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz diff --git a/.github/workflows/Linux_x86_64.yml b/.github/workflows/Linux_x86_64.yml index 16160cc6f..ae064ea79 100644 --- a/.github/workflows/Linux_x86_64.yml +++ b/.github/workflows/Linux_x86_64.yml @@ -80,4 +80,4 @@ jobs: overwrite: true - name: Clean up artifacts - run: rm -rf build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz + run: rm -rf build/_CPack_Packages build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz diff --git a/.github/workflows/Linux_x86_64_SDL1.yml b/.github/workflows/Linux_x86_64_SDL1.yml index af8da0d89..e8732fbf6 100644 --- a/.github/workflows/Linux_x86_64_SDL1.yml +++ b/.github/workflows/Linux_x86_64_SDL1.yml @@ -57,4 +57,4 @@ jobs: path: devilutionx.tar.xz - name: Clean up artifacts - run: rm -rf build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz + run: rm -rf build/_CPack_Packages build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz diff --git a/.github/workflows/MacOSX.yml b/.github/workflows/MacOSX.yml deleted file mode 100644 index 9d9d8784e..000000000 --- a/.github/workflows/MacOSX.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: MacOSX - -on: - push: - branches: - - master - paths-ignore: - - '*.md' - pull_request: - types: [ opened, synchronize ] - paths-ignore: - - '*.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: macos-latest - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Create Build Environment - run: brew bundle install - - - name: Cache CMake build folder - uses: actions/cache@v3 - with: - path: build - key: ${{ github.workflow }}-v1-${{ github.sha }} - restore-keys: ${{ github.workflow }}-v1- - - - name: Configure CMake - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - working-directory: ${{github.workspace}} - run: cmake -S. -Bbuild -DBUILD_TESTING=OFF -DMACOSX_STANDALONE_APP_BUNDLE=ON -DDISCORD_INTEGRATION=ON - - - name: Build - working-directory: ${{github.workspace}} - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: cmake --build build -j $(sysctl -n hw.physicalcpu) --target package - - - name: Upload-Package - if: ${{ !env.ACT }} - uses: actions/upload-artifact@v3 - with: - name: devilutionx.dmg - path: ${{github.workspace}}/build/devilutionx.dmg diff --git a/.github/workflows/iOS.yml b/.github/workflows/iOS.yml index 94cae668c..0eb038749 100644 --- a/.github/workflows/iOS.yml +++ b/.github/workflows/iOS.yml @@ -36,8 +36,8 @@ jobs: uses: actions/cache@v3 with: path: build - key: ${{ github.workflow }}-v1-${{ github.sha }} - restore-keys: ${{ github.workflow }}-v1- + key: ${{ github.workflow }}-v2-${{ github.sha }} + restore-keys: ${{ github.workflow }}-v2- - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable @@ -52,21 +52,23 @@ jobs: run: > cmake --build build -j $(sysctl -n hw.physicalcpu) --config Release && cd build && - rm -rf Payload devilutionx.ipa && mkdir Payload && mv devilutionx.app Payload && - zip -r devilutionx.ipa Payload + zip -r devilutionx-iOS.ipa Payload - name: Upload-Package if: ${{ !env.ACT }} uses: actions/upload-artifact@v3 with: - name: devilutionx.ipa - path: build/devilutionx.ipa + name: devilutionx-iOS.ipa + path: build/devilutionx-iOS.ipa - name: Update Release if: ${{ github.event_name == 'release' && !env.ACT }} uses: svenstaro/upload-release-action@v2 with: - file: build/devilutionx.ipa + file: build/devilutionx-iOS.ipa overwrite: true + + - name: Clean up artifacts + run: rm -rf build/Payload build/*.ipa diff --git a/.github/workflows/macOS_x86_64.yml b/.github/workflows/macOS_x86_64.yml new file mode 100644 index 000000000..0cd0269a8 --- /dev/null +++ b/.github/workflows/macOS_x86_64.yml @@ -0,0 +1,67 @@ +name: macOS x86_64 + +on: + push: + branches: + - master + paths-ignore: + - '*.md' + pull_request: + types: [opened, synchronize] + paths-ignore: + - '*.md' + release: + types: [published] + paths-ignore: + - '*.md' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Create Build Environment + run: brew bundle install + + - name: Cache CMake build folder + uses: actions/cache@v3 + with: + path: build + key: ${{ github.workflow }}-v1-${{ github.sha }} + restore-keys: ${{ github.workflow }}-v1- + + - name: Build + working-directory: ${{github.workspace}} + shell: bash + env: + CMAKE_BUILD_TYPE: ${{github.event_name == 'release' && 'Release' || 'RelWithDebInfo'}} + run: | + cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} -DBUILD_TESTING=OFF \ + -DMACOSX_STANDALONE_APP_BUNDLE=ON -DDISCORD_INTEGRATION=ON && \ + cmake --build build -j $(sysctl -n hw.physicalcpu) --target package && \ + mv build/devilutionx.dmg build/devilutionx-x86_64-macOS.dmg + + - name: Upload-Package + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v3 + with: + name: devilutionx-x86_64-macOS.dmg + path: build/devilutionx-x86_64-macOS.dmg + + - name: Update Release + if: ${{ github.event_name == 'release' && !env.ACT }} + uses: svenstaro/upload-release-action@v2 + with: + file: build/devilutionx-x86_64-macOS.dmg + overwrite: true + + - name: Clean up artifacts + run: rm -rf build/_CPack_Packages build/*.dmg diff --git a/README.md b/README.md index b383b2e96..0211b605b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ If you want to help test the latest development stage of the next version (make [![Linux aarch64](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_aarch64.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_aarch64.yml?query=branch%3Amaster) [![Linux x86](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_x86.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_x86.yml?query=branch%3Amaster) [![Linux x86_64 SDL1](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_x86_64_SDL1.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Linux_x86_64_SDL1.yml?query=branch%3Amaster) -[![MacOSX](https://github.com/diasurgical/devilutionX/actions/workflows/MacOSX.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/MacOSX.yml?query=branch%3Amaster) +[![macOS x86_64](https://github.com/diasurgical/devilutionX/actions/workflows/macOS_x86_64.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/macOS_x86_64.yml?query=branch%3Amaster) [![Windows x64](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MSVC_x64.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MSVC_x64.yml?query=branch%3Amaster) [![Windows MinGW x64](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MinGW_x64.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MinGW_x64.yml?query=branch%3Amaster) [![Windows MinGW x86](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MinGW_x86.yml/badge.svg)](https://github.com/diasurgical/devilutionX/actions/workflows/Windows_MinGW_x86.yml?query=branch%3Amaster)