Browse Source

build: Use windows src cache (#46186)

* build: use source cache on windows

Co-authored-by: John Kleinschmidt <[email protected]>

* build: fixup release builds

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <[email protected]>
trop[bot] 3 weeks ago
parent
commit
a82f92e1d8

+ 1 - 1
.github/actions/build-electron/action.yml

@@ -185,7 +185,7 @@ runs:
       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"
+        e d gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
         e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
     - name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
       shell: bash

+ 22 - 26
.github/actions/checkout/action.yml

@@ -9,6 +9,8 @@ inputs:
     description: 'Whether to persist the cache to the shared drive'
     required: false
     default: 'true'
+  target-platform:
+    description: 'Target platform, should be linux, win, macos'    
 runs:
   using: "composite"
   steps:
@@ -22,36 +24,30 @@ runs:
     uses: ./src/electron/.github/actions/set-chromium-cookie
   - name: Install Build Tools
     uses: ./src/electron/.github/actions/install-build-tools
-  - name: Get Depot Tools
-    shell: bash
-    run: |
-      if [[ ! -d depot_tools ]]; then
-        git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
-
-        # Ensure depot_tools does not update.
-        test -d depot_tools && cd depot_tools
-        touch .disable_auto_update
-      fi
-  - name: Add Depot Tools to PATH
-    shell: bash
-    run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
   - name: Generate DEPS Hash
     shell: bash
     run: |
       node src/electron/script/generate-deps-hash.js
-      echo "DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)" >> $GITHUB_ENV
+      DEPSHASH="v1-src-cache-$(cat src/electron/.depshash)"
+      echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
+      echo "CACHE_FILE=$DEPSHASH.tar" >> $GITHUB_ENV
+      if [ "${{ inputs.target-platform }}" = "win" ]; then
+        echo "CACHE_DRIVE=/mnt/win-cache" >> $GITHUB_ENV
+      else
+        echo "CACHE_DRIVE=/mnt/cross-instance-cache" >> $GITHUB_ENV
+      fi
   - name: Generate SAS Key
     if: ${{ inputs.generate-sas-token == 'true' }}
     shell: bash
     run: |
-      curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
+      curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token
   - name: Save SAS Key
     if: ${{ inputs.generate-sas-token == 'true' }}
-    uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
+    uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf
     with:
-      path: |
-        sas-token
-      key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
+      path: sas-token
+      key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
+      enableCrossOsArchive: true
   - name: Check If Cache Exists
     id: check-cache
     shell: bash
@@ -60,7 +56,7 @@ runs:
         echo "Not using cache this time..."
         echo "cache_exists=false" >> $GITHUB_OUTPUT
       else
-        cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+        cache_path=$CACHE_DRIVE/$CACHE_FILE
         echo "Using cache key: $DEPSHASH"
         echo "Checking for cache in: $cache_path"
         if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then
@@ -76,8 +72,8 @@ runs:
     shell: bash
     run: |    
       # if there is less than 35 GB free space then creating the cache might fail so exit early
-      freespace=`df -m /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
-      freespace_human=`df -h /mnt/cross-instance-cache | grep -w /mnt/cross-instance-cache | awk '{print $4}'`
+      freespace=`df -m $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
+      freespace_human=`df -h $CACHE_DRIVE | grep -w $CACHE_DRIVE | awk '{print $4}'`
       if [ $freespace -le 35000 ]; then
         echo "The cross mount cache has $freespace_human free space which is not enough - exiting"
         exit 1
@@ -167,14 +163,14 @@ runs:
     shell: bash
     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/
+      tar -cf $CACHE_FILE src
+      echo "Compressed src to $(du -sh $CACHE_FILE | cut -f1 -d' ')"
+      cp ./$CACHE_FILE $CACHE_DRIVE/
   - name: Persist Src Cache
     if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }}
     shell: bash
     run: |
