Compiling HISE with GitHub Actions
-
After a hilariously long (2h35m) compile on my 2020 M1 MacBook Air I decided to try compiling HISE using GitHub Actions.
It works fine. It takes 10-15 mins but at least it 100% reliable (compiling on my MacBook would sometimes crash the whole machine) and doesn't freeze my computer while it's working.
The only strange thing is, the compiled app is about twice the size of a locally compiled app.
HISE compiled on MacBook = 194MB
HISE compiled on GitHub = 385MBEDIT Both are debug versions. MacBook version built with Xcode Product > Build For > Running. GitHub version built with Debug configuration flag. /EDIT
What's the reason for this? And is it any thing to worry about?
EDIT - [SOLVED] The reason for the double size app is that the GitHub version is building a universal binary, whereas on my Mac I'm building only for 'My Mac' (only Apple Silicon). /EDIT
Here are my workflow files and bash files, both adapted from the original HISE files.
// .github/workflows/build_mac.yml name: Build Mac on: workflow_dispatch: push: branches: - develop jobs: build_mac: runs-on: macos-latest steps: - name: Check Xcode version run: | xcodebuild -version xcode-select -p - name: Checkout HISE repository uses: actions/checkout@v4 with: ref: 'develop' - name: Build & Upload HISE Debug.app working-directory: ${{ github.workspace }}/tools/auto_build/ run: sh ./build_mac.sh - name: Upload HISE Debug.app uses: actions/upload-artifact@v4 with: name: "HISE Debug.app" path: "${{ github.workspace }}/projects/standalone/Builds/MacOSX/build/Debug/HISE Debug.app"
// tools/auto_build/build_mac.sh #!/bin/bash set -e cd "$(dirname "$0")" cd ../.. standalone_folder="projects/standalone" chmod +x "tools/Projucer/Projucer.app/Contents/MacOS/Projucer" "tools/Projucer/Projucer.app/Contents/MacOS/Projucer" --resave "projects/standalone/HISE Standalone.jucer" echo "Compiling Standalone App..." xcodebuild -project "$standalone_folder/Builds/MacOSX/HISE Standalone.xcodeproj" -configuration Debug | xcpretty echo "Build completed successfully" # Check if the app exists at the right path app_path="projects/standalone/Builds/MacOSX/build/Debug/HISE Debug.app" if [ -d "$app_path" ]; then echo "HISE Debug.app is ready for upload at $app_path" else echo "Error: Built app not found" exit 1 fi
-
@dannytaurus you've built the debug version which contains extra data
-
@Dan-Korneff said in Compiling HISE with GitHub Actions:
@dannytaurus you've built the debug version which contains extra data
Sorry, I should've been more clear - it was the debug version for both.
Edited the original post
-
@dannytaurus maybe the github action built a universal binary?
-
@Christoph-Hart said in Compiling HISE with GitHub Actions:
@dannytaurus maybe the github action built a universal binary?
Ah, that's probably it! My Xcode is set up to build for 'My Mac' and not 'Any Mac'.
Nothing to worry about then!
-
@dannytaurus but
- why do you build the debug build?
- Does compiling a plugin also takes hours on your MacBook?
-
@Christoph-Hart said in Compiling HISE with GitHub Actions:
@dannytaurus but
- why do you build the debug build?
- Does compiling a plugin also takes hours on your MacBook?
- Because I was told it was quicker to build.
- No, exporting an AU plugin from the HISE Export menu takes a few minutes (if that's what you mean)
To be fair I haven't tried a release build on my MacBook but I can't imagine it would be quicker. Still worth a try though.
-
@dannytaurus said in Compiling HISE with GitHub Actions:
After a hilariously long (2h35m) compile on my 2020 M1 MacBook Air
Very strange, it takes about 5min with my M3, and even my ol' 2013 intel iMac took around 25-30min
-
@ustk said in Compiling HISE with GitHub Actions:
Very strange, it takes about 5min with my M3, and even my ol' 2013 intel iMac took around 25-30min
How much RAM does each machine have?
I only have 8GB RAM, which I think is a limiting factor.
In Activity Monitor it's maxed out in the red during compilation.
However, I ran couple of tests in Safe Mode and compilation time was around 15 mins so even if RAM is limiting there is definitely still something running in my normal setup that causes these crazy long compile times.
I will continue to investigate but for now I'm happy to compile on GitHub and download the app.
-
@Christoph-Hart said in Compiling HISE with GitHub Actions:
@dannytaurus maybe the github action built a universal binary?
Bingo! That was it.
I changed the build script to build arm64 only and now the downloaded app is the same size as locally compiled app.
Interestingly the build time didn't decrease that much on GitHub - 13 mins down to 11 mins, but I'll take it!
-
@dannytaurus said in Compiling HISE with GitHub Actions:
I only have 8GB RAM, which I think is a limiting factor.
Try reducing the number of threads/jobs you're using to build, try no more than 1 thread per GB of RAM.
-
@d-healey said in Compiling HISE with GitHub Actions:
Try reducing the number of threads/jobs you're using to build, try no more than 1 thread per GB of RAM.
There are 8 clang threads running but combined they're using about 12GB RAM, causing a lot of swap.
I could try with fewer threads.
-
@dannytaurus said in Compiling HISE with GitHub Actions:
I could try with fewer threads.
Try 6 or 4 - this will free up RAM which might help, but using fewer threads might negate the gains.
-
@d-healey I donβt think you can set the thread count on macOS this is a Linux only feature of GCC.
-
@Christoph-Hart said in Compiling HISE with GitHub Actions:
I donβt think you can set the thread count on macOS this is a Linux only feature of GCC.
You can set it with -jobs -
as you are doing here :)Oops, according to git blame I added that
https://github.com/christophhart/HISE/blob/develop/hi_backend/backend/CompileExporter.cpp#L2584
-
@d-healey said in Compiling HISE with GitHub Actions:
Try 6 or 4 - this will free up RAM which might help, but using fewer threads might negate the gains.
Yes, will do. I'm trying compiling with the script first, since you can't set jobs in the Xcode UI anyway.
First I'll see how the script build compares to the Xcode UI build. Should be the same I'm guessing.
Then I'll reduce the threads in the script to see what effect that has.