From 3d882079075d7725d6c16049017149c4f2c0c531 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Fri, 13 Mar 2026 11:09:47 -0500 Subject: [PATCH] Fix macOS CI (#243) * Fix macOS CI * fix switch * Fix readme links --- .github/workflows/mac.yml | 20 ++++------- .github/workflows/main.yml | 62 ++++++++++++++++++++++++++------- .github/workflows/switch.yml | 2 +- Brewfile | 8 +++++ CMakeLists.txt | 14 ++++++++ Info.plist | 5 +++ README.md | 3 +- cmake/configure-packaging.cmake | 2 +- libultraship | 2 +- 9 files changed, 89 insertions(+), 29 deletions(-) create mode 100644 Brewfile diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index f70c52e2..27a0a5ac 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -6,24 +6,18 @@ on: jobs: build: - runs-on: macOS-latest + runs-on: macOS-15 steps: - uses: actions/checkout@v4 with: submodules: recursive + - uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew + key: ${{ runner.os }}-${{ runner.arch }}-homebrew-${{ github.ref }}-${{ github.sha }} - name: Install dependencies - run: brew install sdl2 libpng glew ninja cmake libzip nlohmann-json tinyxml2 spdlog vorbis-tools + run: HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade - name: Build run: | cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release - cmake --build build-cmake -j - - name: Create Package - run: | - mkdir starship-release - mv build-cmake/Starship starship-release/ - - name: Publish packaged artifacts - uses: actions/upload-artifact@v4 - with: - name: starship-mac-x64 - path: starship-release - retention-days: 1 \ No newline at end of file + cmake --build build-cmake -j \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89c2dc2b..2df69ed5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,19 +73,23 @@ jobs: name: starship-windows path: starship-release - build-macos: + build-macos-x64: needs: generate-port-o2r - runs-on: macOS-latest + runs-on: macos-15-intel steps: - uses: actions/checkout@v4 with: submodules: recursive + - uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew + key: ${{ runner.os }}-${{ runner.arch }}-homebrew-${{ github.ref }}-${{ github.sha }} - name: Install dependencies - run: brew install sdl2 libpng glew ninja cmake libzip nlohmann-json tinyxml2 spdlog vorbis-tools + run: HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade - name: Build run: | cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release - cmake --build build-cmake --config Release -j3 + cmake --build build-cmake -j - name: Download starship.o2r uses: actions/download-artifact@v4 with: @@ -93,17 +97,51 @@ jobs: path: ./build-cmake - name: Create Package run: | - mkdir starship-release - mv build-cmake/Starship starship-release/ - mv build-cmake/starship.o2r starship-release/ - mv config.yml starship-release/ - mv assets starship-release/ - curl -o starship-release/gamecontrollerdb.txt -sSL 'https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt' + (cd build-cmake && cpack) + mv _packages/*.dmg Starship.dmg + mv README.md readme.txt - name: Publish packaged artifacts uses: actions/upload-artifact@v4 with: - name: starship-mac-x64 - path: starship-release + name: Starship-mac-x64 + path: | + Starship.dmg + readme.txt + + build-macos-arm64: + needs: generate-port-o2r + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/cache@v4 + with: + path: ~/Library/Caches/Homebrew + key: ${{ runner.os }}-${{ runner.arch }}-homebrew-${{ github.ref }}-${{ github.sha }} + - name: Install dependencies + run: HOMEBREW_NO_AUTO_UPDATE=1 brew bundle --no-upgrade + - name: Build + run: | + cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release + cmake --build build-cmake -j + - name: Download starship.o2r + uses: actions/download-artifact@v4 + with: + name: starship.o2r + path: ./build-cmake + - name: Create Package + run: | + (cd build-cmake && cpack) + mv _packages/*.dmg Starship.dmg + mv README.md readme.txt + - name: Publish packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: Starship-mac-arm64 + path: | + Starship.dmg + readme.txt build-linux: needs: generate-port-o2r diff --git a/.github/workflows/switch.yml b/.github/workflows/switch.yml index 5fe784c3..784bfb05 100644 --- a/.github/workflows/switch.yml +++ b/.github/workflows/switch.yml @@ -25,7 +25,7 @@ jobs: sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake cmake --build build-switch --config Release -j3 - wget -O gamecontrollerdb.txt https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt + wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt mv README.md readme.txt mv build-switch/*.nro Starship.nro - name: Upload build diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..ce9675fa --- /dev/null +++ b/Brewfile @@ -0,0 +1,8 @@ +brew "sdl2" +brew "libpng" +brew "glew" +brew "libzip" +brew "nlohmann-json" +brew "tinyxml2" +brew "spdlog" +brew "vorbis-tools" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d9564403..e7d0e797 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -633,6 +633,9 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/starship.o2r" "${CMAKE_BINARY_DIR}/starship.o2r" ) +find_program(CURL NAMES curl DOC "Path to the curl program. Used to download files.") +execute_process(COMMAND ${CURL} -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt OUTPUT_VARIABLE RESULT) + if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") install(FILES "${CMAKE_BINARY_DIR}/starship.o2r" DESTINATION . COMPONENT ${PROJECT_NAME}) endif() @@ -656,6 +659,17 @@ add_custom_target(CreateOSXIcons ) add_dependencies(${PROJECT_NAME} CreateOSXIcons) configure_file("${CMAKE_SOURCE_DIR}/Info.plist" "${CMAKE_BINARY_DIR}/Info.plist" COPYONLY) + INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ../MacOS COMPONENT Starship) + INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION ../MacOS COMPONENT Starship) + INSTALL(FILES ${CMAKE_BINARY_DIR}/starship.o2r DESTINATION ../Resources COMPONENT Starship) + INSTALL(FILES ${CMAKE_BINARY_DIR}/config.yml DESTINATION ../Resources COMPONENT Starship) + INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/assets/ DESTINATION ../Resources/assets COMPONENT Starship) + + # Fix bundle to include and relink all dependencies + install(CODE " + include(BundleUtilities) + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/../MacOS/Starship\" \"\" \"${dirs}\") + ") endif() set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES) diff --git a/Info.plist b/Info.plist index 39fb6bc1..c0f51ab9 100644 --- a/Info.plist +++ b/Info.plist @@ -33,6 +33,11 @@ public.app-category.games LSMinimumSystemVersion 10.15 + LSEnvironment + + SHIP_HOME + ~/Library/Application Support/com.Starship.Starship + LSArchitecturePriority arm64 diff --git a/README.md b/README.md index 75c9d0b0..f8690383 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,8 @@ If you want to manually compile Starship, please consult the [building instructi If you want to playtest a continuous integration build, you can find them at the links below. Keep in mind that these are for playtesting only, and you will likely encounter bugs and possibly crashes. * [Windows](https://nightly.link/HarbourMasters/Starship/workflows/main/main/starship-windows.zip) -* [macOS](https://nightly.link/HarbourMasters/Starship/workflows/main/main/starship-mac-x64.zip) +* [macOS (Apple Silicon)](https://nightly.link/HarbourMasters/Starship/workflows/main/main/Starship-mac-arm64.zip) +* [macOS (Intel)](https://nightly.link/HarbourMasters/Starship/workflows/main/main/Starship-mac-x64.zip) * [Linux](https://nightly.link/HarbourMasters/Starship/workflows/main/main/Starship-linux.zip) * [Switch](https://nightly.link/HarbourMasters/Starship/workflows/main/main/Starship-switch.zip) diff --git a/cmake/configure-packaging.cmake b/cmake/configure-packaging.cmake index f3d2c115..8fb030b1 100644 --- a/cmake/configure-packaging.cmake +++ b/cmake/configure-packaging.cmake @@ -22,7 +22,7 @@ endif() if (CPACK_GENERATOR MATCHES "Bundle") set(CPACK_BUNDLE_NAME "Starship") - set(CPACK_BUNDLE_PLIST "macosx/Info.plist") + set(CPACK_BUNDLE_PLIST "Info.plist") set(CPACK_BUNDLE_ICON "macosx/Starship.icns") # set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/Starship-macos.sh") set(CPACK_BUNDLE_APPLE_CERT_APP "-") diff --git a/libultraship b/libultraship index 09dfab5f..eaaf9d0f 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 09dfab5fb2a9a047a6e268dc9db2daad9b2ce5f0 +Subproject commit eaaf9d0fc91e2c400f49ef2a1f8547a691ce4d3c