-      final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+      final_cache_path=$CACHE_DRIVE/$CACHE_FILE
       echo "Using cache key: $DEPSHASH"
       echo "Checking path: $final_cache_path"
       if [ ! -f "$final_cache_path" ]; then

+ 40 - 0
.github/actions/cipd-install/action.yml

@@ -0,0 +1,40 @@
+name: 'CIPD install'
+description: 'Installs the specified CIPD package'
+inputs:
+  cipd-root-prefix-path:
+    description: 'Path to prepend to installation directory'
+    default: ''
+  dependency:
+    description: 'Name of dependency to install'
+  deps-file:
+    description: 'Location of DEPS file that defines the dependency'
+  installation-dir:
+    description: 'Location to install dependency'
+  target-platform:
+    description: 'Target platform, should be linux, win, macos'
+  package:
+    description: 'Package to install'
+runs:
+  using: "composite"
+  steps:
+    - name: Delete wrong ${{ inputs.dependency }}
+      shell: bash
+      run : |
+        rm -rf ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }}
+    - name: Create ensure file for ${{ inputs.dependency }}
+      shell: bash
+      run: |
+        echo '${{ inputs.package }}' `e d gclient getdep --deps-file=${{ inputs.deps-file }} -r '${{ inputs.installation-dir }}:${{ inputs.package }}'` > ${{ inputs.dependency }}_ensure_file
+        cat ${{ inputs.dependency }}_ensure_file
+    - name: CIPD installation of ${{ inputs.dependency }} (macOS)
+      if: ${{ inputs.target-platform == 'macos' }}
+      shell: bash
+      run: |
+        echo "ensuring ${{ inputs.dependency }} on macOS"
+        e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file
+    - name: CIPD installation of ${{ inputs.dependency }} (Windows)
+      if: ${{ inputs.target-platform == 'win' }}
+      shell: powershell
+      run: |
+        echo "ensuring ${{ inputs.dependency }} on Windows"
+        e d cipd ensure --root ${{ inputs.cipd-root-prefix-path }}${{ inputs.installation-dir }} -ensure-file ${{ inputs.dependency }}_ensure_file

+ 0 - 61
.github/actions/fix-sync-macos/action.yml

@@ -1,61 +0,0 @@
-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

+ 120 - 0
.github/actions/fix-sync/action.yml

