build: use inputs for release variables

This commit is contained in:
Keeley Hammond 2024-04-23 21:47:16 -07:00
Родитель 96120a6f4d
Коммит acb41e76aa
2 изменённых файлов: 59 добавлений и 43 удалений

94
.github/workflows/macos-build.yml поставляемый
Просмотреть файл

@ -3,24 +3,37 @@ name: Build MacOS
on:
workflow_call:
inputs:
environment:
IS_RELEASE:
required: true
type: boolean
default: false
GN_CONFIG:
required: false
type: string
default: ''
default: false//electron/build/args/testing.gn
GN_BUILD_TYPE:
required: false
type: string
default: testing
GENERATE_SYMBOLS:
required: false
type: boolean
default: false
UPLOAD_TO_STORAGE:
required: false
type: string
default: '0'
env:
# Disable pre-compiled headers to reduce out size - only useful for rebuilds
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_STORAGE_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
# 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 --custom-var=host_cpu=arm64'
IS_RELEASE: false
GN_CONFIG: //electron/build/args/testing.gn
STRIP_BINARIES: false
GENERATE_SYMBOLS: false
UPLOAD_TO_STORAGE: '0'
CHECK_DIST_MANIFEST: '1'
jobs:
checkout:
@ -140,7 +153,6 @@ jobs:
build:
runs-on: macos-13-xlarge
needs: checkout
environment: ${{ inputs.environment }}
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
@ -150,7 +162,7 @@ jobs:
- name: Load Build Tools
run: |
npm i -g @electron/build-tools
e init --root=$(pwd) --out=Default testing
e init --root=$(pwd) --out=Default ${{ inputs.GN_BUILD_TYPE }}
- name: Checkout Electron
uses: actions/checkout@v4
with:
@ -313,10 +325,16 @@ jobs:
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
cp out/Default/.ninja_log out/electron_ninja_log
node electron/script/check-symlinks.js
# TODO(vertdinde): this step doesn't happen on MAS
# - name: Build Electron Node Headers (darwin)
# run: |
# cd src
# autoninja -C out/Default third_party/electron_node:overlapped-checker -j $NUMBER_OF_NINJA_PROCESSES
# Additional Targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
- name: Build Electron dist.zip (darwin)
run: |
cd src
e build electron:electron_dist_zip $ADDITIONAL_TARGETS -j $NUMBER_OF_NINJA_PROCESSES
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
target_os=mac
target_cpu=arm64
@ -332,29 +350,25 @@ jobs:
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 [ "$SKIP_DIST_ZIP" != "1" ]; then
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
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: Build Chromedriver (darwin)
run: |
cd src
e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
e build electron:electron_chromedriver_zip
- name: Build Node Headers (darwin)
run: |
cd src
e build electron:node_headers
# NOTE (vertedinde): We strip binaries/symbols on the Linux job, not the Mac job
- name: Generate & Zip Symbols (darwin)
run: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then
# 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 [ "$IS_RELEASE" == "true" ]; then
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
@ -362,40 +376,37 @@ jobs:
# Only generate ffmpeg, hunspell, and typescript definitions for release builds
- name: Generate ffmpeg
run: |
if [ "$IS_RELEASE" == "true" ]; then
if [ ${{ inputs.IS_RELEASE }} == "true" ]; then
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
fi
- name: Generate Hunspell Dictionaries
run: |
if [ "$IS_RELEASE" == "true" ]; then
if [ ${{ inputs.IS_RELEASE }} == "true" ]; then
cd src
if [ "$SKIP_DIST_ZIP" != "1" ]; then
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
fi
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
fi
- name: Generate TypeScript Definitions
run: |
if [ "$IS_RELEASE" == "true" ]; then
if [ ${{ inputs.IS_RELEASE }} == "true" ]; then
cd src/electron
node script/yarn create-typescript-definitions
fi
# TODO(vertedinde): Don't actually upload the dist to Azure/GH yet,
# this should be one of the last things we turn on
# TODO(vertedinde): These uploads currently point to a different Azure bucket & GitHub Repo
- name: Publish Electron Dist
run: |
rm -rf src/out/Default/obj
cd src/electron
if [ "$UPLOAD_TO_STORAGE" == "1" ]; then
if [ ${{ inputs.UPLOAD_TO_STORAGE }} == "1" ]; then
echo 'Uploading Electron release distribution to Azure'
script/release/uploaders/upload.py --verbose --upload_to_storage
# script/release/uploaders/upload.py --verbose --upload_to_storage
else
echo 'Uploading Electron release distribution to GitHub releases'
script/release/uploaders/upload.py --verbose
# script/release/uploaders/upload.py --verbose
fi
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI
# tp ensure we don't break anything, but we may be able to improve that.
# 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
@ -443,10 +454,11 @@ jobs:
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
cp out/Default/.ninja_log out/electron_ninja_log
node electron/script/check-symlinks.js
# Additional Targets: shell_browser_ui_unittests third_party/electron_node:headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
- name: Build Electron dist.zip (mas)
run: |
cd src
e build electron:electron_dist_zip $ADDITIONAL_TARGETS -j $NUMBER_OF_NINJA_PROCESSES
e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
target_os=mac_mas
target_cpu=arm64
@ -462,10 +474,8 @@ jobs:
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 [ "$SKIP_DIST_ZIP" != "1" ]; then
e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
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: Build Chromedriver (mas)
run: |
cd src
@ -477,14 +487,14 @@ jobs:
e build electron:node_headers
- name: Generate & Zip Symbols (mas)
run: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then
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 [ "$IS_RELEASE" == "true" ]; then
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
@ -517,7 +527,7 @@ jobs:
src/v8/tools/builtins-pgo
key: ${{ runner.os }}-build-artifacts-mas-${{ github.sha }}
test:
# if: ${{ env.IS_RELEASE != true }} TODO FIX THIS
if: ${{ inputs.IS_RELEASE == false }}
runs-on: macos-13-xlarge
needs: build
strategy:
@ -530,7 +540,7 @@ jobs:
- name: Load Build Tools
run: |
npm i -g @electron/build-tools
e init --root=$(pwd) --out=Default testing
e init --root=$(pwd) --out=Default ${{ inputs.GN_BUILD_TYPE }}
- name: Checkout Electron
uses: actions/checkout@v4
with:

8
.github/workflows/macos-publish.yml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@ on:
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
default: '0'
default: '1'
type: string
run-macos-publish:
description: 'Run the publish jobs vs just the build jobs'
@ -21,4 +21,10 @@ on:
jobs:
publish:
uses: electron/electron/.github/workflows/macos-build.yml@gh-macos-publish
with:
IS_RELEASE: true
GN_CONFIG: //electron/build/args/release.gn
GN_BUILD_TYPE: release
GENERATE_SYMBOLS: true
UPLOAD_TO_STORAGE: ${{ inputs.upload-to-storage }}
secrets: inherit