From b92a4023c137b1850bd2a48712b8804d0f50a836 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 13 Jun 2024 16:02:38 -0500 Subject: [PATCH] build: unify pipelines (#42482) --- .github/actions/build-electron/action.yml | 187 ++++++ .github/actions/fix-sync-macos/action.yml | 61 ++ .github/actions/free-space-macos/action.yml | 65 ++ .github/actions/restore-cache-aks/action.yml | 36 ++ .../actions/restore-cache-azcopy/action.yml | 51 ++ .github/workflows/build.yml | 120 ++++ .github/workflows/linux-build.yml | 17 - .github/workflows/linux-pipeline.yml | 505 --------------- .github/workflows/linux-publish.yml | 59 +- .github/workflows/macos-build.yml | 17 - .github/workflows/macos-pipeline.yml | 594 ------------------ .github/workflows/macos-publish.yml | 44 +- ...peline-electron-build-and-test-and-nan.yml | 84 +++ .../pipeline-electron-build-and-test.yml | 75 +++ .../pipeline-segment-electron-build.yml | 193 ++++++ .../pipeline-segment-electron-test.yml | 120 ++++ .../pipeline-segment-node-nan-test.yml | 159 +++++ 17 files changed, 1248 insertions(+), 1139 deletions(-) create mode 100644 .github/actions/build-electron/action.yml create mode 100644 .github/actions/fix-sync-macos/action.yml create mode 100644 .github/actions/free-space-macos/action.yml create mode 100644 .github/actions/restore-cache-aks/action.yml create mode 100644 .github/actions/restore-cache-azcopy/action.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/linux-build.yml delete mode 100644 .github/workflows/linux-pipeline.yml delete mode 100644 .github/workflows/macos-build.yml delete mode 100644 .github/workflows/macos-pipeline.yml create mode 100644 .github/workflows/pipeline-electron-build-and-test-and-nan.yml create mode 100644 .github/workflows/pipeline-electron-build-and-test.yml create mode 100644 .github/workflows/pipeline-segment-electron-build.yml create mode 100644 .github/workflows/pipeline-segment-electron-test.yml create mode 100644 .github/workflows/pipeline-segment-node-nan-test.yml diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml new file mode 100644 index 000000000000..90d6d1dea254 --- /dev/null +++ b/.github/actions/build-electron/action.yml @@ -0,0 +1,187 @@ +name: 'Build Electron' +description: 'Builds Electron & Friends' +inputs: + target-arch: + description: 'Target arch' + required: true + target-platform: + description: 'Target platform' + required: true + artifact-platform: + description: 'Artifact platform, should be linux, darwin or mas' + required: true + step-suffix: + description: 'Suffix for build steps' + required: false + default: '' + is-release: + description: 'Is release build' + required: true + generate-symbols: + description: 'Generate symbols' + required: true + upload-to-storage: + description: 'Upload to storage' + required: true +runs: + using: "composite" + steps: + - name: Build Electron ${{ inputs.step-suffix }} + shell: bash + 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 .. + + if [ "`uname`" = "Darwin" ]; then + ulimit -n 10000 + sudo launchctl limit maxfiles 65536 200000 + fi + + 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 ${{ inputs.step-suffix }} + shell: bash + run: | + cd src + e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES + if [ "${{ env.CHECK_DIST_MANIFEST }}" = "true" ]; then + target_os=${{ inputs.target-platform == 'linux' && 'linux' || 'mac'}} + if [ "${{ inputs.artifact-platform }}" = "mas" ]; then + target_os="${target_os}_mas" + fi + electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ inputs.target-arch }}.manifest + fi + - name: Build Mksnapshot ${{ inputs.step-suffix }} + shell: bash + 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" + if [ "`uname`" = "Darwin" ]; then + SEDOPTION="-i ''" + fi + 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 + + if [ "`uname`" = "Linux" ]; then + if [ "${{ inputs.target-arch }}" = "arm" ]; then + electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot + electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator + elif [ "${{ inputs.target-arch }}" = "arm64" ]; then + electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/mksnapshot + electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/v8_context_snapshot_generator + else + electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot + electron/script/strip-binaries.py --file $PWD/out/Default/v8_context_snapshot_generator + fi + fi + + e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES + (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) + - name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }} + shell: bash + if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }} + run: | + cd src + if [ "${{ inputs.target-arch }}" = "arm" ]; then + MKSNAPSHOT_PATH="clang_x86_v8_arm" + elif [ "${{ inputs.target-arch }}" = "arm64" ]; then + MKSNAPSHOT_PATH="clang_x64_v8_arm64" + fi + + cp "out/Default/$MKSNAPSHOT_PATH/mksnapshot" out/Default + cp "out/Default/$MKSNAPSHOT_PATH/v8_context_snapshot_generator" out/Default + cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.so" out/Default + + python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only + mkdir cross-arch-snapshots + cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots + # Clean up so that ninja does not get confused + rm -f out/Default/libffmpeg.so + - name: Build Chromedriver ${{ inputs.step-suffix }} + shell: bash + run: | + cd src + e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES + e build electron:electron_chromedriver_zip + - name: Build Node.js headers ${{ inputs.step-suffix }} + shell: bash + run: | + cd src + e build electron:node_headers + - name: Generate & Zip Symbols ${{ inputs.step-suffix }} + shell: bash + 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 ${{ inputs.step-suffix }} + shell: bash + if: ${{ inputs.is-release == 'true' }} + 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 ${{ inputs.step-suffix }} + shell: bash + if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} + run: | + cd src + autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES + - name: Generate Libcxx ${{ inputs.step-suffix }} + shell: bash + if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} + run: | + cd src + autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES + autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES + autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES + - name: Generate TypeScript Definitions ${{ inputs.step-suffix }} + if: ${{ inputs.is-release == 'true' }} + shell: bash + 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 ${{ inputs.step-suffix }} + if: ${{ inputs.is-release == 'true' }} + shell: bash + 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 ${{ inputs.step-suffix }} + shell: bash + run: ./src/electron/script/actions/move-artifacts.sh + - name: Upload Generated Artifacts ${{ inputs.step-suffix }} + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 + with: + name: generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }} + path: ./generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }} \ No newline at end of file diff --git a/.github/actions/fix-sync-macos/action.yml b/.github/actions/fix-sync-macos/action.yml new file mode 100644 index 000000000000..e9e2c922280b --- /dev/null +++ b/.github/actions/fix-sync-macos/action.yml @@ -0,0 +1,61 @@ +name: 'Fix Sync macOS' +description: 'Checks out Electron and stores it in the AKS Cache' +runs: + using: "composite" + steps: + - name: Fix Sync + shell: bash + # 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 diff --git a/.github/actions/free-space-macos/action.yml b/.github/actions/free-space-macos/action.yml new file mode 100644 index 000000000000..75350ca796ba --- /dev/null +++ b/.github/actions/free-space-macos/action.yml @@ -0,0 +1,65 @@ +name: 'Free Space macOS' +description: 'Checks out Electron and stores it in the AKS Cache' +runs: + using: "composite" + steps: + - name: Free Space on MacOS + shell: bash + 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 + + sudo rm -rf $TMPDIR/del-target + + 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 \ No newline at end of file diff --git a/.github/actions/restore-cache-aks/action.yml b/.github/actions/restore-cache-aks/action.yml new file mode 100644 index 000000000000..eccbb5ebfc38 --- /dev/null +++ b/.github/actions/restore-cache-aks/action.yml @@ -0,0 +1,36 @@ +name: 'Restore Cache AKS' +description: 'Restores Electron src cache via AKS' +runs: + using: "composite" + steps: + - name: Restore and Ensure Src Cache + shell: bash + 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 Does Not Exist for $DEPSHASH - exiting" + exit 1 + else + echo "Found Cache for $DEPSHASH at $cache_path" + fi + + echo "Persisted cache is $(du -sh $cache_path | cut -f1)" + mkdir temp-cache + tar -xf $cache_path -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 + 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 diff --git a/.github/actions/restore-cache-azcopy/action.yml b/.github/actions/restore-cache-azcopy/action.yml new file mode 100644 index 000000000000..2d861b4252fd --- /dev/null +++ b/.github/actions/restore-cache-azcopy/action.yml @@ -0,0 +1,51 @@ +name: 'Restore Cache AZCopy' +description: 'Restores Electron src cache via AZCopy' +runs: + using: "composite" + steps: + - 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 + shell: bash + run: rm -f sas-token + - name: Unzip and Ensure Src Cache + shell: bash + 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 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..23f98be5ecfb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,120 @@ +name: Build + +on: + workflow_dispatch: + # push + # pull_request: + +jobs: + # Checkout Jobs + checkout-macos: + 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 + env: + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + steps: + - name: Checkout Electron + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: src/electron + fetch-depth: 0 + - name: Checkout & Sync & Save + uses: ./src/electron/.github/actions/checkout + with: + generate-sas-token: 'true' + checkout-linux: + 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 + env: + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + steps: + - name: Checkout Electron + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: src/electron + fetch-depth: 0 + - name: Checkout & Sync & Save + uses: ./src/electron/.github/actions/checkout + + macos-x64: + uses: ./.github/workflows/pipeline-electron-build-and-test.yml + needs: checkout-macos + with: + build-runs-on: macos-14-xlarge + test-runs-on: macos-14-xlarge + target-platform: macos + target-arch: x64 + is-release: false + gn-build-type: testing + generate-symbols: false + upload-to-storage: '0' + secrets: inherit + + macos-arm64: + uses: ./.github/workflows/pipeline-electron-build-and-test.yml + needs: checkout-macos + with: + build-runs-on: macos-14-xlarge + test-runs-on: macos-14-xlarge + target-platform: macos + target-arch: arm64 + is-release: false + gn-build-type: testing + generate-symbols: false + upload-to-storage: '0' + secrets: inherit + + linux-x64: + uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml + needs: checkout-linux + with: + build-runs-on: aks-linux-large + test-runs-on: aks-linux-medium + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: x64 + is-release: false + gn-build-type: testing + generate-symbols: false + upload-to-storage: '0' + secrets: inherit + + linux-arm: + uses: ./.github/workflows/pipeline-electron-build-and-test.yml + needs: checkout-linux + with: + build-runs-on: aks-linux-large + test-runs-on: aks-linux-medium + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: arm + is-release: false + gn-build-type: testing + generate-symbols: false + upload-to-storage: '0' + secrets: inherit + + linux-arm64: + uses: ./.github/workflows/pipeline-electron-build-and-test.yml + needs: checkout-linux + with: + build-runs-on: aks-linux-large + test-runs-on: aks-linux-medium + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: arm64 + is-release: false + gn-build-type: testing + generate-symbols: false + upload-to-storage: '0' + secrets: inherit diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml deleted file mode 100644 index 2ebe3674360a..000000000000 --- a/.github/workflows/linux-build.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build Linux - -on: - workflow_dispatch: - # push: - # pull_request: - -jobs: - build: - uses: ./.github/workflows/linux-pipeline.yml - with: - is-release: false - gn-config: //electron/build/args/testing.gn - gn-build-type: testing - generate-symbols: false - upload-to-storage: '0' - secrets: inherit diff --git a/.github/workflows/linux-pipeline.yml b/.github/workflows/linux-pipeline.yml deleted file mode 100644 index 7f6c897b6d77..000000000000 --- a/.github/workflows/linux-pipeline.yml +++ /dev/null @@ -1,505 +0,0 @@ -name: Linux Pipeline - -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: - 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_arm=True --custom-var=checkout_arm64=True' - # 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 - steps: - - name: Checkout Electron - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - with: - path: src/electron - fetch-depth: 0 - - name: Checkout & Sync & Save - uses: ./src/electron/.github/actions/checkout - build: - strategy: - fail-fast: false - matrix: - build-arch: [ x64 ] # arm64, arm - env: - TARGET_ARCH: ${{ matrix.build-arch }} - runs-on: aks-linux-large - container: - image: ghcr.io/electron/build:latest - options: --user root - volumes: - - /mnt/cross-instance-cache:/mnt/cross-instance-cache - needs: checkout - 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 }} - - 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: Set GN_EXTRA_ARGS - run: | - if [ "${{ matrix.build-arch }}" = "arm" ]; then - GN_EXTRA_ARGS='target_cpu="arm" build_tflite_with_xnnpack=false' - elif [ "${{ matrix.build-arch }}" = "arm64" ]; then - GN_EXTRA_ARGS='target_cpu="arm64" fatal_linker_warnings=false enable_linux_installer=false' - fi - echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV - - 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 - 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: Restore and Ensure Src 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 Does Not Exist for $DEPSHASH - exiting" - exit 1 - else - echo "Found Cache for $DEPSHASH at $cache_path" - fi - - echo "Persisted cache is $(du -sh $cache_path | cut -f1)" - mkdir temp-cache - tar -xf $cache_path -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 - 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: | - echo "Running Electron Only Hooks" - 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: Install build-tools & Setup RBE - run: | - echo "NUMBER_OF_NINJA_PROCESSES=300" >> $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: Build Electron - run: | - cd src/electron - # TODO(codebytere): remove this once we figure out why .git/packed-refs is initially missing - git pack-refs - cd .. - - 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 - run: | - cd src - e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES - if [ "${{ env.CHECK_DIST_MANIFEST }}" = "true" ]; then - target_os=linux - target_cpu=${{ matrix.build-arch }} - electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ matrix.build-arch }}.manifest - fi - - name: Build Mksnapshot - 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 - - if [ "${{ matrix.build-arch }}" = "arm" ]; then - electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot - electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator - elif [ "${{ matrix.build-arch }}" = "arm64" ]; then - electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/mksnapshot - electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/v8_context_snapshot_generator - else - electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot - electron/script/strip-binaries.py --file $PWD/out/Default/v8_context_snapshot_generator - fi - - e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES - (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) - - name: Generate Cross-Arch Snapshot (arm/arm64) - if: ${{ matrix.build-arch == 'arm' || matrix.build-arch == 'arm64' }} - run: | - cd src - if [ "${{ matrix.build-arch }}" = "arm" ]; then - MKSNAPSHOT_PATH="clang_x86_v8_arm" - elif [ "${{ matrix.build-arch }}" = "arm64" ]; then - MKSNAPSHOT_PATH="clang_x64_v8_arm64" - fi - - cp "out/Default/$MKSNAPSHOT_PATH/mksnapshot" out/Default - cp "out/Default/$MKSNAPSHOT_PATH/v8_context_snapshot_generator" out/Default - cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.so" out/Default - - python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only - mkdir cross-arch-snapshots - cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots - # Clean up so that ninja does not get confused - rm -f out/Default/libffmpeg.so - - name: Build Chromedriver - run: | - cd src - e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES - e build electron:electron_chromedriver_zip - - name: Build Node.js headers - run: | - cd src - e build electron:node_headers - - name: Generate & Zip Symbols - 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 - 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 Libcxx - if: ${{ inputs.is-release }} - run: | - cd src - autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES - autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES - autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES - - 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 - run: ./src/electron/script/actions/move-artifacts.sh - - name: Upload Generated Artifacts - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 - with: - name: generated_artifacts_linux_${{ matrix.build-arch }} - path: ./generated_artifacts_linux_${{ matrix.build-arch }} - test: - if: ${{ inputs.is-release == false }} - runs-on: aks-linux-medium - container: - image: ghcr.io/electron/build:latest - options: --user root - needs: build - strategy: - fail-fast: false - matrix: - build-arch: [ arm64 ] # x64, arm - 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 }} - - 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 - - sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja - 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: Download Generated Artifacts - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e - with: - name: generated_artifacts_linux_${{ matrix.build-arch }} - path: ./generated_artifacts_linux_${{ matrix.build-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: Setup for headless testing - run: sh -e /etc/init.d/xvfb start - - 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 - - name: Wait for active SSH sessions - if: always() && !cancelled() - run: | - while [ -f /var/.ssh-lock ] - do - sleep 60 - done - node-tests: - name: Run Node.js Tests - if: ${{ inputs.is-release == false }} - runs-on: aks-linux-medium - needs: build - timeout-minutes: 20 - env: - TARGET_ARCH: x64 - container: - image: ghcr.io/electron/build:latest - options: --user root - 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 - sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja - 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: Download Generated Artifacts - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e - with: - name: generated_artifacts_linux_${{ env.TARGET_ARCH }} - path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }} - - name: Restore Generated Artifacts - run: ./src/electron/script/actions/restore-artifacts.sh - - name: Unzip Dist - run: | - cd src/out/Default - unzip -:o dist.zip - - name: Setup Linux for Headless Testing - run: sh -e /etc/init.d/xvfb start - - name: Run Node.js Tests - run: | - cd src - node electron/script/node-spec-runner.js --default --jUnitDir=junit - - name: Wait for active SSH sessions - if: always() && !cancelled() - run: | - while [ -f /var/.ssh-lock ] - do - sleep 60 - done - nan-tests: - name: Run Nan Tests - if: ${{ inputs.is-release == false }} - runs-on: aks-linux-medium - needs: build - timeout-minutes: 20 - env: - TARGET_ARCH: x64 - container: - image: ghcr.io/electron/build:latest - options: --user root - 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 - sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja - 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: Download Generated Artifacts - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e - with: - name: generated_artifacts_linux_${{ env.TARGET_ARCH }} - path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }} - - name: Restore Generated Artifacts - run: ./src/electron/script/actions/restore-artifacts.sh - - name: Unzip Dist - run: | - cd src/out/Default - unzip -:o dist.zip - - name: Setup Linux for Headless Testing - run: sh -e /etc/init.d/xvfb start - - name: Run Node.js Tests - run: | - cd src - node electron/script/nan-spec-runner.js - - name: Wait for active SSH sessions - if: always() && !cancelled() - run: | - while [ -f /var/.ssh-lock ] - do - sleep 60 - done - diff --git a/.github/workflows/linux-publish.yml b/.github/workflows/linux-publish.yml index edb985d8ef53..65cca4869746 100644 --- a/.github/workflows/linux-publish.yml +++ b/.github/workflows/linux-publish.yml @@ -14,11 +14,64 @@ on: default: false jobs: - publish: - uses: ./.github/workflows/linux-pipeline.yml + checkout-linux: + 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 + env: + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + steps: + - name: Checkout Electron + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: src/electron + fetch-depth: 0 + - name: Checkout & Sync & Save + uses: ./src/electron/.github/actions/checkout + with: + gclient-extra-args: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' + + publish-x64: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + needs: checkout-linux with: + build-runs-on: aks-linux-large + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: x64 + is-release: true + gn-build-type: release + generate-symbols: true + upload-to-storage: ${{ inputs.upload-to-storage }} + secrets: inherit + + publish-arm: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + needs: checkout-linux + with: + build-runs-on: aks-linux-large + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: arm + is-release: true + gn-build-type: release + generate-symbols: true + upload-to-storage: ${{ inputs.upload-to-storage }} + secrets: inherit + + publish-arm64: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + needs: checkout-linux + with: + build-runs-on: aks-linux-large + build-container: '{"image":"ghcr.io/electron/build:latest","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' + target-platform: linux + target-arch: arm64 is-release: true - gn-config: //electron/build/args/release.gn gn-build-type: release generate-symbols: true upload-to-storage: ${{ inputs.upload-to-storage }} diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml deleted file mode 100644 index 5a0c55fde6b8..000000000000 --- a/.github/workflows/macos-build.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build MacOS - -on: - workflow_dispatch: - # push - # pull_request: - -jobs: - build: - uses: ./.github/workflows/macos-pipeline.yml - with: - is-release: false - gn-config: //electron/build/args/testing.gn - gn-build-type: testing - generate-symbols: false - upload-to-storage: '0' - secrets: inherit diff --git a/.github/workflows/macos-pipeline.yml b/.github/workflows/macos-pipeline.yml deleted file mode 100644 index 961f3be1da81..000000000000 --- a/.github/workflows/macos-pipeline.yml +++ /dev/null @@ -1,594 +0,0 @@ -name: MacOS Pipeline - -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: Checkout & Sync & Save - uses: ./src/electron/.github/actions/checkout - with: - generate-sas-token: 'true' - 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 }} - - 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 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: Set GN_EXTRA_ARGS for MAS Build - run: | - echo "MAS_BUILD=true" >> $GITHUB_ENV - GN_EXTRA_ARGS='is_mas_build=true' - echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV - - 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: - name: Run Electron Tests - 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 }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ matrix.target-arch }} - - 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 - - name: Verify mksnapshot - run: | - cd src - python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default - - name: Verify ChromeDriver - run: | - cd src - python3 electron/script/verify-chromedriver.py --source-root "$PWD" --build-dir out/Default diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml index ffccbfdec784..0efc34855e4a 100644 --- a/.github/workflows/macos-publish.yml +++ b/.github/workflows/macos-publish.yml @@ -14,11 +14,49 @@ on: default: false jobs: - publish: - uses: ./.github/workflows/macos-pipeline.yml + checkout-macos: + 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 + env: + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + steps: + - name: Checkout Electron + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: src/electron + fetch-depth: 0 + - name: Checkout & Sync & Save + uses: ./src/electron/.github/actions/checkout + with: + generate-sas-token: 'true' + gclient-extra-args: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + + publish-x64: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + needs: checkout-macos with: + build-runs-on: macos-14-xlarge + target-platform: macos + target-arch: x64 + is-release: true + gn-build-type: release + generate-symbols: true + upload-to-storage: ${{ inputs.upload-to-storage }} + secrets: inherit + + publish-arm64: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + needs: checkout-macos + with: + build-runs-on: macos-14-xlarge + target-platform: macos + target-arch: arm64 is-release: true - gn-config: //electron/build/args/release.gn gn-build-type: release generate-symbols: true upload-to-storage: ${{ inputs.upload-to-storage }} diff --git a/.github/workflows/pipeline-electron-build-and-test-and-nan.yml b/.github/workflows/pipeline-electron-build-and-test-and-nan.yml new file mode 100644 index 000000000000..c1a70b024644 --- /dev/null +++ b/.github/workflows/pipeline-electron-build-and-test-and-nan.yml @@ -0,0 +1,84 @@ +name: Electron Build & Test (+ Node + NaN) Pipeline + +on: + workflow_call: + inputs: + target-platform: + type: string + description: 'Platform to run on, can be macos or linux' + required: true + target-arch: + type: string + description: 'Arch to build for, can be x64, arm64 or arm' + required: true + build-runs-on: + type: string + description: 'What host to run the build' + required: true + test-runs-on: + type: string + description: 'What host to run the tests on' + required: true + build-container: + type: string + description: 'JSON container information for aks runs-on' + required: false + default: '{"image":null}' + is-release: + description: 'Whether this build job is a release job' + required: true + type: boolean + default: false + 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: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + with: + build-runs-on: ${{ inputs.build-runs-on }} + build-container: ${{ inputs.build-container }} + target-platform: ${{ inputs.target-platform }} + target-arch: ${{ inputs.target-arch }} + is-release: ${{ inputs.is-release }} + gn-build-type: ${{ inputs.gn-build-type }} + generate-symbols: ${{ inputs.generate-symbols }} + upload-to-storage: ${{ inputs.upload-to-storage }} + secrets: inherit + test: + uses: ./.github/workflows/pipeline-segment-electron-test.yml + needs: build + with: + target-arch: ${{ inputs.target-arch }} + target-platform: ${{ inputs.target-platform }} + test-runs-on: ${{ inputs.test-runs-on }} + test-container: ${{ inputs.build-container }} + gn-build-type: ${{ inputs.gn-build-type }} + secrets: inherit + nn-test: + uses: ./.github/workflows/pipeline-segment-node-nan-test.yml + needs: build + with: + target-arch: ${{ inputs.target-arch }} + target-platform: ${{ inputs.target-platform }} + test-runs-on: ${{ inputs.test-runs-on }} + test-container: ${{ inputs.build-container }} + gn-build-type: ${{ inputs.gn-build-type }} + secrets: inherit diff --git a/.github/workflows/pipeline-electron-build-and-test.yml b/.github/workflows/pipeline-electron-build-and-test.yml new file mode 100644 index 000000000000..985733596b43 --- /dev/null +++ b/.github/workflows/pipeline-electron-build-and-test.yml @@ -0,0 +1,75 @@ +name: Electron Build & Test Pipeline + +on: + workflow_call: + inputs: + target-platform: + type: string + description: 'Platform to run on, can be macos or linux' + required: true + target-arch: + type: string + description: 'Arch to build for, can be x64, arm64 or arm' + required: true + build-runs-on: + type: string + description: 'What host to run the build' + required: true + test-runs-on: + type: string + description: 'What host to run the tests on' + required: true + build-container: + type: string + description: 'JSON container information for aks runs-on' + required: false + default: '{"image":null}' + is-release: + description: 'Whether this build job is a release job' + required: true + type: boolean + default: false + 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: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + uses: ./.github/workflows/pipeline-segment-electron-build.yml + with: + build-runs-on: ${{ inputs.build-runs-on }} + build-container: ${{ inputs.build-container }} + target-platform: ${{ inputs.target-platform }} + target-arch: ${{ inputs.target-arch }} + is-release: ${{ inputs.is-release }} + gn-build-type: ${{ inputs.gn-build-type }} + generate-symbols: ${{ inputs.generate-symbols }} + upload-to-storage: ${{ inputs.upload-to-storage }} + secrets: inherit + test: + uses: ./.github/workflows/pipeline-segment-electron-test.yml + if: ${{ inputs.target-platform == 'macos' || inputs.target-arch == 'x64' }} + needs: build + with: + target-arch: ${{ inputs.target-arch }} + target-platform: ${{ inputs.target-platform }} + test-runs-on: ${{ inputs.test-runs-on }} + test-container: ${{ inputs.build-container }} + gn-build-type: ${{ inputs.gn-build-type }} + secrets: inherit diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml new file mode 100644 index 000000000000..ce5af65cdb03 --- /dev/null +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -0,0 +1,193 @@ +name: Pipeline Segment - Electron Build + +on: + workflow_call: + inputs: + target-platform: + type: string + description: 'Platform to run on, can be macos or linux' + required: true + target-arch: + type: string + description: 'Arch to build for, can be x64, arm64 or arm' + required: true + build-runs-on: + type: string + description: 'What host to run the build' + required: true + build-container: + type: string + description: 'JSON container information for aks runs-on' + required: false + default: '{"image":null}' + is-release: + description: 'Whether this build job is a release job' + required: true + type: boolean + default: false + 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: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ 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 }} + # Disable pre-compiled headers to reduce out size - only useful for rebuilds + GN_BUILDFLAG_ARGS: 'enable_precompiled_headers=false' + GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }} + # Only disable this in the Asan build + CHECK_DIST_MANIFEST: true + IS_GHA_RELEASE: true + ELECTRON_OUT_DIR: Default + +jobs: + build: + runs-on: ${{ inputs.build-runs-on }} + container: ${{ fromJSON(inputs.build-container) }} + env: + TARGET_ARCH: ${{ inputs.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 }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} + - name: Checkout Electron + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 + with: + path: src/electron + fetch-depth: 0 + - name: Setup Node.js/npm + if: ${{ inputs.target-platform == 'macos' }} + 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 + - name: Install AZCopy + if: ${{ inputs.target-platform == 'macos' }} + run: brew install azcopy + - name: Set GN_EXTRA_ARGS for Linux + if: ${{ inputs.target-platform == 'linux' }} + run: | + if [ "${{ inputs.target-arch }}" = "arm" ]; then + GN_EXTRA_ARGS='build_tflite_with_xnnpack=false' + elif [ "${{ inputs.target-arch }}" = "arm64" ]; then + GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false' + fi + echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV + - name: Get Depot Tools + timeout-minutes: 5 + run: | + git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git + + SEDOPTION="-i" + if [ "`uname`" = "Darwin" ]; then + SEDOPTION="-i ''" + fi + + # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems + sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja + + # Ensure depot_tools does not update. + test -d depot_tools && cd depot_tools + if [ "`uname`" = "Linux" ]; then + git apply --3way ../src/electron/.github/workflows/config/gclient.diff + fi + 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: Restore src cache via AZCopy + if: ${{ inputs.target-platform == 'macos' }} + uses: ./src/electron/.github/actions/restore-cache-azcopy + - name: Restore src cache via AKS + if: ${{ inputs.target-platform == 'linux' }} + uses: ./src/electron/.github/actions/restore-cache-aks + - 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 (macOS) + if: ${{ inputs.target-platform == 'macos' }} + uses: ./src/electron/.github/actions/fix-sync-macos + - name: Install build-tools & Setup RBE + run: | + echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform == 'linux' && '300' || '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 up space (macOS) + if: ${{ inputs.target-platform == 'macos' }} + uses: ./src/electron/.github/actions/free-space-macos + - name: Build Electron + uses: ./src/electron/.github/actions/build-electron + with: + target-arch: ${{ inputs.target-arch }} + target-platform: ${{ inputs.target-platform }} + artifact-platform: ${{ inputs.target-platform == 'linux' && 'linux' || 'darwin' }} + is-release: '${{ inputs.is-release }}' + generate-symbols: '${{ inputs.generate-symbols }}' + upload-to-storage: '${{ inputs.upload-to-storage }}' + - name: Set GN_EXTRA_ARGS for MAS Build + if: ${{ inputs.target-platform == 'macos' }} + run: | + echo "MAS_BUILD=true" >> $GITHUB_ENV + GN_EXTRA_ARGS='is_mas_build=true' + echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV + - name: Build Electron (MAS) + if: ${{ inputs.target-platform == 'macos' }} + uses: ./src/electron/.github/actions/build-electron + with: + target-arch: ${{ inputs.target-arch }} + target-platform: ${{ inputs.target-platform }} + artifact-platform: 'mas' + is-release: '${{ inputs.is-release }}' + generate-symbols: '${{ inputs.generate-symbols }}' + upload-to-storage: '${{ inputs.upload-to-storage }}' + step-suffix: '(mas)' diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml new file mode 100644 index 000000000000..5b89e4ff3c6a --- /dev/null +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -0,0 +1,120 @@ +name: Pipeline Segment - Electron Test + +on: + workflow_call: + inputs: + target-platform: + type: string + description: 'Platform to run on, can be macos or linux' + required: true + target-arch: + type: string + description: 'Arch to build for, can be x64, arm64 or arm' + required: true + test-runs-on: + type: string + description: 'What host to run the tests on' + required: true + test-container: + type: string + description: 'JSON container information for aks runs-on' + required: false + default: '{"image":null}' + gn-build-type: + description: 'The gn build type - testing or release' + required: true + type: string + default: testing + +concurrency: + group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }} + cancel-in-progress: true + +env: + ELECTRON_OUT_DIR: Default + ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} + +jobs: + test: + runs-on: ${{ inputs.test-runs-on }} + container: ${{ fromJSON(inputs.test-container) }} + strategy: + fail-fast: false + matrix: + build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || fromJSON('["linux"]') }} + env: + BUILD_TYPE: ${{ matrix.build-type }} + TARGET_ARCH: ${{ inputs.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 }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} + - 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 }}_${{ inputs.target-arch }} + path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.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 + # if: ${{ inputs.target-platform == 'macos' }} + # run: | + # sudo security authorizationdb write com.apple.trust-settings.admin allow + # cd src/electron + # ./script/codesign/generate-identity.sh + - name: Setup for headless testing + if: ${{ inputs.target-platform == 'linux' }} + run: sh -e /etc/init.d/xvfb start + - 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 + - name: Wait for active SSH sessions + if: always() && !cancelled() + run: | + while [ -f /var/.ssh-lock ] + do + sleep 60 + done \ No newline at end of file diff --git a/.github/workflows/pipeline-segment-node-nan-test.yml b/.github/workflows/pipeline-segment-node-nan-test.yml new file mode 100644 index 000000000000..6c60015b1727 --- /dev/null +++ b/.github/workflows/pipeline-segment-node-nan-test.yml @@ -0,0 +1,159 @@ +name: Pipeline Segment - Node/Nan Test + +on: + workflow_call: + inputs: + target-platform: + type: string + description: 'Platform to run on, can be macos or linux' + required: true + target-arch: + type: string + description: 'Arch to build for, can be x64, arm64 or arm' + required: true + test-runs-on: + type: string + description: 'What host to run the tests on' + required: true + test-container: + type: string + description: 'JSON container information for aks runs-on' + required: false + default: '{"image":null}' + gn-build-type: + description: 'The gn build type - testing or release' + required: true + type: string + default: testing + +concurrency: + group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }} + cancel-in-progress: true + +env: + ELECTRON_OUT_DIR: Default + ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} + +jobs: + node-tests: + name: Run Node.js Tests + runs-on: aks-linux-medium + timeout-minutes: 20 + env: + TARGET_ARCH: ${{ inputs.target-arch }} + container: + image: ghcr.io/electron/build:latest + options: --user root + 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 ${{ inputs.target-arch }} + - 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 + sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja + 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: Download Generated Artifacts + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e + with: + name: generated_artifacts_linux_${{ env.TARGET_ARCH }} + path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }} + - name: Restore Generated Artifacts + run: ./src/electron/script/actions/restore-artifacts.sh + - name: Unzip Dist + run: | + cd src/out/Default + unzip -:o dist.zip + - name: Setup Linux for Headless Testing + run: sh -e /etc/init.d/xvfb start + - name: Run Node.js Tests + run: | + cd src + node electron/script/node-spec-runner.js --default --jUnitDir=junit + - name: Wait for active SSH sessions + if: always() && !cancelled() + run: | + while [ -f /var/.ssh-lock ] + do + sleep 60 + done + nan-tests: + name: Run Nan Tests + runs-on: aks-linux-medium + timeout-minutes: 20 + env: + TARGET_ARCH: ${{ inputs.target-arch }} + container: + image: ghcr.io/electron/build:latest + options: --user root + 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 + sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja + 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: Download Generated Artifacts + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e + with: + name: generated_artifacts_linux_${{ env.TARGET_ARCH }} + path: ./generated_artifacts_linux_${{ env.TARGET_ARCH }} + - name: Restore Generated Artifacts + run: ./src/electron/script/actions/restore-artifacts.sh + - name: Unzip Dist + run: | + cd src/out/Default + unzip -:o dist.zip + - name: Setup Linux for Headless Testing + run: sh -e /etc/init.d/xvfb start + - name: Run Node.js Tests + run: | + cd src + node electron/script/nan-spec-runner.js + - name: Wait for active SSH sessions + if: always() && !cancelled() + run: | + while [ -f /var/.ssh-lock ] + do + sleep 60 + done