name: Build emu variant (macos) on: workflow_call: inputs: emu-variant: description: | Which variant of the emu to build: regular: build the regular version of the emu exp: build the experimental version of the emu tools: build the tools only required: true type: string debug: description: | build mode true: build in debug mode false: build in release mode required: true type: boolean permissions: contents: write env: DEPS_CACHE_KEY: emu-deps-macos DEPS_CACHE_DIR: build/deps/macos PACKAGE_BASE_DIR: "build/package/macos" THIRD_PARTY_BASE_DIR: 'third-party' jobs: build: runs-on: macos-13 if: ${{ !cancelled() }} steps: ### setup build vars - name: Setup build vars shell: bash run: | echo "env file = '$GITHUB_ENV'" echo "workspace = '${{ github.workspace }}'" build_switches="" if [[ "${{ inputs.emu-variant }}" = "regular" ]]; then build_switches="+lib-64 +client-64" elif [[ "${{ inputs.emu-variant }}" = "exp" ]]; then build_switches="+exp-lib-64 +exp-client-64" elif [[ "${{ inputs.emu-variant }}" = "tools" ]]; then build_switches="+tool-clientldr +tool-itf-64 +tool-lobby-64" else echo "[X] invalid emu variant '${{ inputs.emu-variant }}'" >&2 exit 1 fi echo "build_switches=$build_switches" >>"$GITHUB_ENV" build_mode="" if [[ "${{ inputs.debug }}" = "true" ]]; then build_mode="debug" else build_mode="release" fi echo "build_mode=$build_mode" >>"$GITHUB_ENV" - name: Checkout branch uses: actions/checkout@v4 ### deps - name: Restore deps id: emu-deps-cache-step uses: actions/cache@v4 with: key: ${{ env.DEPS_CACHE_KEY }} path: ${{ env.DEPS_CACHE_DIR }} ### macos comes with bash v3 - name: Update bash shell: bash run: brew update && brew install bash ## mandatory macos packages, installed via sudo apt install ... - name: Install required packages shell: bash run: sudo chmod 777 build_macos_deps.sh && ./build_macos_deps.sh -verbose -packages_only ## extra helpers/tools, these are not built inside the deps build dir - name: Clone third-party build helpers (build/macos) uses: actions/checkout@v4 with: ref: 'third-party/build/macos' path: "${{env.THIRD_PARTY_BASE_DIR}}/build/macos" ### fix folder permissions! not sure why this fails # nested subdirs "build/macos/release" cause permission problems - name: Give all permissions to repo folder shell: bash working-directory: ${{ github.workspace }} run: sudo chmod -R 777 "${{ github.workspace }}" ### build target(s) - name: Build target(s) shell: bash working-directory: ${{ github.workspace }} run: "sudo chmod 777 build_macos.sh && ./build_macos.sh -j 3 -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }}" ### upload artifact/package to github Actions (for targets) - name: Upload build package (for targets) uses: actions/upload-artifact@v4 with: name: "emu-macos-${{ inputs.emu-variant }}-64-${{ env.build_mode }}-${{ github.sha }}" path: "build/macos/" if-no-files-found: 'error' compression-level: 9 retention-days: 1