From b5749097f1f728ed13f1be169aa16e1591e1cb46 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 19 Mar 2024 13:18:43 +0100 Subject: [PATCH] refactor: build MAS after darwin --- .github/workflows/config/move_artifacts.sh | 6 ++ .github/workflows/macos-build.yml | 98 +++++++++++++++------- 2 files changed, 73 insertions(+), 31 deletions(-) diff --git a/.github/workflows/config/move_artifacts.sh b/.github/workflows/config/move_artifacts.sh index e00f2dfb4b5d6..5502e4acf3d98 100755 --- a/.github/workflows/config/move_artifacts.sh +++ b/.github/workflows/config/move_artifacts.sh @@ -2,6 +2,12 @@ set -eo pipefail +if [ -z "$MAS_BUILD" ]; then + BUILD_TYPE="darwin" +else + BUILD_TYPE="mas" +fi + rm -rf generated_artifacts_${BUILD_TYPE} mkdir generated_artifacts_${BUILD_TYPE} diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 5697d03c65e82..fa305e9fe3a1c 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -142,12 +142,6 @@ jobs: build: runs-on: macos-13-xlarge needs: checkout - strategy: - fail-fast: false - matrix: - build-type: [darwin, mas] - env: - BUILD_TYPE: ${{ matrix.build-type }} steps: - name: Load Build Tools run: | @@ -308,13 +302,7 @@ jobs: echo 'RBE_service='`node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"` >> $GITHUB_ENV echo 'RBE_experimental_credentials_helper='`node -e "console.log(require('./src/utils/reclient.js').helperPath({}))"` >> $GITHUB_ENV echo 'RBE_experimental_credentials_helper_args=print' >> $GITHUB_ENV - - name: Create MAS Config - if: ${{ matrix.build-type }} == 'mas' - run: | - mv src/electron/.github/workflows/config/evm.mas.json $HOME/.electron_build_tools/configs/evm.mas.json - echo "MAS_BUILD=true" >> $GITHUB_ENV - e use mas - - name: Build Electron + - name: Build Electron (darwin) run: | cd src/electron # TODO(codebytere): remove this once we figure out why .git/packed-refs is initially missing @@ -326,22 +314,14 @@ jobs: NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES cp out/Default/.ninja_log out/electron_ninja_log node electron/script/check-symlinks.js - - name: Build Electron dist.zip + - name: Build Electron dist.zip (darwin) run: | cd src - if [ "$SKIP_DIST_ZIP" != "1" ]; then - if [ "$IS_RELEASE"]; then - ADDITIONAL_TARGETS = "electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip" - fi - e build electron:electron_dist_zip $ADDITIONAL_TARGETS -j $NUMBER_OF_NINJA_PROCESSES - if [ "$CHECK_DIST_MANIFEST" == "1" ]; then - target_os=mac - target_cpu=arm64 - if [ "${{ matrix.build-type }}" == "mas" ]; then - target_os=mac_mas - fi - electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest - fi + e build electron:electron_dist_zip $ADDITIONAL_TARGETS -j $NUMBER_OF_NINJA_PROCESSES + if [ "$CHECK_DIST_MANIFEST" == "1" ]; then + target_os=mac + target_cpu=arm64 + electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest fi - name: Build Mksnapshot run: | @@ -380,12 +360,12 @@ jobs: # The current generated_artifacts_<< artifact.key >> name was taken from CircleCI # tp ensure we don't break anything, but we may be able to improve that. - name: Move all Generated Artifacts to Upload Folder - run: ./src/electron/script/move-artifacts.sh + run: ./src/electron/.github/workflows/config/move_artifacts.sh - name: Upload Generated Artifacts uses: actions/upload-artifact@v4 with: - name: generated_artifacts_${{ matrix.build-type }} - path: ./generated_artifacts_${{ matrix.build-type }} + name: generated_artifacts_darwin + path: ./generated_artifacts_darwin - name: Persist Build Artifacts uses: actions/cache/save@v4 with: @@ -405,7 +385,63 @@ jobs: src/third_party/libc++abi src/out/Default/obj/buildtools/third_party src/v8/tools/builtins-pgo - key: ${{ runner.os }}-build-artifacts-${{ matrix.build-type }}-${{ github.sha }} + key: ${{ runner.os }}-build-artifacts-darwin-${{ github.sha }} + - name: Create MAS Config + run: | + mv src/electron/.github/workflows/config/evm.mas.json $HOME/.electron_build_tools/configs/evm.mas.json + echo "MAS_BUILD=true" >> $GITHUB_ENV + e use mas + - name: Build Electron (mas) + run: | + rm -rf "src/out/Default/Electron Framework.framework" + rm -rf src/out/Default/Electron*.app + + cd src/electron + # TODO(codebytere): remove this once we figure out why .git/packed-refs is initially missing + git pack-refs + cd .. + + ulimit -n 10000 + sudo launchctl limit maxfiles 65536 200000 + NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES + cp out/Default/.ninja_log out/electron_ninja_log + node electron/script/check-symlinks.js + - name: Build Electron dist.zip (mas) + run: | + cd src + e build electron:electron_dist_zip $ADDITIONAL_TARGETS -j $NUMBER_OF_NINJA_PROCESSES + if [ "$CHECK_DIST_MANIFEST" == "1" ]; then + target_os=mac_mas + target_cpu=arm64 + electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest + fi + - name: Move all Generated Artifacts to Upload Folder + run: ./src/electron/.github/workflows/config/move_artifacts.sh + - name: Upload Generated Artifacts + uses: actions/upload-artifact@v4 + with: + name: generated_artifacts_mas + path: ./generated_artifacts_mas + - name: Persist Build Artifacts + uses: actions/cache/save@v4 + with: + path: | + src/out/Default/gen/node_headers + src/out/Default/overlapped-checker + src/electron + src/third_party/electron_node + src/third_party/nan + src/cross-arch-snapshots + src/third_party/llvm-build + src/build/linux + src/buildtools/mac + src/buildtools/third_party/libc++ + src/buildtools/third_party/libc++abi + src/third_party/libc++ + src/third_party/libc++abi + src/out/Default/obj/buildtools/third_party + src/v8/tools/builtins-pgo + key: ${{ runner.os }}-build-artifacts-mas-${{ github.sha }} test: runs-on: macos-13-xlarge needs: build