MacOS CI (hopefully)

This commit is contained in:
liuk7071 2023-07-29 16:53:03 +02:00
parent bfe582e3a2
commit a76a6608b3
3 changed files with 95 additions and 0 deletions

43
.github/macos-bundle.sh vendored Normal file
View file

@ -0,0 +1,43 @@
# Taken from pcsx-redux create-app-bundle.sh
# For Plist buddy
PATH="$PATH:/usr/libexec"
# Construct the app iconset.
mkdir ChonkyStation.iconset
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 16x16 ChonkyStation.iconset/icon_16x16.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 32x32 ChonkyStation.iconset/icon_16x16@2x.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 32x32 ChonkyStation.iconset/icon_32x32.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 64x64 ChonkyStation.iconset/icon_32x32@2x.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 128x128 ChonkyStation.iconset/icon_128x128.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 256x256 ChonkyStation.iconset/icon_128x128@2x.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 256x256 ChonkyStation.iconset/icon_256x256.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 512x512 ChonkyStation.iconset/icon_256x256@2x.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 72 -resize 512x512 ChonkyStation.iconset/icon_512x512.png
convert docs/img/icon.ico -alpha on -background none -units PixelsPerInch -density 144 -resize 1024x1024 ChonkyStation.iconset/icon_512x512@2x.png
iconutil --convert icns ChonkyStation.iconset
# Set up the .app directory
mkdir -p ChonkyStation.app/Contents/MacOS/Libraries
mkdir ChonkyStation.app/Contents/Resources
# Copy binary into App
cp ./build/ChonkyStation ChonkyStation.app/Contents/MacOS/ChonkyStation
chmod a+x ChonkyStation.app/Contents/Macos/ChonkyStation
# Copy icons into App
cp ChonkyStation.icns ChonkyStation.app/Contents/Resources/AppIcon.icns
# Fix up Plist stuff
PlistBuddy ChonkyStation.app/Contents/Info.plist -c "add CFBundleDisplayName string ChonkyStation"
PlistBuddy ChonkyStation.app/Contents/Info.plist -c "add CFBundleIconName string AppIcon"
PlistBuddy ChonkyStation.app/Contents/Info.plist -c "add CFBundleIconFile string AppIcon"
PlistBuddy ChonkyStation.app/Contents/Info.plist -c "add NSHighResolutionCapable bool true"
PlistBuddy ChonkyStation.app/Contents/version.plist -c "add ProjectName string ChonkyStation"
# Bundle dylibs
dylibbundler -od -b -x ChonkyStation.app/Contents/MacOS/ChonkyStation -d ChonkyStation.app/Contents/Frameworks/
# relative rpath
install_name_tool -add_rpath @loader_path/../Frameworks ChonkyStation.app/Contents/MacOS/ChonkyStation

52
.github/workflows/macos_build.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Linux Build
on:
push:
branches: [ "rewrite" ]
pull_request:
branches: [ "rewrite" ]
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
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Thanks to Panda3DS for the bundling stuff below
- name: Install bundle dependencies
run: brew install dylibbundler imagemagick
- name: Run bundle script
run: ./.github/macos-bundle.sh
- name: Sign the App
run: codesign --force -s - -vvvv ChonkyStation.app
- name: Zip it up
run: zip -r ChonkyStation ChonkyStation.app
- name: Upload MacOS App
uses: actions/upload-artifact@v2
with:
name: MacOS App Bundle
path: 'ChonkyStation.zip'

BIN
docs/img/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB