build: run gn-check for windows on linux hosts for speed

This commit is contained in:
Samuel Attard
2024-10-02 21:09:10 -07:00
parent 868b800fe9
commit f40456a426
8 changed files with 172 additions and 34 deletions

View File

@@ -136,6 +136,28 @@ jobs:
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
checkout-windows:
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
runs-on: electron-arc-linux-amd64-32core
container:
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
env:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
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
windows-x64:
permissions:
contents: read
@@ -146,7 +168,6 @@ jobs:
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
check-runs-on: electron-arc-linux-amd64-8core
test-runs-on: windows-latest
target-platform: windows
target-arch: x64
@@ -156,13 +177,26 @@ jobs:
upload-to-storage: '0'
secrets: inherit
windows-gn-check:
strategy:
matrix:
arch: [x64, x86, arm64]
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-windows
with:
target-platform: windows
target-arch: ${{ matrix.arch }}
check-runs-on: electron-arc-linux-amd64-8core
gn-build-type: testing
secrets: inherit
# Build Jobs - These cascade into testing jobs
macos-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
@@ -181,7 +215,7 @@ jobs:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-macos
with:
build-runs-on: macos-14-xlarge
@@ -200,7 +234,7 @@ jobs:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check-and-nan.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
@@ -221,7 +255,7 @@ jobs:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
@@ -243,7 +277,7 @@ jobs:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core
@@ -264,7 +298,7 @@ jobs:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
uses: ./.github/workflows/pipeline-electron-build-and-test-and-check.yml
needs: checkout-linux
with:
build-runs-on: electron-arc-linux-amd64-32core

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux.'
required: true
target-arch:
type: string

View File

@@ -0,0 +1,104 @@
name: Electron Build & Test Pipeline
on:
workflow_call:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos, windows 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
check-runs-on:
type: string
description: 'What host to run the gn-check'
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}'
test-container:
type: string
description: 'JSON container information for testing'
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'
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions:
contents: read
issues: read
pull-requests: read
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 }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit
gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.check-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
is-asan: ${{ inputs.is-asan }}
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.test-container }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string
@@ -15,10 +15,6 @@ on:
type: string
description: 'What host to run the build'
required: true
check-runs-on:
type: string
description: 'What host to run the gn-check'
required: true
test-runs-on:
type: string
description: 'What host to run the tests on'
@@ -82,16 +78,6 @@ jobs:
upload-to-storage: ${{ inputs.upload-to-storage }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit
# gn-check:
# uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
# with:
# target-platform: ${{ inputs.target-platform }}
# target-arch: ${{ inputs.target-arch }}
# check-runs-on: ${{ inputs.check-runs-on }}
# check-container: ${{ inputs.build-container }}
# gn-build-type: ${{ inputs.gn-build-type }}
# is-asan: ${{ inputs.is-asan }}
# secrets: inherit
test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml
needs: build

View File

@@ -9,7 +9,7 @@ on:
type: string
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string
@@ -37,7 +37,7 @@ concurrency:
env:
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
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' }}
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }}
ELECTRON_OUT_DIR: Default
TARGET_ARCH: ${{ inputs.target-arch }}
@@ -109,6 +109,15 @@ jobs:
GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Win/cross
if: ${{ inputs.target-platform == 'windows' }}
run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Enable windows toolchain
if: ${{ inputs.target-platform == 'windows' }}
run: |
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Generate DEPS Hash
run: |
node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash && cat src/electron/.depshash-target
@@ -119,11 +128,16 @@ jobs:
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy
- name: Restore src cache via AKS
if: ${{ inputs.target-platform != 'macos' }}
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'windows' }}
uses: ./src/electron/.github/actions/restore-cache-aks
- 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}]"
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
if [ "${{ inputs.target-platform }}" = "windows" ]; then
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
echo "target_os=['win']" >> tmpgclient
fi
gclient runhooks --gclientfile=tmpgclient
- name: Regenerate DEPS Hash
run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
@@ -145,10 +159,10 @@ jobs:
- name: Run GN Check
run: |
cd src
gn check out/Default //electron:electron_lib
gn check out/Default //electron:electron_app
gn check out/Default //electron/shell/common:mojo
gn check out/Default //electron/shell/common:plugin
e d gn check out/Default //electron:electron_lib
e d gn check out/Default //electron:electron_app
e d gn check out/Default //electron/shell/common:mojo
e d gn check out/Default //electron/shell/common:plugin
# Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string

View File

@@ -5,7 +5,7 @@ on:
inputs:
target-platform:
type: string
description: 'Platform to run on, can be macos or linux'
description: 'Platform to run on, can be macos, windows or linux'
required: true
target-arch:
type: string