Skip to content

Add: add macos packaging, build for multiple games #1

Add: add macos packaging, build for multiple games

Add: add macos packaging, build for multiple games #1

Workflow file for this run

name: Build MudletBootstrap
on:
push:
branches: [master]
pull_request:
jobs:
compile:
name: ${{matrix.buildname}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
buildname: 'Linux'
triplet: x64-linux
compiler: clang_64
qt: '6.8.1'
- os: macos-13
buildname: 'macOS'
triplet: x64-osx
compiler: clang_64
qt: '6.8.1'
- os: windows-2019
buildname: 'Windows'
qt: '6.8.1'
steps:
#- name: Maximize build space
# if: runner.os == 'Linux'
# uses: easimon/maximize-build-space@master
# with:
# swap-size-mb: 1024
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
# remove-docker-images: 'true'
#- name: Check Free Space
# if: runner.os == 'macOS'
# run: |
# echo "Free space:"
# df -h
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Qt
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: jurplel/install-qt-action@v4
with:
version: ${{matrix.qt}}
dir: ${{runner.workspace}}
cache: true
- name: Use CMake 3.30.3
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: lukka/get-cmake@v3.30.3
- name: (macOS) Install dependencies
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
QT_VERSION: ${{ matrix.qt }}
run: |
# dependencies needed for vcpkg specifically.
BREWS=("automake" "autoconf" "pkg-config" "ccache")
# Loop through each brew package
for brew in "${BREWS[@]}"; do
if ! brew list --formula "${brew}" &>/dev/null; then
echo "Installing ${brew}..."
brew install "$brew"
else
echo "${brew} is already installed."
fi
done
# Set these here so that vcpkg can use them.
# Use latest available XCode
echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
- name: (Linux) Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ccache pkg-config
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
- name: (Windows) Setup MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
- name: (Windows) Build Environment Setup
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
$GITHUB_WORKSPACE/CI/setup-win-sdk.sh
echo "QT_ROOT=${{runner.workspace}}/qt-static-install" >> $GITHUB_ENV
- name: Restore Qt cache
if: runner.os == 'Windows'
id: restore-qt
uses: actions/cache/restore@v4
with:
path: ${{env.QT_ROOT}}
key: qt
- name: (Windows) Compile Qt
if: runner.os == 'Windows' && steps.restore-qt.outputs.cache-hit != 'true'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/compile-qt-win.sh
#- name: (Linux) Compile Qt
# if: runner.os == 'Linux' && steps.restore-qt.outputs.cache-hit != 'true'
# run: |
# chmod +x ${GITHUB_WORKSPACE}/CI/compile-qt-linux.sh
# ${GITHUB_WORKSPACE}/CI/compile-qt-linux.sh
#- name: (macOS) Compile Qt
# if: runner.os == 'macOS' && steps.restore-qt.outputs.cache-hit != 'true'
# run: |
# chmod +x ${GITHUB_WORKSPACE}/CI/compile-qt-mac.sh
# ${GITHUB_WORKSPACE}/CI/compile-qt-mac.sh
- name: Save Qt cache
if: runner.os == 'Windows' && steps.restore-qt.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{env.QT_ROOT}}
key: ${{ steps.restore-qt.outputs.cache-primary-key }}
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v4
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.buildname}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.buildname}}
- name: check ccache stats prior to build
if: runner.os == 'Linux' || runner.os == 'macOS'
run: ccache --zero-stats --show-stats
- name: (Linux, macOS) Build
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{github.workspace}}/build'
cmakeAppendedArgs: >-
-DCMAKE_PREFIX_PATH=${{ env.QT_PREFIX != '' && env.QT_PREFIX || env.MINGW_BASE_DIR }}
- name: (Windows) Build
if: runner.os == 'Windows'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/build-win.sh
- name: Save ccache
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{runner.workspace}}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
- name: check ccache stats post build
if: runner.os == 'Linux' || runner.os == 'macOS'
run: ccache --show-stats
- name: (Windows) Package
if: runner.os == 'Windows'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/package-win.sh
- name: (Windows) Deploy
if: runner.os == 'Windows'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/deploy-win.sh
- name: (macOS) Package
if: runner.os == 'macOS'
env:
BUILD_DIR: ${{runner.workspace}}/build
run: |
chmod +x $GITHUB_WORKSPACE/CI/package-mac.sh
$GITHUB_WORKSPACE/CI/package-mac.sh
- name: (Linux) Deploy
if: runner.os == 'Linux'
env:
BUILD_DIR: ${{runner.workspace}}/build
run: |
chmod +x $GITHUB_WORKSPACE/CI/package-linux.sh
$GITHUB_WORKSPACE/CI/package-linux.sh
- name: Upload Packaged Product
uses: actions/upload-artifact@v4
if: env.UPLOAD_FILENAME
with:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}