@@ -0,0 +1,120 @@
+name: 'Fix Sync'
+description: 'Ensures proper binaries are in place'
+# This action is required to correct for differences between "gclient sync"
+# on Linux and the expected state on macOS/windows. 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)
+# 9. Install windows toolchain on Windows
+# 10. Fix node binary on Windows
+# 11. Fix rc binary on Windows
+inputs:
+  target-platform:
+    description: 'Target platform, should be linux, win, macos'
+runs:
+  using: "composite"
+  steps:
+    - name: Fix clang
+      shell: bash
+      run : |
+        rm -rf src/third_party/llvm-build
+        python3 src/tools/clang/scripts/update.py
+    - name: Fix esbuild
+      uses: ./src/electron/.github/actions/cipd-install
+      with:
+        cipd-root-prefix-path: src/third_party/devtools-frontend/src/
+        dependency: esbuild
+        deps-file: src/third_party/devtools-frontend/src/DEPS
+        installation-dir: third_party/esbuild
+        target-platform: ${{ inputs.target-platform }}
+        package: infra/3pp/tools/esbuild/${platform}
+    - name: Fix rustc
+      shell: bash
+      run : |
+        rm -rf src/third_party/rust-toolchain
+        python3 src/tools/rust/update_rust.py
+    - name: Fix gn (macOS)
+      if: ${{ inputs.target-platform == 'macos' }}
+      uses: ./src/electron/.github/actions/cipd-install
+      with:
+        dependency: gn
+        deps-file: src/DEPS
+        installation-dir: src/buildtools/mac
+        target-platform: ${{ inputs.target-platform }}
+        package: gn/gn/mac-${arch}
+    - name: Fix gn (Windows)
+      if: ${{ inputs.target-platform == 'win' }}
+      uses: ./src/electron/.github/actions/cipd-install
+      with:
+        dependency: gn
+        deps-file: src/DEPS
+        installation-dir: src/buildtools/win 
+        target-platform: ${{ inputs.target-platform }}
+        package: gn/gn/windows-amd64
+    - name: Fix reclient
+      uses: ./src/electron/.github/actions/cipd-install
+      with:
+        dependency: reclient
+        deps-file: src/DEPS
+        installation-dir: src/buildtools/reclient
+        target-platform: ${{ inputs.target-platform }}
+        package: infra/rbe/client/${platform}
+    - name: Configure reclient configs
+      shell: bash
+      run : |
+        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
+    - name: Fix dsymutil (macOS)
+      if: ${{ inputs.target-platform == 'macos' }}
+      shell: bash
+      run : |
+        # Fix dsymutil
+        if [ "${{ inputs.target-platform }}" = "macos" ]; then
+          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
+        fi
+    - name: Fix ninja
+      uses: ./src/electron/.github/actions/cipd-install
+      with:
+        dependency: ninja
+        deps-file: src/DEPS
+        installation-dir: src/third_party/ninja
+        target-platform: ${{ inputs.target-platform }}
+        package: infra/3pp/tools/ninja/${platform}
+    - name: Set ninja in path
+      shell: bash
+      run : |
+        echo "$(pwd)/src/third_party/ninja" >> $GITHUB_PATH
+    - name: Fixup angle git
+      shell: bash
+      run : |
+        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: Get Windows toolchain
+      if: ${{ inputs.target-platform == 'win' }}
+      shell: powershell
+      run: e d vpython3 src\build\vs_toolchain.py update --force
+    - name: Download nodejs
+      if: ${{ inputs.target-platform == 'win' }}
+      shell: powershell
+      run: |
+        $nodedeps = e d gclient getdep --deps-file=src/DEPS -r src/third_party/node/win | ConvertFrom-JSON
+        python3 src\third_party\depot_tools\download_from_google_storage.py --no_resume --no_auth --bucket chromium-nodejs -o src\third_party\node\win\node.exe $nodedeps.object_name
+    - name: Install rc
+      if: ${{ inputs.target-platform == 'win' }}
+      shell: bash
+      run: |
+        python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang/rc -s src/build/toolchain/win/rc/win/rc.exe.sha1

+ 1 - 0
.github/actions/install-build-tools/action.yml

@@ -14,6 +14,7 @@ runs:
       export BUILD_TOOLS_SHA=8246e57791b0af4ae5975eb96f09855f9269b1cd
       npm i -g @electron/build-tools
       e auto-update disable
+      e d auto-update disable
       if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
         e d cipd.bat --version
         cp "C:\Python311\python.exe" "C:\Python311\python3.exe"

+ 9 - 1
.github/actions/restore-cache-aks/action.yml

@@ -1,12 +1,20 @@
 name: 'Restore Cache AKS'
 description: 'Restores Electron src cache via AKS'
+inputs:
+  target-platform:
+    description: 'Target platform, should be linux, win, macos'
 runs:
   using: "composite"
   steps:
   - name: Restore and Ensure Src Cache
     shell: bash
     run: |
-      cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+      if [ "${{ inputs.target-platform }}" = "win" ]; then
+        cache_path=/mnt/win-cache/$DEPSHASH.tar
+      else
+        cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
+      fi
+
       echo "Using cache key: $DEPSHASH"
       echo "Checking for cache in: $cache_path"
       if [ ! -f "$cache_path" ]; then

+ 54 - 11
.github/actions/restore-cache-azcopy/action.yml

@@ -1,22 +1,25 @@
 name: 'Restore Cache AZCopy'
 description: 'Restores Electron src cache via AZCopy'
+inputs:
+  target-platform:
+    description: 'Target platform, should be linux, win, macos'
 runs:
   using: "composite"
   steps:
   - name: Obtain SAS Key
     continue-on-error: true
-    uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
+    uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
     with:
-      path: |
-        sas-token
-      key: sas-key-${{ github.run_number }}-1
+      path: sas-token
+      key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1
+      enableCrossOsArchive: true
   - name: Obtain SAS Key
     continue-on-error: true
-    uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
+    uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
     with:
-      path: |
-        sas-token
-      key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
+      path: sas-token
+      key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
+      enableCrossOsArchive: true
   - 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
@@ -26,21 +29,30 @@ runs:
       timeout_minutes: 30
       max_attempts: 3
       retry_on: error
+      shell: bash
       command: |
         sas_token=$(cat sas-token)
         if [ -z $sas-token ]; then
           echo "SAS Token not found; exiting src cache download early..."
           exit 1
+        else
+          if [ "${{ inputs.target-platform }}" = "win" ]; then
+            azcopy copy --log-level=ERROR \
+            "https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_WIN_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
+          else
+            azcopy copy --log-level=ERROR \
+            "https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
+          fi            
         fi
-        azcopy copy --log-level=ERROR \
-          "https://${{ env.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}.file.core.windows.net/${{ env.AZURE_AKS_CACHE_SHARE_NAME }}/${{ env.CACHE_PATH }}?$sas_token" $DEPSHASH.tar
     env:
       AZURE_AKS_CACHE_STORAGE_ACCOUNT: f723719aa87a34622b5f7f3
       AZURE_AKS_CACHE_SHARE_NAME: pvc-f6a4089f-b082-4bee-a3f9-c3e1c0c02d8f
+      AZURE_AKS_WIN_CACHE_SHARE_NAME: pvc-71dec4f2-0d44-4fd1-a2c3-add049d70bdf
   - name: Clean SAS Key
     shell: bash
     run: rm -f sas-token
   - name: Unzip and Ensure Src Cache
+    if: ${{ inputs.target-platform == 'macos' }}
     shell: bash
     run: |
       echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
@@ -68,4 +80,35 @@ runs:
       fi
 
       echo "Wiping Electron Directory"
-      rm -rf src/electron
+      rm -rf src/electron
+
+  - name: Unzip and Ensure Src Cache (Windows)
+    if: ${{ inputs.target-platform == 'win' }}
+    shell: powershell
+    run: |
+      $src_cache = "$env:DEPSHASH.tar"
+      $cache_size = $(Get-Item $src_cache).length
+      Write-Host "Downloaded cache is $cache_size"
+      if ($cache_size -eq 0) {
+        Write-Host "Cache is empty - exiting"
+        exit 1
+      }
+
+      $TEMP_DIR=New-Item -ItemType Directory -Path temp-cache
+      $TEMP_DIR_PATH = $TEMP_DIR.FullName
+      C:\ProgramData\Chocolatey\bin\7z.exe -y x $src_cache -o"$TEMP_DIR_PATH"
+      if (Test-Path "temp-cache\src") {
+        Write-Host "Relocating Cache"
+        Remove-Item -Recurse -Force src
+        Move-Item temp-cache\src src
+
+        Write-Host "Deleting zip file"
+        Remove-Item -Force $src_cache
+      }
+      if (-Not (Test-Path "src\third_party\blink")) {
+        Write-Host "Cache was not correctly restored - exiting"
+        exit 1
+      }
+
+      Write-Host "Wiping Electron Directory"
+      Remove-Item -Recurse -Force src\electron

+ 10 - 5
.github/workflows/build.yml

@@ -115,6 +115,7 @@ jobs:
       uses: ./src/electron/.github/actions/checkout
       with:
         generate-sas-token: 'true'
+        target-platform: macos
 
   checkout-linux:
     needs: setup
@@ -150,7 +151,8 @@ jobs:
       image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
       options: --user root --device /dev/fuse --cap-add SYS_ADMIN
       volumes:
-        - /mnt/cross-instance-cache:/mnt/cross-instance-cache
+        - /mnt/win-cache:/mnt/win-cache
+        - /var/run/sas:/var/run/sas
     env:
       CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
       CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
@@ -168,6 +170,9 @@ jobs:
         ref: ${{ github.event.pull_request.head.sha }}
     - name: Checkout & Sync & Save
       uses: ./src/electron/.github/actions/checkout
+      with:
+        generate-sas-token: 'true'
+        target-platform: win
 
   # GN Check Jobs
   macos-gn-check:
@@ -198,7 +203,7 @@ jobs:
       target-platform: win
       target-archs: x64 x86 arm64
       check-runs-on: electron-arc-linux-amd64-8core
-      check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
+      check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/win-cache:/mnt/win-cache"]}'
       gn-build-type: testing
     secrets: inherit
 
@@ -326,7 +331,7 @@ jobs:
       issues: read
       pull-requests: read
     uses: ./.github/workflows/pipeline-electron-build-and-test.yml
-    needs: setup
+    needs: checkout-windows
     if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
     with:
       build-runs-on: electron-arc-windows-amd64-16core
@@ -345,7 +350,7 @@ jobs:
       issues: read
       pull-requests: read
     uses: ./.github/workflows/pipeline-electron-build-and-test.yml
-    needs: setup
+    needs: checkout-windows
     if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
     with:
       build-runs-on: electron-arc-windows-amd64-16core
@@ -364,7 +369,7 @@ jobs:
       issues: read
       pull-requests: read
     uses: ./.github/workflows/pipeline-electron-build-and-test.yml
-    needs: setup
+    needs: checkout-windows
     if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
     with:
       build-runs-on: electron-arc-windows-amd64-16core

+ 4 - 0
.github/workflows/clean-src-cache.yml

@@ -16,6 +16,7 @@ jobs:
       options: --user root
       volumes:
         - /mnt/cross-instance-cache:/mnt/cross-instance-cache
+        - /mnt/win-cache:/mnt/win-cache
     steps:
     - name: Cleanup Source Cache
       shell: bash
@@ -23,3 +24,6 @@ jobs:
         df -h /mnt/cross-instance-cache
         find /mnt/cross-instance-cache -type f -mtime +15 -delete
         df -h /mnt/cross-instance-cache
+        df -h /mnt/win-cache
+        find /mnt/win-cache -type f -mtime +15 -delete
+        df -h /mnt/win-cache

+ 1 - 0
.github/workflows/macos-publish.yml

@@ -39,6 +39,7 @@ jobs:
       uses: ./src/electron/.github/actions/checkout
       with:
         generate-sas-token: 'true'
+        target-platform: macos
 
   publish-x64-darwin:
     uses: ./.github/workflows/pipeline-segment-electron-build.yml

+ 12 - 29
.github/workflows/pipeline-segment-electron-build.yml

@@ -129,24 +129,8 @@ jobs:
         echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
     - name: Set Chromium Git Cookie
       uses: ./src/electron/.github/actions/set-chromium-cookie
-    - name: Get Depot Tools
-      timeout-minutes: 5
-      run: |
-        git clone --filter=tree:0 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
-        touch .disable_auto_update
-    - name: Add Depot Tools to PATH
-      run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
+    - name: Install Build Tools
+      uses: ./src/electron/.github/actions/install-build-tools      
     - name: Generate DEPS Hash
       run: |
         node src/electron/script/generate-deps-hash.js
@@ -154,24 +138,26 @@ jobs:
         echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
         echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
     - name: Restore src cache via AZCopy
-      if: ${{ inputs.target-platform == 'macos' }}
+      if: ${{ inputs.target-platform != 'linux' }}
       uses: ./src/electron/.github/actions/restore-cache-azcopy
+      with:
+        target-platform: ${{ inputs.target-platform }}
     - name: Restore src cache via AKS
       if: ${{ inputs.target-platform == 'linux' }}
       uses: ./src/electron/.github/actions/restore-cache-aks
-    - name: Checkout src via gclient sync
-      if: ${{ inputs.target-platform == 'win' }}
-      uses: ./src/electron/.github/actions/checkout
-      with:
-        use-cache: 'false'
     - name: Checkout Electron
       uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
       with:
         path: src/electron
         fetch-depth: 0
         ref: ${{ github.event.pull_request.head.sha }}
-    - name: Install Build Tools
-      uses: ./src/electron/.github/actions/install-build-tools
+    - name: Fix Sync
+      if: ${{ inputs.target-platform != 'linux' }}
+      uses: ./src/electron/.github/actions/fix-sync
+      with:
+        target-platform: ${{ inputs.target-platform }}
+      env:
+        ELECTRON_DEPOT_TOOLS_DISABLE_LOG: true
     - name: Init Build Tools
       run: |
         e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
@@ -184,9 +170,6 @@ jobs:
         echo "DEPSHASH=$(cat src/electron/.depshash)" >> $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: Setup Number of Ninja Processes
       run: |
         echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV

+ 7 - 1
.github/workflows/pipeline-segment-electron-gn-check.yml

@@ -65,7 +65,9 @@ jobs:
         sudo rm -rf $TMPDIR/del-target
     - name: Check disk space after freeing up space
       if: ${{ inputs.target-platform == 'macos' }}
-      run: df -h        
+      run: df -h
+    - name: Set Chromium Git Cookie
+      uses: ./src/electron/.github/actions/set-chromium-cookie
     - name: Install Build Tools
       uses: ./src/electron/.github/actions/install-build-tools
     - name: Enable windows toolchain
@@ -81,9 +83,13 @@ jobs:
     - name: Restore src cache via AZCopy
       if: ${{ inputs.target-platform == 'macos' }}
       uses: ./src/electron/.github/actions/restore-cache-azcopy
+      with:
+        target-platform: ${{ inputs.target-platform }}      
     - name: Restore src cache via AKS
       if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
       uses: ./src/electron/.github/actions/restore-cache-aks
+      with:
+        target-platform: ${{ inputs.target-platform }}
     - name: Run Electron Only Hooks
       run: |
         echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient

+ 2 - 20
.github/workflows/pipeline-segment-node-nan-test.yml

@@ -60,15 +60,6 @@ jobs:
         e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
     - name: Install Dependencies
       uses: ./src/electron/.github/actions/install-dependencies
-    - name: Get Depot Tools
-      timeout-minutes: 5
-      run: |
-        git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
-        # 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@fa0a91b85d4f404e444e00e005971372dc801d16
       with:
@@ -114,6 +105,8 @@ jobs:
         path: src/electron
         fetch-depth: 0
         ref: ${{ github.event.pull_request.head.sha }}
+    - name: Set Chromium Git Cookie
+      uses: ./src/electron/.github/actions/set-chromium-cookie
     - name: Install Build Tools
       uses: ./src/electron/.github/actions/install-build-tools
     - name: Init Build Tools
@@ -121,17 +114,6 @@ jobs:
         e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
     - name: Install Dependencies
       uses: ./src/electron/.github/actions/install-dependencies
-    - name: Set Chromium Git Cookie
-      uses: ./src/electron/.github/actions/set-chromium-cookie
-    - name: Get Depot Tools
-      timeout-minutes: 5
-      run: |
-        git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
-        # 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@fa0a91b85d4f404e444e00e005971372dc801d16
       with:

+ 3 - 0
.github/workflows/windows-publish.yml

@@ -40,6 +40,9 @@ jobs:
         fetch-depth: 0
     - name: Checkout & Sync & Save
       uses: ./src/electron/.github/actions/checkout
+      with:
+        generate-sas-token: 'true'
+        target-platform: win
 
   publish-x64-win:
     uses: ./.github/workflows/pipeline-segment-electron-build.yml