WIP: Parallelize macOS CI builds by splitting arm64 and x86_64 into separate jobs (#12562)

* Parallelize macOS CI builds by splitting arm64 and x86_64 into separate jobs

* fix shell errors

* Delete intermediate per-arch artifacts
This commit is contained in:
SoftFever
2026-03-03 19:29:59 +08:00
committed by GitHub
parent 1f19ff67a3
commit b7033a4c92
5 changed files with 157 additions and 72 deletions

View File

@@ -2,10 +2,10 @@ on:
workflow_call:
inputs:
cache-key:
required: true
required: false
type: string
cache-path:
required: true
required: false
type: string
os:
required: true
@@ -13,6 +13,10 @@ on:
arch:
required: false
type: string
macos-combine-only:
required: false
type: boolean
default: false
jobs:
build_orca:
@@ -31,6 +35,7 @@ jobs:
lfs: 'true'
- name: load cached deps
if: ${{ !(contains(inputs.os, 'macos') && inputs.macos-combine-only) }}
uses: actions/cache@v5
with:
path: ${{ inputs.cache-path }}
@@ -86,16 +91,16 @@ jobs:
# Mac
- name: Install tools mac
if: contains(inputs.os, 'macos')
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
run: |
if [ -z "${{ vars.SELF_HOSTED }}" ]; then
brew install libtool
brew list
fi
mkdir -p ${{ github.workspace }}/deps/build
mkdir -p ${{ github.workspace }}/deps/build/${{ inputs.arch }}
- name: Free disk space
if: contains(inputs.os, 'macos') && !vars.SELF_HOSTED
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only && !vars.SELF_HOSTED
run: |
df -hI /dev/disk3s1s1
sudo find /Applications -maxdepth 1 -type d -name "Xcode_*.app" ! -name "Xcode_15.4.app" -exec rm -rf {} +
@@ -103,14 +108,65 @@ jobs:
df -hI /dev/disk3s1s1
- name: Build slicer mac
if: contains(inputs.os, 'macos')
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -s -n -x ${{ !vars.SELF_HOSTED && '-1' || '' }} -a universal -t 10.15
./build_release_macos.sh -s -n -x ${{ !vars.SELF_HOSTED && '-1' || '' }} -a ${{ inputs.arch }} -t 10.15
- name: Pack macOS app bundle ${{ inputs.arch }}
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
tar -czvf OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}.tar.gz -C build/${{ inputs.arch }} OrcaSlicer
- name: Upload macOS app bundle ${{ inputs.arch }}
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
uses: actions/upload-artifact@v6
with:
name: OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}.tar.gz
- name: Download macOS arm64 app bundle
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: actions/download-artifact@v7
with:
name: OrcaSlicer_Mac_bundle_arm64_${{ github.sha }}
path: ${{ github.workspace }}/mac_bundles/arm64
- name: Download macOS x86_64 app bundle
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: actions/download-artifact@v7
with:
name: OrcaSlicer_Mac_bundle_x86_64_${{ github.sha }}
path: ${{ github.workspace }}/mac_bundles/x86_64
- name: Extract macOS app bundles
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
mkdir -p build/arm64 build/x86_64
arm_bundle=$(find "${{ github.workspace }}/mac_bundles/arm64" -name '*.tar.gz' -print -quit)
x86_bundle=$(find "${{ github.workspace }}/mac_bundles/x86_64" -name '*.tar.gz' -print -quit)
tar -xzvf "$arm_bundle" -C "${{ github.workspace }}/build/arm64"
tar -xzvf "$x86_bundle" -C "${{ github.workspace }}/build/x86_64"
- name: Build universal mac app bundle
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -u -x ${{ !vars.SELF_HOSTED && '-1' || '' }} -a universal -t 10.15
- name: Delete intermediate per-arch artifacts
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: geekyeggo/delete-artifact@v5
with:
name: |
OrcaSlicer_Mac_bundle_arm64_${{ github.sha }}
OrcaSlicer_Mac_bundle_x86_64_${{ github.sha }}
# Thanks to RaySajuuk, it's working now
- name: Sign app and notary
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && contains(inputs.os, 'macos')
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && contains(inputs.os, 'macos') && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
@@ -164,7 +220,7 @@ jobs:
fi
- name: Create DMG without notary
if: github.ref != 'refs/heads/main' && contains(inputs.os, 'macos')
if: github.ref != 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
@@ -183,14 +239,14 @@ jobs:
fi
- name: Upload artifacts mac
if: contains(inputs.os, 'macos')
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: actions/upload-artifact@v6
with:
name: OrcaSlicer_Mac_universal_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
- name: Upload OrcaSlicer_profile_validator DMG mac
if: contains(inputs.os, 'macos')
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: actions/upload-artifact@v6
with:
name: OrcaSlicer_profile_validator_Mac_universal_DMG_${{ env.ver }}
@@ -198,7 +254,7 @@ jobs:
if-no-files-found: ignore
- name: Deploy Mac release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos')
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -209,7 +265,7 @@ jobs:
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Mac OrcaSlicer_profile_validator DMG release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos')
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}