ci: Merge standalone macOS CI/CD jobs into single runner

This commit is contained in:
OpenSauce04 2026-03-28 13:12:55 +00:00 committed by OpenSauce
parent 60661c3b8b
commit 39363cd435
4 changed files with 60 additions and 84 deletions

View file

@ -2,13 +2,14 @@
ARTIFACTS_LIST=($ARTIFACTS) ARTIFACTS_LIST=($ARTIFACTS)
BUNDLE_DIR=build/bundle BUILD_DIR=build
mkdir build UNIVERSAL_DIR=$BUILD_DIR/universal
BUNDLE_DIR=$UNIVERSAL_DIR/bundle
OTHER_BUNDLE_DIR=$BUILD_DIR/x86_64/bundle
# Set up the base artifact to combine into. # Set up the base bundle to combine into.
BASE_ARTIFACT=${ARTIFACTS_LIST[0]} mkdir $UNIVERSAL_DIR
BASE_ARTIFACT_ARCH="${BASE_ARTIFACT##*-}" cp -a $BUILD_DIR/arm64/bundle $UNIVERSAL_DIR
mv $BASE_ARTIFACT $BUNDLE_DIR
# Executable binary paths that need to be combined. # Executable binary paths that need to be combined.
BIN_PATHS=(Azahar.app/Contents/MacOS/azahar) BIN_PATHS=(Azahar.app/Contents/MacOS/azahar)
@ -19,22 +20,19 @@ DYLIB_PATHS=($(cd $BUNDLE_DIR && find . -name '*.dylib'))
unset IFS unset IFS
# Combine all of the executable binaries and dylibs. # Combine all of the executable binaries and dylibs.
for OTHER_ARTIFACT in "${ARTIFACTS_LIST[@]:1}"; do
OTHER_ARTIFACT_ARCH="${OTHER_ARTIFACT##*-}"
for BIN_PATH in "${BIN_PATHS[@]}"; do for BIN_PATH in "${BIN_PATHS[@]}"; do
lipo -create -output $BUNDLE_DIR/$BIN_PATH $BUNDLE_DIR/$BIN_PATH $OTHER_ARTIFACT/$BIN_PATH lipo -create -output $BUNDLE_DIR/$BIN_PATH $BUNDLE_DIR/$BIN_PATH $OTHER_BUNDLE_DIR/$BIN_PATH
done done
for DYLIB_PATH in "${DYLIB_PATHS[@]}"; do for DYLIB_PATH in "${DYLIB_PATHS[@]}"; do
# Only merge if the libraries do not have conflicting arches, otherwise it will fail. # Only merge if the libraries do not have conflicting arches, otherwise it will fail.
DYLIB_INFO=`file $BUNDLE_DIR/$DYLIB_PATH` DYLIB_INFO=`file $BUNDLE_DIR/$DYLIB_PATH`
OTHER_DYLIB_INFO=`file $OTHER_ARTIFACT/$DYLIB_PATH`
if ! [[ "$DYLIB_INFO" =~ "$OTHER_ARTIFACT_ARCH" ]] && ! [[ "$OTHER_DYLIB_INFO" =~ "$BASE_ARTIFACT_ARCH" ]]; then OTHER_DYLIB_INFO=`file $OTHER_BUNDLE_DIR/$DYLIB_PATH`
lipo -create -output $BUNDLE_DIR/$DYLIB_PATH $BUNDLE_DIR/$DYLIB_PATH $OTHER_ARTIFACT/$DYLIB_PATH if ! [[ "$DYLIB_INFO" =~ "x86_64" ]] && ! [[ "$OTHER_DYLIB_INFO" =~ "arm64" ]]; then
lipo -create -output $BUNDLE_DIR/$DYLIB_PATH $BUNDLE_DIR/$DYLIB_PATH $OTHER_BUNDLE_DIR/$DYLIB_PATH
fi fi
done done
done
# Remove leftover libs so that they aren't distributed # Remove leftover libs so that they aren't distributed
rm -rf "${BUNDLE_DIR}/libs" rm -rf "${BUNDLE_DIR}/libs"

View file

@ -4,12 +4,10 @@ if [ "$GITHUB_REF_TYPE" == "tag" ]; then
export EXTRA_CMAKE_FLAGS=(-DENABLE_QT_UPDATE_CHECKER=ON) export EXTRA_CMAKE_FLAGS=(-DENABLE_QT_UPDATE_CHECKER=ON)
fi fi
mkdir build && cd build mkdir -p build/$BUILD_ARCH && cd build/$BUILD_ARCH
cmake .. -GNinja \ cmake ../.. -GNinja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="$TARGET" \ -DCMAKE_OSX_ARCHITECTURES="$BUILD_ARCH" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_QT_TRANSLATION=ON \ -DENABLE_QT_TRANSLATION=ON \
-DENABLE_ROOM_STANDALONE=OFF \ -DENABLE_ROOM_STANDALONE=OFF \
-DUSE_DISCORD_PRESENCE=ON \ -DUSE_DISCORD_PRESENCE=ON \
@ -18,9 +16,8 @@ ninja
ninja bundle ninja bundle
mv ./bundle/azahar.app ./bundle/Azahar.app # TODO: Can this be done in CMake? mv ./bundle/azahar.app ./bundle/Azahar.app # TODO: Can this be done in CMake?
ccache -s -v
CURRENT_ARCH=`arch` CURRENT_ARCH=`arch`
if [ "$TARGET" = "$CURRENT_ARCH" ]; then if [ "$BUILD_ARCH" = "$CURRENT_ARCH" ]; then
ctest -VV -C Release ctest -VV -C Release
fi fi

