9d6c894e89
* build: update checkout and cache restore for Linux * build: clean up variables * build: temporarily set ref to branch * build: actually check if cache exists or not and correctly store it * build: correct cache paths * build: restore electron_node/deps/v8 * build: restore sha to @main, not branch * build: remove cache_key and use $DEPSHASH * build: remove sas, backup_cache logic * build: revert openssl deletion
718 lines
31 KiB
YAML
718 lines
31 KiB
YAML
name: Build MacOS
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
is-release:
|
|
description: 'Whether this build job is a release job'
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
gn-config:
|
|
description: 'The gn arg configuration to use'
|
|
required: true
|
|
type: string
|
|
default: //electron/build/args/testing.gn
|
|
gn-build-type:
|
|
description: 'The gn build type - testing or release'
|
|
required: true
|
|
type: string
|
|
default: testing
|
|
generate-symbols:
|
|
description: 'Whether or not to generate symbols'
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
upload-to-storage:
|
|
description: 'Whether or not to upload build artifacts to external storage'
|
|
required: true
|
|
type: string
|
|
default: '0'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
AZURE_AKS_CACHE_STORAGE_ACCOUNT: ${{ secrets.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}
|
|
AZURE_AKS_CACHE_SHARE_NAME: ${{ secrets.AZURE_AKS_CACHE_SHARE_NAME }}
|
|
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
|
|
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
|
|
ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
|
|
GN_CONFIG: ${{ inputs.gn-config }}
|
|
# Disable pre-compiled headers to reduce out size - only useful for rebuilds
|
|
GN_BUILDFLAG_ARGS: 'enable_precompiled_headers = false'
|
|
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
|
|
# Only disable this in the Asan build
|
|
CHECK_DIST_MANIFEST: true
|
|
IS_GHA_RELEASE: true
|
|
ELECTRON_OUT_DIR: Default
|
|
|
|
jobs:
|
|
checkout:
|
|
runs-on: aks-linux-large
|
|
container:
|
|
image: ghcr.io/electron/build:latest
|
|
options: --user root
|
|
volumes:
|
|
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
|
|
- /var/run/sas:/var/run/sas
|
|
steps:
|
|
- name: Checkout Electron
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
with:
|
|
path: src/electron
|
|
fetch-depth: 0
|
|
- name: Set GIT_CACHE_PATH to make gclient to use the cache
|
|
run: |
|
|
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
|
|
- name: Install Dependencies
|
|
run: |
|
|
cd src/electron
|
|
node script/yarn install
|
|
- name: Get Depot Tools
|
|
timeout-minutes: 5
|
|
run: |
|
|
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
|
|
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
|
|
cd depot_tools
|
|
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
|
|
# Ensure depot_tools does not update.
|
|
test -d depot_tools && cd depot_tools
|
|
touch .disable_auto_update
|
|
- name: Add Depot Tools to PATH
|
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
|
- name: Generate DEPS Hash
|
|
run: |
|
|
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
|
echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
|
|
- name: Generate SAS Key
|
|
run: |
|
|
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
|
|
- name: Save SAS Key
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
sas-token
|
|
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
|
|
- name: Check If Cache Exists
|
|
id: check-cache
|
|
run: |
|
|
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
|
echo "Using cache key: $DEPSHASH"
|
|
echo "Checking for cache in: $cache_path"
|
|
if [ ! -f "$cache_path" ]; then
|
|
echo "cache_exists=false" >> $GITHUB_OUTPUT
|
|
echo "Cache Does Not Exist for $DEPSHASH"
|
|
else
|
|
echo "cache_exists=true" >> $GITHUB_OUTPUT
|
|
echo "Cache Already Exists for $DEPSHASH, Skipping.."
|
|
fi
|
|
- name: Gclient Sync
|
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
|
run: |
|
|
gclient config \
|
|
--name "src/electron" \
|
|
--unmanaged \
|
|
${GCLIENT_EXTRA_ARGS} \
|
|
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
|
|
|
|
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags -vvvvv
|
|
if [ "${{ inputs.is-release }}" != "true" ]; then
|
|
# Re-export all the patches to check if there were changes.
|
|
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
|
|
cd src/electron
|
|
git update-index --refresh || true
|
|
if ! git diff-index --quiet HEAD --; then
|
|
# There are changes to the patches. Make a git commit with the updated patches
|
|
git add patches
|
|
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
|
|
# Export it
|
|
mkdir -p ../../patches
|
|
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
|
|
if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
|
|
echo
|
|
echo "======================================================================"
|
|
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
|
|
echo "A new CI job will kick off shortly"
|
|
echo "======================================================================"
|
|
exit 1
|
|
else
|
|
echo
|
|
echo "======================================================================"
|
|
echo "There were changes to the patches when applying."
|
|
echo "Check the CI artifacts for a patch you can apply to fix it."
|
|
echo "======================================================================"
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# delete all .git directories under src/ except for
|
|
# third_party/angle/ and third_party/dawn/ because of build time generation of files
|
|
# gen/angle/commit.h depends on third_party/angle/.git/HEAD
|
|
# https://chromium-review.googlesource.com/c/angle/angle/+/2074924
|
|
# and dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
|
|
# https://dawn-review.googlesource.com/c/dawn/+/83901
|
|
# TODO: maybe better to always leave out */.git/HEAD file for all targets ?
|
|
- name: Delete .git directories under src to free space
|
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
|
run: |
|
|
cd src
|
|
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
|
|
- name: Minimize Cache Size for Upload
|
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
|
run: |
|
|
rm -rf src/android_webview
|
|
rm -rf src/ios/chrome
|
|
rm -rf src/third_party/blink/web_tests
|
|
rm -rf src/third_party/blink/perf_tests
|
|
rm -rf src/chrome/test/data/xr/webvr_info
|
|
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
|
|
rm -rf src/third_party/swift-toolchain
|
|
rm -rf src/third_party/swiftshader/tests/regres/testlists
|
|
rm -rf src/electron
|
|
- name: Compress Src Directory
|
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
|
run: |
|
|
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
|
|
tar -cf $DEPSHASH.tar src
|
|
echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
|
|
cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
|
|
- name: Persist Src Cache
|
|
if: steps.check-cache.outputs.cache_exists == 'false'
|
|
run: |
|
|
final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
|
|
echo "Using cache key: $DEPSHASH"
|
|
echo "Checking path: $final_cache_path"
|
|
if [ ! -f "$final_cache_path" ]; then
|
|
echo "Cache key not found"
|
|
exit 1
|
|
else
|
|
echo "Cache key persisted in $final_cache_path"
|
|
fi
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build-arch: [ arm64, x64 ]
|
|
# macos-large is x64, macos-xlarge is arm64
|
|
# More runner information: https://github.com/actions/runner-images/blob/main/README.md#available-images
|
|
runs-on: macos-14-xlarge
|
|
needs: checkout
|
|
env:
|
|
TARGET_ARCH: ${{ matrix.build-arch }}
|
|
steps:
|
|
- name: Load Build Tools
|
|
run: |
|
|
export BUILD_TOOLS_SHA=ef894bc3cfa99d84a3b731252da0f83f500e4032
|
|
npm i -g @electron/build-tools
|
|
e auto-update disable
|
|
e init --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ matrix.build-arch }}
|
|
e use ${{ inputs.gn-build-type }}
|
|
- name: Checkout Electron
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
with:
|
|
path: src/electron
|
|
fetch-depth: 0
|
|
- name: Setup Node.js/npm
|
|
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
|
|
with:
|
|
node-version: 20.11.x
|
|
cache: yarn
|
|
cache-dependency-path: src/electron/yarn.lock
|
|
- name: Install Dependencies
|
|
run: |
|
|
cd src/electron
|
|
node script/yarn install
|
|
brew install azcopy
|
|
- name: Load Target Arch & CPU
|
|
run: |
|
|
echo "target_cpu=${{ matrix.build-arch }}" >> $GITHUB_ENV
|
|
echo "host_cpu=${{ matrix.build-arch }}" >> $GITHUB_ENV
|
|
- name: Get Depot Tools
|
|
timeout-minutes: 5
|
|
run: |
|
|
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
|
|
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
|
|
sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
|
|
# Ensure depot_tools does not update.
|
|
test -d depot_tools && cd depot_tools
|
|
touch .disable_auto_update
|
|
- name: Add Depot Tools to PATH
|
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
|
- name: Generate DEPS Hash
|
|
run: |
|
|
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
|
DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
|
|
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
|
|
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
|
|
- name: Obtain SAS Key
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
sas-token
|
|
key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
|
|
- name: Download Src Cache from AKS
|
|
# The cache will always exist here as a result of the checkout job
|
|
# Either it was uploaded to Azure in the checkout job for this commit
|
|
# or it was uploaded in the checkout job for a previous commit.
|
|
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
|
with:
|
|
timeout_minutes: 20
|
|
max_attempts: 3
|
|
retry_on: error
|
|
command: |
|
|
sas_token=$(cat sas-token)
|
|
azcopy copy \
|
|
"https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
|
|
- name: Clean SAS Key
|
|
run: rm -f sas-token
|
|
- name: Unzip and Ensure Src Cache
|
|
run: |
|
|
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
|
|
mkdir temp-cache
|
|
tar -xf $DEPSHASH.tar -C temp-cache
|
|
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
|
|
|
|
if [ -d "temp-cache/src" ]; then
|
|
echo "Relocating Cache"
|
|
rm -rf src
|
|
mv temp-cache/src src
|
|
|
|
echo "Deleting zip file"
|
|
rm -rf $DEPSHASH.tar
|
|
fi
|
|
|
|
if [ ! -d "src/third_party/blink" ]; then
|
|
echo "Cache was not correctly restored - exiting"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Wiping Electron Directory"
|
|
rm -rf src/electron
|
|
- name: Checkout Electron
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
with:
|
|
path: src/electron
|
|
fetch-depth: 0
|
|
- name: Run Electron Only Hooks
|
|
run: |
|
|
gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
|
|
- name: Regenerate DEPS Hash
|
|
run: |
|
|
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
|
|
echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
|
|
- name: Add CHROMIUM_BUILDTOOLS_PATH to env
|
|
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
|
|
- name: Fix Sync
|
|
# This step is required to correct for differences between "gclient sync"
|
|
# on Linux and the expected state on macOS. This requires:
|
|
# 1. Fixing Clang Install (wrong binary)
|
|
# 2. Fixing esbuild (wrong binary)
|
|
# 3. Fixing rustc (wrong binary)
|
|
# 4. Fixing gn (wrong binary)
|
|
# 5. Fix reclient (wrong binary)
|
|
# 6. Fixing dsymutil (wrong binary)
|
|
# 7. Ensuring we are using the correct ninja and adding it to PATH
|
|
# 8. Fixing angle (wrong remote)
|
|
run : |
|
|
SEDOPTION="-i ''"
|
|
rm -rf src/third_party/llvm-build
|
|
python3 src/tools/clang/scripts/update.py
|
|
|
|
echo 'infra/3pp/tools/esbuild/${platform}' `gclient getdep --deps-file=src/third_party/devtools-frontend/src/DEPS -r 'third_party/esbuild:infra/3pp/tools/esbuild/${platform}'` > esbuild_ensure_file
|
|
# Remove extra output from calling gclient getdep which always calls update_depot_tools
|
|
sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
|
|
cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
|
|
|
|
rm -rf src/third_party/rust-toolchain
|
|
python3 src/tools/rust/update_rust.py
|
|
|
|
# Prevent calling gclient getdep which always calls update_depot_tools
|
|
echo 'gn/gn/mac-${arch}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/mac:gn/gn/mac-${arch}'` > gn_ensure_file
|
|
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
|
|
cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
|
|
|
|
# Prevent calling gclient getdep which always calls update_depot_tools
|
|
echo 'infra/rbe/client/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/reclient:infra/rbe/client/${platform}'` > gn_ensure_file
|
|
sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
|
|
cipd ensure --root src/buildtools/reclient -ensure-file gn_ensure_file
|
|
python3 src/buildtools/reclient_cfgs/configure_reclient_cfgs.py --rbe_instance "projects/rbe-chrome-untrusted/instances/default_instance" --reproxy_cfg_template reproxy.cfg.template --rewrapper_cfg_project "" --skip_remoteexec_cfg_fetch
|
|
|
|
if [ "${{ env.TARGET_ARCH }}" == "arm64" ]; then
|
|
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
|
|
else
|
|
DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
|
|
fi
|
|
python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
|
|
|
|
echo 'infra/3pp/tools/ninja/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/third_party/ninja:infra/3pp/tools/ninja/${platform}'` > ninja_ensure_file
|
|
sed $SEDOPTION "s/Updating depot_tools... //g" ninja_ensure_file
|
|
cipd ensure --root src/third_party/ninja -ensure-file ninja_ensure_file
|
|
|
|
echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
|
|
|
|
cd src/third_party/angle
|
|
rm -f .git/objects/info/alternates
|
|
git remote set-url origin https://chromium.googlesource.com/angle/angle.git
|
|
cp .git/config .git/config.backup
|
|
git remote remove origin
|
|
mv .git/config.backup .git/config
|
|
git fetch
|
|
- name: Install build-tools & Setup RBE
|
|
run: |
|
|
echo "NUMBER_OF_NINJA_PROCESSES=200" >> $GITHUB_ENV
|
|
cd ~/.electron_build_tools
|
|
npx yarn --ignore-engines
|
|
# Pull down credential helper and print status
|
|
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
|
|
HELPER=$(node -p "require('./src/utils/reclient.js').helperPath({})")
|
|
$HELPER login
|
|
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: Free Space on MacOS
|
|
run: |
|
|
sudo mkdir -p $TMPDIR/del-target
|
|
|
|
tmpify() {
|
|
if [ -d "$1" ]; then
|
|
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
|
|
fi
|
|
}
|
|
|
|
strip_universal_deep() {
|
|
opwd=$(pwd)
|
|
cd $1
|
|
f=$(find . -perm +111 -type f)
|
|
for fp in $f
|
|
do
|
|
if [[ $(file "$fp") == *"universal binary"* ]]; then
|
|
if [ "`arch`" == "arm64" ]; then
|
|
if [[ $(file "$fp") == *"x86_64"* ]]; then
|
|
sudo lipo -remove x86_64 "$fp" -o "$fp" || true
|
|
fi
|
|
else
|
|
if [[ $(file "$fp") == *"arm64e)"* ]]; then
|
|
sudo lipo -remove arm64e "$fp" -o "$fp" || true
|
|
fi
|
|
if [[ $(file "$fp") == *"arm64)"* ]]; then
|
|
sudo lipo -remove arm64 "$fp" -o "$fp" || true
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
|
|
cd $opwd
|
|
}
|
|
|
|
tmpify /Library/Developer/CoreSimulator
|
|
tmpify ~/Library/Developer/CoreSimulator
|
|
tmpify $(xcode-select -p)/Platforms/AppleTVOS.platform
|
|
tmpify $(xcode-select -p)/Platforms/iPhoneOS.platform
|
|
tmpify $(xcode-select -p)/Platforms/WatchOS.platform
|
|
tmpify $(xcode-select -p)/Platforms/WatchSimulator.platform
|
|
tmpify $(xcode-select -p)/Platforms/AppleTVSimulator.platform
|
|
tmpify $(xcode-select -p)/Platforms/iPhoneSimulator.platform
|
|
tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/metal/ios
|
|
tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
|
|
tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0
|
|
tmpify ~/.rubies
|
|
tmpify ~/Library/Caches/Homebrew
|
|
tmpify /usr/local/Homebrew
|
|
|
|
# the contents of build/linux/strip_binary.gni aren't used, but
|
|
# https://chromium-review.googlesource.com/c/chromium/src/+/4278307
|
|
# needs the file to exist.
|
|
# mv ~/project/src/build/linux/strip_binary.gni "${TMPDIR}"/
|
|
# tmpify ~/project/src/build/linux/
|
|
# mkdir -p ~/project/src/build/linux
|
|
# mv "${TMPDIR}/strip_binary.gni" ~/project/src/build/linux/
|
|
|
|
sudo rm -rf $TMPDIR/del-target
|
|
|
|
# sudo rm -rf "/System/Library/Desktop Pictures"
|
|
# sudo rm -rf /System/Library/Templates/Data
|
|
# sudo rm -rf /System/Library/Speech/Voices
|
|
# sudo rm -rf "/System/Library/Screen Savers"
|
|
# sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs
|
|
# sudo rm -rf "/System/Volumes/Data/Library/Application Support/Apple/Photos/Print Products"
|
|
# sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/
|
|
# sudo rm -rf /System/Volumes/Data/Library/Java
|
|
# sudo rm -rf /System/Volumes/Data/Library/Ruby
|
|
# sudo rm -rf /System/Volumes/Data/Library/Printers
|
|
# sudo rm -rf /System/iOSSupport
|
|
# sudo rm -rf /System/Applications/*.app
|
|
# sudo rm -rf /System/Applications/Utilities/*.app
|
|
# sudo rm -rf /System/Library/LinguisticData
|
|
# sudo rm -rf /System/Volumes/Data/private/var/db/dyld/*
|
|
# sudo rm -rf /System/Library/Fonts/*
|
|
# sudo rm -rf /System/Library/PreferencePanes
|
|
# sudo rm -rf /System/Library/AssetsV2/*
|
|
sudo rm -rf /Applications/Safari.app
|
|
sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
|
|
sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
|
|
|
|
# lipo off some huge binaries arm64 versions to save space
|
|
strip_universal_deep $(xcode-select -p)/../SharedFrameworks
|
|
# strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
|
|
- name: Build Electron (darwin)
|
|
run: |
|
|
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 (darwin)
|
|
run: |
|
|
cd src
|
|
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
if [ "${{ env.CHECK_DIST_MANIFEST }}" == "true" ]; then
|
|
target_os=mac
|
|
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ env.TARGET_ARCH }}.manifest
|
|
fi
|
|
- name: Build Mksnapshot (darwin)
|
|
run: |
|
|
cd src
|
|
e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
|
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
|
# Remove unused args from mksnapshot_args
|
|
SEDOPTION="-i ''"
|
|
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
|
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
|
sed $SEDOPTION '/The gn arg use_goma=true .*/d' out/Default/mksnapshot_args
|
|
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
|
- name: Build Chromedriver (darwin)
|
|
run: |
|
|
cd src
|
|
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
|
e build electron:electron_chromedriver_zip
|
|
# NOTE (vertedinde): We strip binaries/symbols on the Linux job, not the Mac job
|
|
- name: Generate & Zip Symbols (darwin)
|
|
run: |
|
|
# Generate breakpad symbols on release builds
|
|
if [ "${{ inputs.generate-symbols }}" == "true" ]; then
|
|
e build electron:electron_symbols
|
|
fi
|
|
cd src
|
|
export BUILD_PATH="$(pwd)/out/Default"
|
|
e build electron:licenses
|
|
e build electron:electron_version_file
|
|
if [ "${{ inputs.is-release }}" == "true" ]; then
|
|
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
|
else
|
|
electron/script/zip-symbols.py -b $BUILD_PATH
|
|
fi
|
|
- name: Generate FFMpeg (darwin)
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
cd src
|
|
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
|
|
autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
- name: Generate Hunspell Dictionaries
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
cd src
|
|
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
- name: Generate TypeScript Definitions
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
cd src/electron
|
|
node script/yarn create-typescript-definitions
|
|
# TODO(vertedinde): These uploads currently point to a different Azure bucket & GitHub Repo
|
|
- name: Publish Electron Dist
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
rm -rf src/out/Default/obj
|
|
cd src/electron
|
|
if [ "${{ inputs.upload-to-storage }}" == "1" ]; then
|
|
echo 'Uploading Electron release distribution to Azure'
|
|
script/release/uploaders/upload.py --verbose --upload_to_storage
|
|
else
|
|
echo 'Uploading Electron release distribution to GitHub releases'
|
|
script/release/uploaders/upload.py --verbose
|
|
fi
|
|
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI
|
|
# to 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/actions/move-artifacts.sh
|
|
- name: Upload Generated Artifacts
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
|
|
with:
|
|
name: generated_artifacts_darwin_${{ env.TARGET_ARCH }}
|
|
path: ./generated_artifacts_darwin_${{ env.TARGET_ARCH }}
|
|
- name: Create MAS Config
|
|
run: |
|
|
mv src/electron/.github/workflows/config/${{ inputs.gn-build-type }}/${{ matrix.build-arch }}/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 -j $NUMBER_OF_NINJA_PROCESSES
|
|
if [ "${{ env.CHECK_DIST_MANIFEST }}" == "true" ]; then
|
|
target_os=mac_mas
|
|
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ env.TARGET_ARCH }}.manifest
|
|
fi
|
|
- name: Build Mksnapshot (mas)
|
|
run: |
|
|
cd src
|
|
e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
|
|
gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
|
|
# Remove unused args from mksnapshot_args
|
|
SEDOPTION="-i ''"
|
|
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
|
|
sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
|
|
sed $SEDOPTION '/The gn arg use_goma=true .*/d' out/Default/mksnapshot_args
|
|
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
|
|
- name: Build Chromedriver (mas)
|
|
run: |
|
|
cd src
|
|
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
|
|
e build electron:electron_chromedriver_zip
|
|
- name: Build Node Headers
|
|
run: |
|
|
cd src
|
|
e build electron:node_headers
|
|
- name: Generate & Zip Symbols (mas)
|
|
run: |
|
|
if [ "${{ inputs.generate-symbols }}" == "true" ]; then
|
|
e build electron:electron_symbols
|
|
fi
|
|
cd src
|
|
export BUILD_PATH="$(pwd)/out/Default"
|
|
e build electron:licenses
|
|
e build electron:electron_version_file
|
|
if [ "${{ inputs.is-release }}" == "true" ]; then
|
|
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
|
|
else
|
|
electron/script/zip-symbols.py -b $BUILD_PATH
|
|
fi
|
|
- name: Generate FFMpeg (mas)
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
cd src
|
|
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
|
|
autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
|
|
# TODO(vertedinde): These uploads currently point to a different Azure bucket & GitHub Repo
|
|
- name: Publish Electron Dist
|
|
if: ${{ inputs.is-release }}
|
|
run: |
|
|
rm -rf src/out/Default/obj
|
|
cd src/electron
|
|
if [ "${{ inputs.upload-to-storage }}" == "1" ]; then
|
|
echo 'Uploading Electron release distribution to Azure'
|
|
script/release/uploaders/upload.py --verbose --upload_to_storage
|
|
else
|
|
echo 'Uploading Electron release distribution to GitHub releases'
|
|
script/release/uploaders/upload.py --verbose
|
|
fi
|
|
- name: Move all Generated Artifacts to Upload Folder (mas)
|
|
run: ./src/electron/script/actions/move-artifacts.sh
|
|
- name: Upload Generated Artifacts
|
|
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
|
|
with:
|
|
name: generated_artifacts_mas_${{ env.TARGET_ARCH }}
|
|
path: ./generated_artifacts_mas_${{ env.TARGET_ARCH }}
|
|
test:
|
|
if: ${{ inputs.is-release == false }}
|
|
runs-on: macos-14-xlarge
|
|
needs: build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build-type: [ darwin, mas ]
|
|
target-arch: [ x64, arm64 ]
|
|
env:
|
|
BUILD_TYPE: ${{ matrix.build-type }}
|
|
TARGET_ARCH: ${{ matrix.target-arch }}
|
|
steps:
|
|
- name: Load Build Tools
|
|
run: |
|
|
export BUILD_TOOLS_SHA=ef894bc3cfa99d84a3b731252da0f83f500e4032
|
|
npm i -g @electron/build-tools
|
|
e auto-update disable
|
|
e init --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
|
|
- name: Checkout Electron
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
with:
|
|
path: src/electron
|
|
fetch-depth: 0
|
|
- name: Install Dependencies
|
|
run: |
|
|
cd src/electron
|
|
node script/yarn install
|
|
- name: Get Depot Tools
|
|
timeout-minutes: 5
|
|
run: |
|
|
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
if [ "`uname`" == "Darwin" ]; then
|
|
# remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
|
|
sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
else
|
|
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
|
|
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
|
|
cd depot_tools
|
|
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
|
|
fi
|
|
# Ensure depot_tools does not update.
|
|
test -d depot_tools && cd depot_tools
|
|
touch .disable_auto_update
|
|
- name: Add Depot Tools to PATH
|
|
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
|
|
- name: Download Generated Artifacts
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
|
|
with:
|
|
name: generated_artifacts_${{ matrix.build-type }}_${{ matrix.target-arch }}
|
|
path: ./generated_artifacts_${{ matrix.build-type }}_${{ matrix.target-arch }}
|
|
- name: Restore Generated Artifacts
|
|
run: ./src/electron/script/actions/restore-artifacts.sh
|
|
- name: Unzip Dist, Mksnapshot & Chromedriver
|
|
run: |
|
|
cd src/out/Default
|
|
unzip -:o dist.zip
|
|
unzip -:o chromedriver.zip
|
|
unzip -:o mksnapshot.zip
|
|
- name: Import & Trust Self-Signed Codesigning Cert on MacOS
|
|
run: |
|
|
sudo security authorizationdb write com.apple.trust-settings.admin allow
|
|
cd src/electron
|
|
./script/codesign/generate-identity.sh
|
|
- name: Run Electron Tests
|
|
env:
|
|
MOCHA_REPORTER: mocha-multi-reporters
|
|
ELECTRON_TEST_RESULTS_DIR: junit
|
|
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
|
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
|
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
|
run: |
|
|
cd src/electron
|
|
node script/yarn test --runners=main --trace-uncaught --enable-logging
|