View file

@ -3,6 +3,11 @@
# Determine the full revision name. # Determine the full revision name.
GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`"
GITREV="`git show -s --format='%h'`" GITREV="`git show -s --format='%h'`"
# Archive and upload the artifacts.
mkdir -p artifacts
function pack_artifacts() {
REV_NAME="azahar-$OS-$TARGET-$GITDATE-$GITREV" REV_NAME="azahar-$OS-$TARGET-$GITDATE-$GITREV"
# Determine the name of the release being built. # Determine the name of the release being built.
@ -13,10 +18,6 @@ else
RELEASE_NAME=azahar-head RELEASE_NAME=azahar-head
fi fi
# Archive and upload the artifacts.
mkdir -p artifacts
function pack_artifacts() {
ARTIFACTS_PATH="$1" ARTIFACTS_PATH="$1"
# Set up root directory for archive. # Set up root directory for archive.
@ -56,11 +57,23 @@ if [ -n "$UNPACKED" ]; then
FILENAME=$(basename "$ARTIFACT") FILENAME=$(basename "$ARTIFACT")
EXTENSION="${FILENAME##*.}" EXTENSION="${FILENAME##*.}"
# TODO: Deduplicate
REV_NAME="azahar-$OS-$TARGET-$GITDATE-$GITREV"
# Determine the name of the release being built.
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
RELEASE_NAME=azahar-$GITHUB_REF_NAME
REV_NAME="azahar-$OS-$TARGET-$GITHUB_REF_NAME"
else
RELEASE_NAME=azahar-head
fi
mv "$ARTIFACT" "artifacts/$REV_NAME.$EXTENSION" mv "$ARTIFACT" "artifacts/$REV_NAME.$EXTENSION"
done done
elif [ -n "$PACK_INDIVIDUALLY" ]; then elif [ -n "$PACK_INDIVIDUALLY" ]; then
# Pack and upload the artifacts one-by-one. # Pack and upload the artifacts one-by-one.
for ARTIFACT in build/bundle/*; do for ARTIFACT in build/bundle/*; do
TARGET=$(basename "$ARTIFACT")
pack_artifacts "$ARTIFACT" pack_artifacts "$ARTIFACT"
done done
else else

View file

@ -101,17 +101,12 @@ jobs:
run: ./.ci/linux.sh run: ./.ci/linux.sh
macos: macos:
runs-on: ${{ (matrix.target == 'x86_64' && 'macos-26-intel') || 'macos-26' }} runs-on: 'macos-26'
strategy:
fail-fast: false
matrix:
target: ["x86_64", "arm64"]
env: env:
CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content CCACHE_COMPILERCHECK: content
CCACHE_SLOPPINESS: time_macros CCACHE_SLOPPINESS: time_macros
OS: macos OS: macos
TARGET: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -120,58 +115,31 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ${{ env.CCACHE_DIR }} path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} key: ${{ runner.os }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ matrix.target }}- ${{ runner.os }}-
- name: Install tools - name: Install tools
run: brew install ccache ninja spirv-tools run: brew install ccache ninja spirv-tools
- name: Build - name: Build (x86_64)
run: ./.ci/macos.sh run: BUILD_ARCH=x86_64 ./.ci/macos.sh
- name: Prepare outputs for caching - name: Build (arm64)
run: cp -R build/bundle $OS-$TARGET run: BUILD_ARCH=arm64 ./.ci/macos.sh
- name: Cache outputs for universal build
uses: actions/cache/save@v4
with:
path: ${{ env.OS }}-${{ env.TARGET }}
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Pack
run: ./.ci/pack.sh
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.OS }}-${{ env.TARGET }}
path: artifacts/
macos-universal:
runs-on: macos-26
needs: macos
env:
OS: macos
TARGET: universal
steps:
- uses: actions/checkout@v4
- name: Download x86_64 build from cache
uses: actions/cache/restore@v4
with:
path: ${{ env.OS }}-x86_64
key: ${{ runner.os }}-x86_64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Download ARM64 build from cache
uses: actions/cache/restore@v4
with:
path: ${{ env.OS }}-arm64
key: ${{ runner.os }}-arm64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true
- name: Create universal app - name: Create universal app
run: ./.ci/macos-universal.sh run: ./.ci/macos-universal.sh
env: - name: Prepare for packing
ARTIFACTS: ${{ env.OS }}-x86_64 ${{ env.OS }}-arm64 run: |
mkdir build/bundle
cp -r build/x86_64/bundle build/bundle/x86_64
cp -r build/arm64/bundle build/bundle/arm64
cp -r build/universal/bundle build/bundle/universal
- name: Pack - name: Pack
env:
PACK_INDIVIDUALLY: 1
run: ./.ci/pack.sh run: ./.ci/pack.sh
- name: Upload - name: Upload
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ env.OS }}-${{ env.TARGET }} name: ${{ env.OS }}
path: artifacts/ path: artifacts/
windows: windows: