Compare commits

..

42 Commits

Author SHA1 Message Date
Samuel Attard
796be5100a restore testing 2024-06-15 20:33:05 -07:00
Samuel Attard
f0923d8ca8 test a release build for fun 2024-06-15 18:51:36 -07:00
Samuel Attard
755a667b7c normalize test path 2024-06-15 16:42:59 -07:00
Samuel Attard
3e5e61ae96 maybe fix gn check? 2024-06-15 16:17:36 -07:00
Samuel Attard
00472c7e15 copy node.lib 2024-06-15 16:08:54 -07:00
Samuel Attard
60e769a12f msvs 2022 2024-06-15 13:14:50 -07:00
Samuel Attard
e2f9230952 Update move-artifacts.sh 2024-06-15 12:48:46 -07:00
Samuel Attard
2015489829 ez 2024-06-15 12:28:11 -07:00
Samuel Attard
3dab62a5b0 no symlinks for win restore 2024-06-15 12:04:54 -07:00
Samuel Attard
973ed113ec restore src cache win gn check 2024-06-15 11:49:34 -07:00
Samuel Attard
0b709a9fd4 fix src tar 2024-06-15 11:39:21 -07:00
Samuel Attard
8172dee9d1 fix windows gn check 2024-06-15 00:20:43 -07:00
Samuel Attard
69412cb5f1 cry sigh move on 2024-06-15 00:12:50 -07:00
Samuel Attard
684a029d92 maybe fix gn check 2024-06-14 23:56:30 -07:00
Samuel Attard
f32e8766a7 build: fix artifact src thingy 2024-06-14 23:47:09 -07:00
Samuel Attard
41447af5bb Merge remote-tracking branch 'origin/main' into win-cross 2024-06-14 23:37:09 -07:00
Samuel Attard
4a92ec0e90 build: add skip-windows flag 2024-06-14 23:36:14 -07:00
Samuel Attard
af4eaada02 build: run tests on windows normally 2024-06-14 23:22:05 -07:00
Samuel Attard
7ab051c083 build: fix dirs arr 2024-06-14 22:05:58 -05:00
Samuel Attard
062580c4a5 fix deref 2024-06-14 17:44:50 -05:00
Samuel Attard
6af09fc7b8 deref symlink 2024-06-14 16:23:58 -05:00
Samuel Attard
258da5e0d5 chore: set build-type 2024-06-14 15:57:32 -05:00
Samuel Attard
218b836e28 test no need split 2024-06-14 15:34:23 -05:00
Samuel Attard
534e4c1236 halp 2024-06-14 15:10:43 -05:00
Samuel Attard
c958cccd22 build: windows tests on windows hosts 2024-06-14 14:53:41 -05:00
Samuel Attard
7f9f9f34b5 Merge remote-tracking branch 'origin/main' into win-cross 2024-06-14 14:50:54 -05:00
Samuel Attard
e9b8188e9f build: fix artifact platform 2024-06-14 14:49:44 -05:00
Samuel Attard
89d77e39f4 foo 2024-06-14 12:15:47 -05:00
Samuel Attard
1a0bac3328 Merge remote-tracking branch 'origin/main' into win-cross 2024-06-14 12:13:09 -05:00
Samuel Attard
f6fc8b204b target-platform not uname 2024-06-14 11:46:22 -05:00
Samuel Attard
6d6f7d0ee6 force snapshot 2024-06-14 11:22:06 -05:00
Samuel Attard
2649a5bbec check right manifest 2024-06-14 11:01:14 -05:00
Samuel Attard
72b5e59dce build: checkout should invalidate src cache 2024-06-14 09:01:50 -05:00
Samuel Attard
4cd51a13b0 nuke vs toolchain 2024-06-14 08:49:46 -05:00
Samuel Attard
5677aab327 restore win x 2024-06-14 02:40:36 -05:00
Samuel Attard
d6ad4ca931 crying 2024-06-14 02:35:30 -05:00
Samuel Attard
2d756bfa0b make fuse fs 2024-06-14 02:28:28 -05:00
Samuel Attard
821feffdd3 fix: add e d for toolchain vars 2024-06-14 01:39:02 -05:00
Samuel Attard
6c47012326 fix: add e d for toolchain vars 2024-06-14 01:26:21 -05:00
Samuel Attard
61dfa7ebc3 build: force enable win toolchain 2024-06-14 01:04:52 -05:00
Samuel Attard
86dfd98746 build: add fuse cap to docker windows cross checkout 2024-06-14 00:44:43 -05:00
Samuel Attard
8f7c6d7a81 build: try win/cross on gha 2024-06-14 00:31:49 -05:00
1559 changed files with 33915 additions and 53085 deletions

1
.circleci/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config-staging

79
.circleci/config.yml Normal file
View File

@@ -0,0 +1,79 @@
version: 2.1
# Required for dynamic configuration
setup: true
# Orbs
orbs:
path-filtering: circleci/path-filtering@0.1.0
continuation: circleci/continuation@0.2.0
# All input parameters to pass to build config
parameters:
run-docs-only:
type: boolean
default: false
upload-to-storage:
type: string
default: '1'
run-build-linux:
type: boolean
default: false
run-build-mac:
type: boolean
default: false
run-linux-publish:
type: boolean
default: false
linux-publish-arch-limit:
type: enum
default: all
enum: ["all", "arm", "arm64", "x64", "ia32"]
run-macos-publish:
type: boolean
default: false
macos-publish-arch-limit:
type: enum
default: all
enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]
jobs:
generate-config:
docker:
- image: cimg/node:16.14
steps:
- checkout
- path-filtering/set-parameters:
base-revision: main
mapping: |
^((?!docs/).)*$ run-build-mac true
^((?!docs/).)*$ run-build-linux true
docs/.* run-docs-only true
^((?!docs/).)*$ run-docs-only false
- run:
command: |
cd .circleci/config
yarn
export CIRCLECI_BINARY="$HOME/circleci"
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | DESTDIR=$CIRCLECI_BINARY bash
node build.js
name: Pack config.yml
- run:
name: Set params
command: node .circleci/config/params.js
- continuation/continue:
configuration_path: .circleci/config-staging/built.yml
parameters: /tmp/pipeline-parameters.json
# Initial setup workflow
workflows:
setup:
jobs:
- generate-config

2473
.circleci/config/base.yml Normal file

File diff suppressed because it is too large Load Diff

34
.circleci/config/build.js Normal file
View File

@@ -0,0 +1,34 @@
const cp = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const yaml = require('js-yaml');
const STAGING_DIR = path.resolve(__dirname, '..', 'config-staging');
function copyAndExpand(dir = './') {
const absDir = path.resolve(__dirname, dir);
const targetDir = path.resolve(STAGING_DIR, dir);
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir);
}
for (const file of fs.readdirSync(absDir)) {
if (!file.endsWith('.yml')) {
if (fs.statSync(path.resolve(absDir, file)).isDirectory()) {
copyAndExpand(path.join(dir, file));
}
continue;
}
fs.writeFileSync(path.resolve(targetDir, file), yaml.dump(yaml.load(fs.readFileSync(path.resolve(absDir, file), 'utf8')), {
noRefs: true,
}));
}
}
if (fs.pathExists(STAGING_DIR)) fs.removeSync(STAGING_DIR);
copyAndExpand();
const output = cp.spawnSync(process.env.CIRCLECI_BINARY || 'circleci', ['config', 'pack', STAGING_DIR]);
fs.writeFileSync(path.resolve(STAGING_DIR, 'built.yml'), output.stdout.toString());

View File

@@ -0,0 +1,51 @@
executor:
name: linux-docker
size: medium
steps:
- checkout:
path: src/electron
- run:
name: Setup third_party Depot Tools
command: |
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
echo 'export PATH="$PATH:'"$PWD"'/src/third_party/depot_tools"' >> $BASH_ENV
- run:
name: Download GN Binary
command: |
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
cipd ensure -ensure-file - -root . \<<-CIPD
\$ServiceURL https://chrome-infra-packages.appspot.com/
@Subdir src/buildtools/linux64
gn/gn/linux-amd64 $gn_version
CIPD
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
- run:
name: Download clang-format Binary
command: |
chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
mkdir -p src/buildtools
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
gclient runhooks --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
- run:
name: Run Lint
command: |
# gn.py tries to find a gclient root folder starting from the current dir.
# When it fails and returns "None" path, the whole script fails. Let's "fix" it.
touch .gclient
# Another option would be to checkout "buildtools" inside the Electron checkout,
# but then we would lint its contents (at least gn format), and it doesn't pass it.
cd src/electron
node script/yarn install --frozen-lockfile
node script/yarn lint
- run:
name: Run Script Typechecker
command: |
cd src/electron
node script/yarn tsc -p tsconfig.script.json

View File

@@ -0,0 +1,10 @@
{
"name": "@electron/circleci-config",
"version": "0.0.0",
"private": true,
"license": "MIT",
"dependencies": {
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0"
}
}

View File

@@ -0,0 +1,12 @@
const fs = require('fs');
const PARAMS_PATH = '/tmp/pipeline-parameters.json';
const content = JSON.parse(fs.readFileSync(PARAMS_PATH, 'utf-8'));
// Choose resource class for linux hosts
const currentBranch = process.env.CIRCLE_BRANCH || '';
content['large-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? '2xlarge' : 'electronjs/aks-linux-large';
content['medium-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? 'medium' : 'electronjs/aks-linux-medium';
fs.writeFileSync(PARAMS_PATH, JSON.stringify(content));

View File

@@ -0,0 +1,43 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
fs-extra@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"
universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

8
.circleci/fix-known-hosts.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
mkdir -p ~/.ssh
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts

View File

@@ -25,19 +25,9 @@ Codespaces doesn't lean very well into gclient based checkouts, the directory st
/workspaces/electron /workspaces/electron
``` ```
## Reclient ## Goma
If you are a maintainer [with Reclient access](../docs/development/reclient.md) you'll need to ensure you're authenticated when you spin up a new codespaces instance. You can validate this by checking `e d rbe info` - your build-tools configuration should have `Access` type `Cache & Execute`: If you are a maintainer [with Goma access](../docs/development/goma.md) it should be automatically configured and authenticated when you spin up a new codespaces instance. You can validate this by checking `e d goma_auth info` or by checking that your build-tools configuration has a goma mode of `cluster`.
```console
Authentication Status: Authenticated
Since: 2024-05-28 10:29:33 +0200 CEST
Expires: 2024-08-26 10:29:33 +0200 CEST
...
Access: Cache & Execute
```
To authenticate if you're not logged in, run `e d rbe login` and follow the link to authenticate.
## Running Electron ## Running Electron

View File

@@ -1,5 +1,4 @@
{ {
"name": "Electron Core Development Environment",
"dockerComposeFile": "docker-compose.yml", "dockerComposeFile": "docker-compose.yml",
"service": "buildtools", "service": "buildtools",
"onCreateCommand": ".devcontainer/on-create-command.sh", "onCreateCommand": ".devcontainer/on-create-command.sh",
@@ -34,15 +33,28 @@
"surajbarkale.ninja", "surajbarkale.ninja",
"ms-vscode.cpptools", "ms-vscode.cpptools",
"mutantdino.resourcemonitor", "mutantdino.resourcemonitor",
"dsanders11.vscode-electron-build-tools",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"shakram02.bash-beautify", "shakram02.bash-beautify",
"marshallofsound.gnls-electron" "marshallofsound.gnls-electron",
"CircleCI.circleci"
], ],
"settings": { "settings": {
"editor.tabSize": 2, "editor.tabSize": 2,
"bashBeautify.tabSize": 2, "bashBeautify.tabSize": 2,
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"[gn]": {
"editor.formatOnSave": true
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"javascript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single" "typescript.preferences.quoteStyle": "single"
} }

View File

@@ -2,7 +2,7 @@ version: '3'
services: services:
buildtools: buildtools:
image: ghcr.io/electron/devcontainer:424eedbf277ad9749ffa9219068aa72ed4a5e373 image: ghcr.io/electron/devcontainer:9a43c14f5c19be0359843299f79e736521373adc
volumes: volumes:
- ..:/workspaces/gclient/src/electron:cached - ..:/workspaces/gclient/src/electron:cached

View File

@@ -59,6 +59,7 @@ if [ ! -f $buildtools/configs/evm.testing.json ]; then
\"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\", \"\$schema\": \"file:///home/builduser/.electron_build_tools/evm-config.schema.json\",
\"configValidationLevel\": \"strict\", \"configValidationLevel\": \"strict\",
\"reclient\": \"$1\", \"reclient\": \"$1\",
\"goma\": \"none\",
\"preserveXcode\": 5 \"preserveXcode\": 5
} }
" >$buildtools/configs/evm.testing.json " >$buildtools/configs/evm.testing.json

View File

@@ -1,4 +1,6 @@
# These env vars are only necessary for creating Electron releases. # These env vars are only necessary for creating Electron releases.
# See docs/development/releasing.md # See docs/development/releasing.md
APPVEYOR_CLOUD_TOKEN=
CIRCLE_TOKEN=
ELECTRON_GITHUB_TOKEN= ELECTRON_GITHUB_TOKEN=

View File

@@ -19,40 +19,7 @@
"prefer-const": ["error", { "prefer-const": ["error", {
"destructuring": "all" "destructuring": "all"
}], }],
"n/no-callback-literal": "off", "standard/no-callback-literal": "off"
"import/newline-after-import": "error",
"import/order": ["error", {
"alphabetize": {
"order": "asc"
},
"newlines-between": "always",
"pathGroups": [
{
"pattern": "@electron/internal/**",
"group": "external",
"position": "before"
},
{
"pattern": "@electron/**",
"group": "external",
"position": "before"
},
{
"pattern": "{electron,electron/**}",
"group": "external",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": [],
"distinctGroup": true,
"groups": [
"external",
"builtin",
["sibling", "parent"],
"index",
"type"
]
}]
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 6, "ecmaVersion": 6,

4
.gitattributes vendored
View File

@@ -1,9 +1,6 @@
# `git apply` and friends don't understand CRLF, even on windows. Force those # `git apply` and friends don't understand CRLF, even on windows. Force those
# files to be checked out with LF endings even if core.autocrlf is true. # files to be checked out with LF endings even if core.autocrlf is true.
*.patch text eol=lf *.patch text eol=lf
DEPS text eol=lf
yarn.lock text eol=lf
script/zip_manifests/*.manifest text eol=lf
patches/**/.patches merge=union patches/**/.patches merge=union
# Source code and markdown files should always use LF as line ending. # Source code and markdown files should always use LF as line ending.
@@ -25,7 +22,6 @@ patches/**/.patches merge=union
*.md text eol=lf *.md text eol=lf
*.mm text eol=lf *.mm text eol=lf
*.mojom text eol=lf *.mojom text eol=lf
*.patches text eol=lf
*.proto text eol=lf *.proto text eol=lf
*.py text eol=lf *.py text eol=lf
*.ps1 text eol=lf *.ps1 text eol=lf

9
.github/CODEOWNERS vendored
View File

@@ -11,15 +11,12 @@ DEPS @electron/wg-upgrades
/docs/breaking-changes.md @electron/wg-releases /docs/breaking-changes.md @electron/wg-releases
/npm/ @electron/wg-releases /npm/ @electron/wg-releases
/script/release @electron/wg-releases /script/release @electron/wg-releases
appveyor.yml @electron/wg-releases
appveyor-bake.yml @electron/wg-releases
appveyor-woa.yml @electron/wg-releases
# Security WG # Security WG
/lib/browser/devtools.ts @electron/wg-security /lib/browser/devtools.ts @electron/wg-security
/lib/browser/guest-view-manager.ts @electron/wg-security /lib/browser/guest-view-manager.ts @electron/wg-security
/lib/browser/rpc-server.ts @electron/wg-security /lib/browser/rpc-server.ts @electron/wg-security
/lib/renderer/security-warnings.ts @electron/wg-security /lib/renderer/security-warnings.ts @electron/wg-security
# Infra WG
/.github/actions/ @electron/wg-infra
/.github/workflows/*-publish.yml @electron/wg-infra
/.github/workflows/build.yml @electron/wg-infra
/.github/workflows/pipeline-*.yml @electron/wg-infra

View File

@@ -1,6 +1,6 @@
name: Bug Report name: Bug Report
description: Report a bug in Electron description: Report an Electron bug
type: 'bug' title: "[Bug]: "
labels: "bug :beetle:" labels: "bug :beetle:"
body: body:
- type: checkboxes - type: checkboxes
@@ -20,14 +20,13 @@ body:
description: | description: |
What version of Electron are you using? What version of Electron are you using?
Note: Please only report issues for [currently supported versions of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline). Note: Please only report issues for [currently supported versions of Electron](https://www.electronjs.org/docs/latest/tutorial/support#currently-supported-versions).
placeholder: 32.0.0 placeholder: 17.0.0
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
attributes: attributes:
label: What operating system(s) are you using? label: What operating system are you using?
multiple: true
options: options:
- Windows - Windows
- macOS - macOS
@@ -73,7 +72,7 @@ body:
- type: input - type: input
attributes: attributes:
label: Testcase Gist URL label: Testcase Gist URL
description: Electron maintainers need a standalone test case to reproduce and fix your issue. Please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com). Then put the gist URL here. Issues without testcase gists receive less attention and might be closed without a maintainer taking a closer look. To maximize how much attention your issue receives, please include a testcase gist right from the start. description: If you can reproduce the issue in a standalone test case, please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com) and put the gist URL here. This is **the best way** to ensure this issue is triaged quickly.
placeholder: https://gist.github.com/... placeholder: https://gist.github.com/...
- type: textarea - type: textarea
attributes: attributes:

View File

@@ -1,4 +1,3 @@
blank_issues_enabled: false
contact_links: contact_links:
- name: Discord Chat - name: Discord Chat
url: https://discord.gg/APGC3k5yaH url: https://discord.gg/APGC3k5yaH

View File

@@ -1,6 +1,6 @@
name: Feature Request name: Feature Request
description: Suggest an idea for Electron description: Suggest an idea for Electron
type: 'enhancement' title: "[Feature Request]: "
labels: "enhancement :sparkles:" labels: "enhancement :sparkles:"
body: body:
- type: checkboxes - type: checkboxes

View File

@@ -1,14 +0,0 @@
name: Maintainer Issue (not for public use)
description: Only to be created by Electron maintainers
body:
- type: checkboxes
attributes:
label: Confirmation
options:
- label: I am a [maintainer](https://github.com/orgs/electron/people) of the Electron project. (If not, please create a [different issue type](https://github.com/electron/electron/issues/new/).)
required: true
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -13,7 +13,7 @@ Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.
- [ ] PR description included and stakeholders cc'd - [ ] PR description included and stakeholders cc'd
- [ ] `npm test` passes - [ ] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md) - [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md) - [ ] relevant documentation, tutorials, templates and examples are changed or added
- [ ] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples). - [ ] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).
#### Release Notes #### Release Notes

View File

@@ -5,10 +5,10 @@ inputs:
description: 'Target arch' description: 'Target arch'
required: true required: true
target-platform: target-platform:
description: 'Target platform, should be linux, win, macos' description: 'Target platform'
required: true required: true
artifact-platform: artifact-platform:
description: 'Artifact platform, should be linux, win, darwin or mas' description: 'Artifact platform, should be linux, darwin or mas'
required: true required: true
step-suffix: step-suffix:
description: 'Suffix for build steps' description: 'Suffix for build steps'
@@ -17,18 +17,12 @@ inputs:
is-release: is-release:
description: 'Is release build' description: 'Is release build'
required: true required: true
strip-binaries:
description: 'Strip binaries (Linux only)'
required: false
generate-symbols: generate-symbols:
description: 'Generate symbols' description: 'Generate symbols'
required: true required: true
upload-to-storage: upload-to-storage:
description: 'Upload to storage' description: 'Upload to storage'
required: true required: true
is-asan:
description: 'The ASan Linux build'
required: false
runs: runs:
using: "composite" using: "composite"
steps: steps:
@@ -36,11 +30,14 @@ runs:
shell: bash shell: bash
if: ${{ inputs.target-arch == 'x64' && inputs.target-platform == 'macos' }} if: ${{ inputs.target-arch == 'x64' && inputs.target-platform == 'macos' }}
run: | run: |
GN_APPENDED_ARGS="$GN_EXTRA_ARGS target_cpu=\"x64\" v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\"" GN_APPENDED_ARGS="$GN_EXTRA_ARGS v8_snapshot_toolchain=\"//build/toolchain/mac:clang_x64\""
echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV echo "GN_EXTRA_ARGS=$GN_APPENDED_ARGS" >> $GITHUB_ENV
- name: Add Clang problem matcher - name: Set GN_EXTRA_ARGS for Win/cross
shell: bash shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json" 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: Build Electron ${{ inputs.step-suffix }} - name: Build Electron ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
@@ -60,21 +57,13 @@ runs:
NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES NINJA_SUMMARIZE_BUILD=1 e build -j $NUMBER_OF_NINJA_PROCESSES
cp out/Default/.ninja_log out/electron_ninja_log cp out/Default/.ninja_log out/electron_ninja_log
node electron/script/check-symlinks.js node electron/script/check-symlinks.js
- name: Strip Electron Binaries ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.strip-binaries == 'true' }}
run: |
cd src
electron/script/copy-debug-symbols.py --target-cpu="${{ inputs.target-arch }}" --out-dir=out/Default/debug --compress
electron/script/strip-binaries.py --target-cpu="${{ inputs.target-arch }}" --verbose
electron/script/add-debug-link.py --target-cpu="${{ inputs.target-arch }}" --debug-dir=out/Default/debug
- name: Build Electron dist.zip ${{ inputs.step-suffix }} - name: Build Electron dist.zip ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES -d explain e build electron:electron_dist_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.is-asan }}" != "true" ]; then if [ "${{ env.CHECK_DIST_MANIFEST }}" = "true" ]; then
target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }} target_os=${{ inputs.target-platform == 'linux' && 'linux' || (inputs.target-platform == 'windows' && 'win' || 'mac') }}
if [ "${{ inputs.artifact-platform }}" = "mas" ]; then if [ "${{ inputs.artifact-platform }}" = "mas" ]; then
target_os="${target_os}_mas" target_os="${target_os}_mas"
fi fi
@@ -84,8 +73,8 @@ runs:
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES e build electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
# Remove unused args from mksnapshot_args # Remove unused args from mksnapshot_args
SEDOPTION="-i" SEDOPTION="-i"
if [ "`uname`" = "Darwin" ]; then if [ "`uname`" = "Darwin" ]; then
@@ -93,6 +82,7 @@ runs:
fi fi
sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--turbo-profiling-input/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 [ "${{ inputs.target-platform }}" = "linux" ]; then if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "${{ inputs.target-arch }}" = "arm" ]; then if [ "${{ inputs.target-arch }}" = "arm" ]; then
@@ -107,16 +97,8 @@ runs:
fi fi
fi fi
e build --target electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES e build electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
if [ "${{ inputs.target-platform }}" = "win" ]; then
cd out/Default
powershell Compress-Archive -update mksnapshot_args mksnapshot.zip
powershell mkdir mktmp\\gen\\v8
powershell Copy-Item gen\\v8\\embedded.S mktmp\\gen\\v8
powershell Compress-Archive -update -Path mktmp\\gen mksnapshot.zip
else
(cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
fi
- name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }} - name: Generate Cross-Arch Snapshot (arm/arm64) ${{ inputs.step-suffix }}
shell: bash shell: bash
if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }} if: ${{ (inputs.target-arch == 'arm' || inputs.target-arch == 'arm64') && inputs.target-platform == 'linux' }}
@@ -141,43 +123,24 @@ runs:
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES e build electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:electron_chromedriver_zip e build electron:electron_chromedriver_zip
- name: Build Node.js headers ${{ inputs.step-suffix }} - name: Build Node.js headers ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
cd src cd src
e build --target electron:node_headers e build electron:node_headers
- name: Create installed_software.json ${{ inputs.step-suffix }}
shell: powershell
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- name: Profile Windows Toolchain ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
cd src
python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- name: Add msdia140.dll to Path ${{ inputs.step-suffix }}
shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }}
run: |
# Needed for msdia140.dll on 64-bit windows
cd src
export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin"
- name: Generate & Zip Symbols ${{ inputs.step-suffix }} - name: Generate & Zip Symbols ${{ inputs.step-suffix }}
shell: bash shell: bash
run: | run: |
# Generate breakpad symbols on release builds # Generate breakpad symbols on release builds
if [ "${{ inputs.generate-symbols }}" = "true" ]; then if [ "${{ inputs.generate-symbols }}" = "true" ]; then
e build --target electron:electron_symbols e build electron:electron_symbols
fi fi
cd src cd src
export BUILD_PATH="$(pwd)/out/Default" export BUILD_PATH="$(pwd)/out/Default"
e build --target electron:licenses e build electron:licenses
e build --target electron:electron_version_file e build electron:electron_version_file
if [ "${{ inputs.is-release }}" = "true" ]; then if [ "${{ inputs.is-release }}" = "true" ]; then
DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
else else
@@ -189,28 +152,28 @@ runs:
run: | run: |
cd src cd src
gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS" 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 autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }} - name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
shell: bash shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: | run: |
e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES cd src
autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Generate Libcxx ${{ inputs.step-suffix }} - name: Generate Libcxx ${{ inputs.step-suffix }}
shell: bash shell: bash
if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
run: | run: |
e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES cd src
e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
- name: Remove Clang problem matcher autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
shell: bash
run: echo "::remove-matcher owner=clang::"
- name: Generate TypeScript Definitions ${{ inputs.step-suffix }} - name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }} if: ${{ inputs.is-release == 'true' }}
shell: bash shell: bash
run: | run: |
cd src/electron cd src/electron
node script/yarn create-typescript-definitions 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 }} - name: Publish Electron Dist ${{ inputs.step-suffix }}
if: ${{ inputs.is-release == 'true' }} if: ${{ inputs.is-release == 'true' }}
shell: bash shell: bash
@@ -224,15 +187,6 @@ runs:
echo 'Uploading Electron release distribution to GitHub releases' echo 'Uploading Electron release distribution to GitHub releases'
script/release/uploaders/upload.py --verbose script/release/uploaders/upload.py --verbose
fi fi
- name: Generate Artifact Key
shell: bash
run: |
if [ "${{ inputs.is-asan }}" = "true" ]; then
ARTIFACT_KEY=${{ inputs.artifact-platform }}_${{ inputs.target-arch }}_asan
else
ARTIFACT_KEY=${{ inputs.artifact-platform }}_${{ inputs.target-arch }}
fi
echo "ARTIFACT_KEY=$ARTIFACT_KEY" >> $GITHUB_ENV
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI # 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. # 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 }} - name: Move all Generated Artifacts to Upload Folder ${{ inputs.step-suffix }}
@@ -241,10 +195,10 @@ runs:
- name: Upload Generated Artifacts ${{ inputs.step-suffix }} - name: Upload Generated Artifacts ${{ inputs.step-suffix }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with: with:
name: generated_artifacts_${{ env.ARTIFACT_KEY }} name: generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ inputs.artifact-platform }}_${{ inputs.target-arch }} path: ./generated_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
- name: Upload Src Artifacts ${{ inputs.step-suffix }} - name: Upload Src Artifacts ${{ inputs.step-suffix }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with: with:
name: src_artifacts_${{ env.ARTIFACT_KEY }} name: src_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}
path: ./src_artifacts_${{ inputs.artifact-platform }}_${{ inputs.target-arch }} path: ./src_artifacts_${{ inputs.artifact-platform }}_${{ env.TARGET_ARCH }}

View File

@@ -5,12 +5,6 @@ inputs:
description: 'Whether to generate and persist a SAS token for the item in the cache' description: 'Whether to generate and persist a SAS token for the item in the cache'
required: false required: false
default: 'false' default: 'false'
use-cache:
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: runs:
using: "composite" using: "composite"
steps: steps:
@@ -19,70 +13,63 @@ runs:
run: | run: |
echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV echo "GIT_CACHE_PATH=$(pwd)/git-cache" >> $GITHUB_ENV
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies shell: bash
- name: Set Chromium Git Helper run: |
uses: ./src/electron/.github/actions/set-chromium-git-helper cd src/electron
- name: Install Build Tools node script/yarn install
uses: ./src/electron/.github/actions/install-build-tools - name: Load Build Tools
shell: bash
run: |
export BUILD_TOOLS_SHA=2f67e10b9b6b5700b1c7940df412b0345257d9ae
npm i -g @electron/build-tools
e auto-update disable
- name: Get Depot Tools
shell: bash
run: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
# Remove swift-format dep from cipd on macOS until we send a patch upstream.
cd depot_tools
git apply --3way ../src/electron/.github/workflows/config/gclient.diff
# Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools
touch .disable_auto_update
- name: Add Depot Tools to PATH
shell: bash
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Generate DEPS Hash - name: Generate DEPS Hash
shell: bash shell: bash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
DEPSHASH="v1-src-cache-$(cat src/electron/.depshash)" echo "DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
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 - name: Generate SAS Key
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
shell: bash shell: bash
run: | run: |
curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$CACHE_FILE?platform=${{ inputs.target-platform }}" > sas-token curl --unix-socket /var/run/sas/sas.sock --fail "http://foo/$DEPSHASH.tar" > sas-token
- name: Save SAS Key - name: Save SAS Key
if: ${{ inputs.generate-sas-token == 'true' }} if: ${{ inputs.generate-sas-token == 'true' }}
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf uses: actions/cache/save@v4
with: with:
path: sas-token path: |
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }} sas-token
enableCrossOsArchive: true key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
- name: Check If Cache Exists - name: Check If Cache Exists
id: check-cache id: check-cache
shell: bash shell: bash
run: | run: |
if [[ "${{ inputs.use-cache }}" == "false" ]]; then cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Not using cache this time..."
echo "cache_exists=false" >> $GITHUB_OUTPUT
else
cache_path=$CACHE_DRIVE/$CACHE_FILE
echo "Using cache key: $DEPSHASH" echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path" echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ] || [ `du $cache_path | cut -f1` = "0" ]; then if [ ! -f "$cache_path" ]; then
echo "cache_exists=false" >> $GITHUB_OUTPUT echo "cache_exists=false" >> $GITHUB_OUTPUT
echo "Cache Does Not Exist for $DEPSHASH" echo "Cache Does Not Exist for $DEPSHASH"
else else
echo "cache_exists=true" >> $GITHUB_OUTPUT echo "cache_exists=true" >> $GITHUB_OUTPUT
echo "Cache Already Exists for $DEPSHASH, Skipping.." echo "Cache Already Exists for $DEPSHASH, Skipping.."
fi fi
fi
- name: Check cross instance cache disk space
if: steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true'
shell: bash
run: |
# if there is less than 35 GB free space then creating the cache might fail so exit early
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
else
echo "The cross mount cache has $freespace_human free space - continuing"
fi
- name: Add patch conflict problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/patch-conflict.json"
- name: Gclient Sync - name: Gclient Sync
if: steps.check-cache.outputs.cache_exists == 'false' if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
@@ -97,8 +84,8 @@ runs:
echo "target_os=['$TARGET_OS']" >> ./.gclient echo "target_os=['$TARGET_OS']" >> ./.gclient
fi fi
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vvvvv
if [[ "${{ inputs.is-release }}" != "true" ]]; then if [ "${{ inputs.is-release }}" != "true" ]; then
# Re-export all the patches to check if there were changes. # Re-export all the patches to check if there were changes.
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron cd src/electron
@@ -110,7 +97,7 @@ runs:
# Export it # Export it
mkdir -p ../../patches mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
if node ./script/push-patch.js; then if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
echo echo
echo "======================================================================" echo "======================================================================"
echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch" echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
@@ -123,24 +110,11 @@ runs:
echo "There were changes to the patches when applying." echo "There were changes to the patches when applying."
echo "Check the CI artifacts for a patch you can apply to fix it." echo "Check the CI artifacts for a patch you can apply to fix it."
echo "======================================================================" echo "======================================================================"
echo
cat ../../patches/update-patches.patch
exit 1 exit 1
fi fi
else
echo "No changes to patches detected"
fi fi
fi fi
- name: Remove patch conflict problem matcher
shell: bash
run: |
echo "::remove-matcher owner=merge-conflict::"
echo "::remove-matcher owner=patch-conflict::"
- name: Upload patches stats
if: ${{ inputs.target-platform == 'linux' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
npx node src/electron/script/patches-stats.mjs --upload-stats || true
# delete all .git directories under src/ except for # delete all .git directories under src/ except for
# third_party/angle/ and third_party/dawn/ because of build time generation of files # third_party/angle/ and third_party/dawn/ because of build time generation of files
# gen/angle/commit.h depends on third_party/angle/.git/HEAD # gen/angle/commit.h depends on third_party/angle/.git/HEAD
@@ -149,13 +123,13 @@ runs:
# https://dawn-review.googlesource.com/c/dawn/+/83901 # https://dawn-review.googlesource.com/c/dawn/+/83901
# TODO: maybe better to always leave out */.git/HEAD file for all targets ? # TODO: maybe better to always leave out */.git/HEAD file for all targets ?
- name: Delete .git directories under src to free space - name: Delete .git directories under src to free space
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }} if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
run: | run: |
cd src cd src
( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf ( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
- name: Minimize Cache Size for Upload - name: Minimize Cache Size for Upload
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }} if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
run: | run: |
rm -rf src/android_webview rm -rf src/android_webview
@@ -166,23 +140,20 @@ runs:
rm -rf src/third_party/angle/third_party/VK-GL-CTS/src rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
rm -rf src/third_party/swift-toolchain rm -rf src/third_party/swift-toolchain
rm -rf src/third_party/swiftshader/tests/regres/testlists rm -rf src/third_party/swiftshader/tests/regres/testlists
cp src/electron/.github/actions/checkout/action.yml ./
rm -rf src/electron rm -rf src/electron
mkdir -p src/electron/.github/actions/checkout
mv action.yml src/electron/.github/actions/checkout
- name: Compress Src Directory - name: Compress Src Directory
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }} if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
run: | run: |
echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')" echo "Uncompressed src size: $(du -sh src | cut -f1 -d' ')"
tar -cf $CACHE_FILE src tar -cf $DEPSHASH.tar src
echo "Compressed src to $(du -sh $CACHE_FILE | cut -f1 -d' ')" echo "Compressed src to $(du -sh $DEPSHASH.tar | cut -f1 -d' ')"
cp ./$CACHE_FILE $CACHE_DRIVE/ cp ./$DEPSHASH.tar /mnt/cross-instance-cache/
- name: Persist Src Cache - name: Persist Src Cache
if: ${{ steps.check-cache.outputs.cache_exists == 'false' && inputs.use-cache == 'true' }} if: steps.check-cache.outputs.cache_exists == 'false'
shell: bash shell: bash
run: | run: |
final_cache_path=$CACHE_DRIVE/$CACHE_FILE final_cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
echo "Using cache key: $DEPSHASH" echo "Using cache key: $DEPSHASH"
echo "Checking path: $final_cache_path" echo "Checking path: $final_cache_path"
if [ ! -f "$final_cache_path" ]; then if [ ! -f "$final_cache_path" ]; then
@@ -191,11 +162,3 @@ runs:
else else
echo "Cache key persisted in $final_cache_path" echo "Cache key persisted in $final_cache_path"
fi fi
- name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled()
run: |
while [ -f /var/.ssh-lock ]
do
sleep 60
done

View File

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

View File

@@ -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

View File

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

View File

@@ -1,24 +0,0 @@
name: 'Generate Types for Archaeologist Dig'
description: 'Generate Types for Archaeologist Dig'
inputs:
sha-file:
description: 'File containing sha'
required: true
filename:
description: 'Filename to write types to'
required: true
runs:
using: "composite"
steps:
- name: Generating Types for SHA in ${{ inputs.sha-file }}
shell: bash
run: |
git checkout $(cat ${{ inputs.sha-file }})
rm -rf node_modules
yarn install --frozen-lockfile --ignore-scripts
echo "#!/usr/bin/env node\nglobal.x=1" > node_modules/typescript/bin/tsc
node node_modules/.bin/electron-docs-parser --dir=./ --outDir=./ --moduleVersion=0.0.0-development
node node_modules/.bin/electron-typescript-definitions --api=electron-api.json --outDir=artifacts
mv artifacts/electron.d.ts artifacts/${{ inputs.filename }}
git checkout .
working-directory: ./electron

View File

@@ -1,30 +0,0 @@
name: 'Install Build Tools'
description: 'Installs an exact SHA of build tools'
runs:
using: "composite"
steps:
- name: Install Build Tools
shell: bash
run: |
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then
git config --global core.filemode false
git config --global core.autocrlf false
git config --global branch.autosetuprebase always
git config --global core.fscache true
git config --global core.preloadindex true
fi
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
npm i -g @electron/build-tools
# Update depot_tools to ensure python
e d update_depot_tools
e auto-update disable
# Disable further updates of depot_tools
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"
echo "C:\Users\ContainerAdministrator\.electron_build_tools\third_party\depot_tools" >> $GITHUB_PATH
else
echo "$HOME/.electron_build_tools/third_party/depot_tools" >> $GITHUB_PATH
echo "$HOME/.electron_build_tools/third_party/depot_tools/python-bin" >> $GITHUB_PATH
fi

View File

@@ -1,21 +0,0 @@
name: 'Install Dependencies'
description: 'Installs yarn depdencies using cache when available'
runs:
using: "composite"
steps:
- name: Get yarn cache directory path
shell: bash
id: yarn-cache-dir-path
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('src/electron/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
shell: bash
run: |
cd src/electron
node script/yarn install --frozen-lockfile --prefer-offline

View File

@@ -1,20 +1,12 @@
name: 'Restore Cache AKS' name: 'Restore Cache AKS'
description: 'Restores Electron src cache via AKS' description: 'Restores Electron src cache via AKS'
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: Restore and Ensure Src Cache - name: Restore and Ensure Src Cache
shell: bash shell: bash
run: | run: |
if [ "${{ inputs.target-platform }}" = "win" ]; then
cache_path=/mnt/win-cache/$DEPSHASH.tar
else
cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar cache_path=/mnt/cross-instance-cache/$DEPSHASH.tar
fi
echo "Using cache key: $DEPSHASH" echo "Using cache key: $DEPSHASH"
echo "Checking for cache in: $cache_path" echo "Checking for cache in: $cache_path"
if [ ! -f "$cache_path" ]; then if [ ! -f "$cache_path" ]; then
@@ -25,11 +17,6 @@ runs:
fi fi
echo "Persisted cache is $(du -sh $cache_path | cut -f1)" echo "Persisted cache is $(du -sh $cache_path | cut -f1)"
if [ `du $cache_path | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache mkdir temp-cache
tar -xf $cache_path -C temp-cache tar -xf $cache_path -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)" echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"

View File

@@ -1,66 +1,34 @@
name: 'Restore Cache AZCopy' name: 'Restore Cache AZCopy'
description: 'Restores Electron src cache via AZCopy' description: 'Restores Electron src cache via AZCopy'
inputs:
target-platform:
description: 'Target platform, should be linux, win, macos'
runs: runs:
using: "composite" using: "composite"
steps: steps:
- name: Obtain SAS Key - name: Obtain SAS Key
continue-on-error: true uses: actions/cache/restore@v4
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with: with:
path: sas-token path: |
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-1 sas-token
enableCrossOsArchive: true key: sas-key-${{ github.run_number }}-${{ github.run_attempt }}
- name: Obtain SAS Key
continue-on-error: true
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: sas-token
key: sas-key-${{ inputs.target-platform }}-${{ github.run_number }}-${{ github.run_attempt }}
enableCrossOsArchive: true
- name: Download Src Cache from AKS - name: Download Src Cache from AKS
# The cache will always exist here as a result of the checkout job # 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 # 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. # or it was uploaded in the checkout job for a previous commit.
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with: with:
timeout_minutes: 30 timeout_minutes: 20
max_attempts: 3 max_attempts: 3
retry_on: error retry_on: error
shell: bash
command: | command: |
sas_token=$(cat sas-token) sas_token=$(cat sas-token)
if [ -z $sas-token ]; then azcopy copy \
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 "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
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 - name: Clean SAS Key
shell: bash shell: bash
run: rm -f sas-token run: rm -f sas-token
- name: Unzip and Ensure Src Cache - name: Unzip and Ensure Src Cache
if: ${{ inputs.target-platform == 'macos' }}
shell: bash shell: bash
run: | run: |
echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)" echo "Downloaded cache is $(du -sh $DEPSHASH.tar | cut -f1)"
if [ `du $DEPSHASH.tar | cut -f1` = "0" ]; then
echo "Cache is empty - exiting"
exit 1
fi
mkdir temp-cache mkdir temp-cache
tar -xf $DEPSHASH.tar -C temp-cache tar -xf $DEPSHASH.tar -C temp-cache
echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)" echo "Unzipped cache is $(du -sh temp-cache/src | cut -f1)"
@@ -81,44 +49,3 @@ runs:
echo "Wiping Electron Directory" 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"
- name: Move Src Cache (Windows)
if: ${{ inputs.target-platform == 'win' }}
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
shell: powershell
command: |
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

View File

@@ -1,41 +0,0 @@
name: 'Set Chromium Git Helper'
description: 'Sets Chromium Git Helper to allow for a higher request limit'
runs:
using: "composite"
steps:
- name: Save the chromium git credentials to a file
shell: bash
run: |
if [[ -z "${{ env.CHROMIUM_GIT_AUTH }}" ]]; then
echo "CHROMIUM_GIT_AUTH is not set - cannot authenticate."
exit 0
fi
if [[ "${{ runner.os }}" != "Windows" ]]; then
cd $HOME
fi
echo "${{ env.CHROMIUM_GIT_AUTH }}" > .chromium_git_auth
- name: Set the chromium git helper to use auth from a file
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
if [[ ! -f "/c/actions-runner/_work/electron/electron/.chromium_git_auth" ]]; then
echo "File /c/actions-runner/_work/electron/electron/.chromium_git_auth does not exist - cannot authenticate."
exit 0
fi
else
if [[ ! -f "$HOME/.chromium_git_auth" ]]; then
echo "File $HOME/.chromium_git_auth does not exist - cannot authenticate."
exit 0
fi
fi
if [[ -z "${{ env.CHROMIUM_GIT_USER }}" ]]; then
echo "CHROMIUM_GIT_USER is not set - cannot authenticate."
exit 0
fi
git config --global credential.https://chromium.googlesource.com.username "${{ env.CHROMIUM_GIT_USER }}"
if [[ "${{ runner.os }}" == "Windows" ]]; then
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat /c/actions-runner/_work/electron/electron/.chromium_git_auth)"; }; f'
else
git config --global credential.https://chromium.googlesource.com.helper '!f() { test "$1" = get && echo "password=$(cat $HOME/.chromium_git_auth)"; }; f'
fi

9
.github/config.yml vendored
View File

@@ -2,8 +2,6 @@
newPRWelcomeComment: | newPRWelcomeComment: |
💖 Thanks for opening this pull request! 💖 💖 Thanks for opening this pull request! 💖
### Semantic PR titles
We use [semantic commit messages](https://github.com/electron/electron/blob/main/docs/development/pull-requests.md#commit-message-guidelines) to streamline the release process. Before your pull request can be merged, you should **update your pull request title** to start with a semantic prefix. We use [semantic commit messages](https://github.com/electron/electron/blob/main/docs/development/pull-requests.md#commit-message-guidelines) to streamline the release process. Before your pull request can be merged, you should **update your pull request title** to start with a semantic prefix.
Examples of commit messages with semantic prefixes: Examples of commit messages with semantic prefixes:
@@ -12,13 +10,6 @@ newPRWelcomeComment: |
- `feat: add app.isPackaged() method` - `feat: add app.isPackaged() method`
- `docs: app.isDefaultProtocolClient is now available on Linux` - `docs: app.isDefaultProtocolClient is now available on Linux`
### Commit signing
This repo enforces [commit signatures](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) for all incoming PRs.
To sign your commits, see GitHub's documentation on [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
### PR tips
Things that will help get your PR across the finish line: Things that will help get your PR across the finish line:
- Follow the JavaScript, C++, and Python [coding style](https://github.com/electron/electron/blob/main/docs/development/coding-style.md). - Follow the JavaScript, C++, and Python [coding style](https://github.com/electron/electron/blob/main/docs/development/coding-style.md).

View File

@@ -7,62 +7,3 @@ updates:
directory: / directory: /
schedule: schedule:
interval: weekly interval: weekly
labels:
- "no-backport"
- "semver/none"
target-branch: main
- package-ecosystem: npm
directories:
- /
- /spec
- /npm
schedule:
interval: daily
labels:
- "no-backport"
open-pull-requests-limit: 2
target-branch: main
- package-ecosystem: npm
directories:
- /
- /spec
- /npm
schedule:
interval: daily
labels:
- "backport-check-skip"
open-pull-requests-limit: 0
target-branch: 33-x-y
- package-ecosystem: npm
directories:
- /
- /spec
- /npm
schedule:
interval: daily
labels:
- "backport-check-skip"
open-pull-requests-limit: 0
target-branch: 32-x-y
- package-ecosystem: npm
directories:
- /
- /spec
- /npm
schedule:
interval: daily
labels:
- "backport-check-skip"
open-pull-requests-limit: 0
target-branch: 31-x-y
- package-ecosystem: npm
directories:
- /
- /spec
- /npm
schedule:
interval: daily
labels:
- "backport-check-skip"
open-pull-requests-limit: 0
target-branch: 30-x-y

View File

@@ -1,18 +0,0 @@
{
"problemMatcher": [
{
"owner": "clang",
"fromPath": "src/out/Default/args.gn",
"pattern": [
{
"regexp": "^(.+)[(:](\\d+)[:,](\\d+)\\)?:\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}

View File

@@ -1,22 +0,0 @@
{
"problemMatcher": [
{
"owner": "eslint-stylish",
"pattern": [
{
"regexp": "^\\s*([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}

View File

@@ -1,24 +0,0 @@
{
"problemMatcher": [
{
"owner": "merge-conflict",
"pattern": [
{
"regexp": "^CONFLICT\\s\\(\\S+\\): (Merge conflict in \\S+)$",
"message": 1
}
]
},
{
"owner": "patch-conflict",
"pattern": [
{
"regexp": "^error: (patch failed: (\\S+):(\\d+))$",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}

View File

@@ -1,65 +0,0 @@
name: Archaeologist
on:
pull_request:
jobs:
archaeologist-dig:
name: Archaeologist Dig
runs-on: ubuntu-latest
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
with:
fetch-depth: 0
- name: Setup Node.js/npm
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20.19.x
- name: Setting Up Dig Site
run: |
echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}"
echo "sha ${{ github.event.pull_request.head.sha }}"
echo "base ref ${{ github.event.pull_request.base.ref }}"
git clone https://github.com/electron/electron.git electron
cd electron
mkdir -p artifacts
git remote add fork ${{ github.event.pull_request.head.repo.clone_url }} && git fetch fork
git checkout ${{ github.event.pull_request.head.sha }}
git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD > .dig-old
echo ${{ github.event.pull_request.head.sha }} > .dig-new
cp .dig-old artifacts
- name: Generating Types for SHA in .dig-new
uses: ./.github/actions/generate-types
with:
sha-file: .dig-new
filename: electron.new.d.ts
- name: Generating Types for SHA in .dig-old
uses: ./.github/actions/generate-types
with:
sha-file: .dig-old
filename: electron.old.d.ts
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: artifacts
path: electron/artifacts
include-hidden-files: true
- name: Set job output
run: |
git diff --no-index electron.old.d.ts electron.new.d.ts > patchfile || true
if [ -s patchfile ]; then
echo "Changes Detected"
echo "## Changes Detected" > $GITHUB_STEP_SUMMARY
echo "Looks like the \`electron.d.ts\` file changed." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`\`\`\`diff" >> $GITHUB_STEP_SUMMARY
cat patchfile >> $GITHUB_STEP_SUMMARY
echo "\`\`\`\`\`\`" >> $GITHUB_STEP_SUMMARY
else
echo "No Changes Detected"
echo "## No Changes" > $GITHUB_STEP_SUMMARY
echo "We couldn't see any changes in the \`electron.d.ts\` artifact" >> $GITHUB_STEP_SUMMARY
fi
working-directory: ./electron/artifacts

View File

@@ -1,137 +0,0 @@
name: Audit CI on Branches
on:
workflow_dispatch:
schedule:
# Run every 2 hours
- cron: '0 */2 * * *'
permissions: {}
jobs:
audit_branch_ci:
name: Audit CI on Branches
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- run: npm install @actions/cache @electron/fiddle-core
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const cache = require('@actions/cache');
const { ElectronVersions } = require('@electron/fiddle-core');
const runsWithErrors = [];
// Only want the most recent workflow run that wasn't skipped or cancelled
const isValidWorkflowRun = (run) => !['skipped', 'cancelled'].includes(run.conclusion);
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
const branches = versions.supportedMajors.map((branch) => `${branch}-x-y`);
for (const branch of ["main", ...branches]) {
const latestCheckRuns = new Map();
const allCheckRuns = await github.paginate(github.rest.checks.listForRef, {
owner: "electron",
repo: "electron",
ref: branch,
status: 'completed',
});
// Sort the check runs by completed_at so that multiple check runs on the
// same ref (like a scheduled workflow) only looks at the most recent one
for (const checkRun of allCheckRuns.filter(
(run) => !['skipped', 'cancelled'].includes(run.conclusion),
).sort((a, b) => new Date(b.completed_at) - new Date(a.completed_at))) {
if (!latestCheckRuns.has(checkRun.name)) {
latestCheckRuns.set(checkRun.name, checkRun);
}
}
// Check for runs which had error annotations
for (const checkRun of Array.from(latestCheckRuns.values())) {
const annotations = (await github.rest.checks.listAnnotations({
owner: "electron",
repo: "electron",
check_run_id: checkRun.id,
})).data ?? [];
console.log(checkRun);
console.log(annotations);
if (
annotations.find(
({ annotation_level, message }) =>
annotation_level === 'failure' && !message.startsWith("Process completed with exit code")
)
) {
checkRun.hasErrorAnnotations = true;
} else {
continue;
}
// Check if this is a known failure from a previous audit run
const cacheKey = `check-run-error-annotations-${checkRun.id}`;
const cacheHit =
(await cache.restoreCache(['/dev/null'], cacheKey, undefined, {
lookupOnly: true,
})) !== undefined;
if (cacheHit) {
checkRun.isStale = true;
}
checkRun.branch = branch;
runsWithErrors.push(checkRun);
// Create a cache entry (only the name matters) to keep track of
// failures we've seen from previous runs to mark them as stale
if (!cacheHit) {
await cache.saveCache(['/dev/null'], cacheKey);
}
}
}
if (runsWithErrors.length > 0) {
core.summary.addHeading('⚠️ Runs with Errors');
core.summary.addTable([
[
{ data: 'Branch', header: true },
{ data: 'Workflow Run', header: true },
{ data: 'Status', header: true },
],
...runsWithErrors
.sort(
(a, b) =>
a.branch.localeCompare(b.branch) ||
a.name.localeCompare(b.name),
)
.map((run) => [
run.branch,
`<a href="${run.html_url}">${run.name}</a>`,
run.isStale
? '📅 Stale'
: run.hasErrorAnnotations
? '⚠️ Errors'
: '✅ Succeeded',
]),
]);
// Set this as failed so it's easy to scan runs to find failures
if (runsWithErrors.find((run) => !run.isStale)) {
process.exitCode = 1;
}
} else {
core.summary.addRaw('🎉 No runs with errors');
}
await core.summary.write();
- name: Send Slack message if errors
if: failure()
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0
with:
payload: |
link: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
webhook: ${{ secrets.CI_ERRORS_SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger

View File

@@ -23,13 +23,11 @@ jobs:
steps: steps:
- name: Determine Major Version - name: Determine Major Version
id: check-major-version id: check-major-version
env:
BRANCH_NAME: ${{ github.event.inputs.branch-name || github.event.ref }}
run: | run: |
if [[ "$BRANCH_NAME" =~ ^([0-9]+)-x-y$ ]]; then if [[ ${{ github.event.inputs.branch-name || github.event.ref }} =~ ^([0-9]+)-x-y$ ]]; then
echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT" echo "MAJOR=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else else
echo "Not a release branch: $BRANCH_NAME" echo "Not a release branch: ${{ github.event.inputs.branch-name || github.event.ref }}"
fi fi
- name: New Release Branch Tasks - name: New Release Branch Tasks
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
@@ -94,7 +92,7 @@ jobs:
})) }))
- name: Create Release Project Board - name: Create Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/copy-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/copy-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
id: create-release-board id: create-release-board
with: with:
drafts: true drafts: true
@@ -114,15 +112,14 @@ jobs:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Find Previous Release Project Board - name: Find Previous Release Project Board
if: ${{ steps.check-major-version.outputs.MAJOR }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/find-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/find-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
id: find-prev-release-board id: find-prev-release-board
with: with:
fail-if-project-not-found: false
title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y title: ${{ steps.generate-project-metadata.outputs.prev-prev-major }}-x-y
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
- name: Close Previous Release Project Board - name: Close Previous Release Project Board
if: ${{ steps.find-prev-release-board.outputs.number }} if: ${{ steps.check-major-version.outputs.MAJOR }}
uses: dsanders11/project-actions/close-project@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/close-project@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
project-number: ${{ steps.find-prev-release-board.outputs.number }} project-number: ${{ steps.find-prev-release-board.outputs.number }}
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
required: true required: true
skip-macos: skip-macos:
type: boolean type: boolean
@@ -28,30 +28,19 @@ on:
description: 'Skip lint check' description: 'Skip lint check'
default: false default: false
required: false required: false
push: # push:
branches: # pull_request:
- main
- '[1-9][0-9]-x-y'
pull_request:
defaults:
run:
shell: bash
jobs: jobs:
setup: changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
pull-requests: read pull-requests: read
outputs: outputs:
docs: ${{ steps.filter.outputs.docs }} docs: ${{ steps.filter.outputs.docs }}
src: ${{ steps.filter.outputs.src }} src: ${{ steps.filter.outputs.src }}
build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
docs-only: ${{ steps.set-output.outputs.docs-only }}
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter id: filter
with: with:
@@ -60,169 +49,99 @@ jobs:
- 'docs/**' - 'docs/**'
src: src:
- '!docs/**' - '!docs/**'
- name: Set Outputs for Build Image SHA & Docs Only
id: set-output
run: |
if [ -z "${{ inputs.build-image-sha }}" ]; then
echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT"
else
echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
fi
echo "docs-only=${{ steps.filter.outputs.docs == 'true' && steps.filter.outputs.src == 'false' }}" >> "$GITHUB_OUTPUT"
# Lint Jobs # Lint Jobs
lint: lint:
needs: setup
if: ${{ !inputs.skip-lint }} if: ${{ !inputs.skip-lint }}
uses: ./.github/workflows/pipeline-electron-lint.yml uses: ./.github/workflows/pipeline-electron-lint.yml
with: with:
container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}' container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root"}'
secrets: inherit secrets: inherit
# Docs Only Jobs # Docs Only Jobs
docs-only: docs-only:
needs: setup needs: changes
if: ${{ needs.setup.outputs.docs-only == 'true' }} if: ${{ needs.changes.outputs.docs == 'true' && needs.changes.outputs.src == 'false'}}
uses: ./.github/workflows/pipeline-electron-docs-only.yml uses: ./.github/workflows/pipeline-electron-docs-only.yml
with: with:
container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}' container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root"}'
secrets: inherit secrets: inherit
# Checkout Jobs # Checkout Jobs
checkout-macos:
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
with:
generate-sas-token: 'true'
target-platform: macos
checkout-linux:
needs: setup
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}}
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
options: --user root
volumes:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
with:
target-platform: linux
checkout-windows: checkout-windows:
needs: setup needs: changes
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} if: ${{ needs.changes.outputs.src == 'true' && !inputs.skip-windows }}
runs-on: electron-arc-linux-amd64-32core runs-on: aks-linux-large
container: container:
image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes: volumes:
- /mnt/win-cache:/mnt/win-cache - /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win' TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1' ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
path: src/electron
fetch-depth: 0
- name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout
checkout-macos:
needs: changes
if: false
# if: ${{ needs.changes.outputs.src == 'true' && !inputs.skip-macos}}
runs-on: aks-linux-large
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
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: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout & Sync & Save - name: Checkout & Sync & Save
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
with: with:
generate-sas-token: 'true' generate-sas-token: 'true'
target-platform: win
# GN Check Jobs checkout-linux:
macos-gn-check: needs: changes
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml if: false
needs: checkout-macos # if: ${{ needs.changes.outputs.src == 'true' && !inputs.skip-linux}}
runs-on: aks-linux-large
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
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_arm=True --custom-var=checkout_arm64=True'
steps:
- name: Checkout Electron
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
target-platform: macos path: src/electron
target-archs: x64 arm64 fetch-depth: 0
check-runs-on: macos-14 - name: Checkout & Sync & Save
gn-build-type: testing uses: ./src/electron/.github/actions/checkout
secrets: inherit
linux-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-linux
with:
target-platform: linux
target-archs: x64 arm arm64
check-runs-on: electron-arc-linux-amd64-8core
check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
gn-build-type: testing
secrets: inherit
windows-gn-check:
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
needs: checkout-windows
with:
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/win-cache:/mnt/win-cache"]}'
gn-build-type: testing
secrets: inherit
# Build Jobs - These cascade into testing jobs # Build Jobs - These cascade into testing jobs
macos-x64: 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.yml
needs: checkout-macos needs: checkout-macos
with: with:
build-runs-on: macos-14-xlarge build-runs-on: macos-14-xlarge
test-runs-on: macos-13 test-runs-on: macos-14-xlarge
target-platform: macos target-platform: macos
target-arch: x64 target-arch: x64
is-release: false is-release: false
@@ -232,15 +151,11 @@ jobs:
secrets: inherit secrets: inherit
macos-arm64: macos-arm64:
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.yml
needs: checkout-macos needs: checkout-macos
with: with:
build-runs-on: macos-14-xlarge build-runs-on: macos-14-xlarge
test-runs-on: macos-14 test-runs-on: macos-14-xlarge
target-platform: macos target-platform: macos
target-arch: arm64 target-arch: arm64
is-release: false is-release: false
@@ -250,17 +165,13 @@ jobs:
secrets: inherit secrets: inherit
linux-x64: linux-x64:
permissions:
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-nan.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
test-runs-on: electron-arc-linux-amd64-4core test-runs-on: aks-linux-medium
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' test-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
target-arch: x64 target-arch: x64
is-release: false is-release: false
@@ -269,39 +180,29 @@ jobs:
upload-to-storage: '0' upload-to-storage: '0'
secrets: inherit secrets: inherit
linux-x64-asan: windows-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.yml
needs: checkout-linux needs: checkout-windows
with: with:
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
test-runs-on: electron-arc-linux-amd64-4core test-runs-on: windows-2022
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' target-platform: windows
target-platform: linux
target-arch: x64 target-arch: x64
is-release: false is-release: false
gn-build-type: testing gn-build-type: testing
generate-symbols: false generate-symbols: false
upload-to-storage: '0' upload-to-storage: '0'
is-asan: true
secrets: inherit secrets: inherit
linux-arm: linux-arm:
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.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
test-runs-on: electron-arc-linux-arm64-4core test-runs-on: aks-linux-arm-medium
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}' test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ inputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
target-arch: arm target-arch: arm
is-release: false is-release: false
@@ -311,17 +212,13 @@ jobs:
secrets: inherit secrets: inherit
linux-arm64: linux-arm64:
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.yml
needs: checkout-linux needs: checkout-linux
with: with:
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
test-runs-on: electron-arc-linux-arm64-4core test-runs-on: aks-linux-arm-medium
build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}' test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ inputs.build-image-sha }}","options":"--user root --privileged --init"}'
target-platform: linux target-platform: linux
target-arch: arm64 target-arch: arm64
is-release: false is-release: false
@@ -329,70 +226,3 @@ jobs:
generate-symbols: false generate-symbols: false
upload-to-storage: '0' upload-to-storage: '0'
secrets: inherit secrets: inherit
windows-x64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest
target-platform: win
target-arch: x64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
windows-x86:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: windows-latest
target-platform: win
target-arch: x86
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
windows-arm64:
permissions:
contents: read
issues: read
pull-requests: read
uses: ./.github/workflows/pipeline-electron-build-and-test.yml
needs: checkout-windows
if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
with:
build-runs-on: electron-arc-windows-amd64-16core
test-runs-on: electron-hosted-windows-arm64-4core
target-platform: win
target-arch: arm64
is-release: false
gn-build-type: testing
generate-symbols: false
upload-to-storage: '0'
secrets: inherit
gha-done:
name: GitHub Actions Completed
runs-on: ubuntu-latest
needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
if: always() && !contains(needs.*.result, 'failure')
steps:
- name: GitHub Actions Jobs Done
run: |
echo "All GitHub Actions Jobs are done"

View File

@@ -1,29 +0,0 @@
name: Clean Source Cache
description: |
This workflow cleans up the source cache on the cross-instance cache volume
to free up space. It runs daily at midnight and clears files older than 15 days.
on:
schedule:
- cron: "0 0 * * *"
jobs:
clean-src-cache:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1
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
run: |
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

14
.github/workflows/config/gclient.diff vendored Normal file
View File

@@ -0,0 +1,14 @@
diff --git a/gclient.py b/gclient.py
index 59e2b4c5197928bdba1ef69bdbe637d7dfe471c1..b4bae5e48c83c84bd867187afaf40eed16e69851 100755
--- a/gclient.py
+++ b/gclient.py
@@ -783,7 +783,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
not condition or "non_git_source" not in condition):
continue
cipd_root = self.GetCipdRoot()
- for package in dep_value.get('packages', []):
+ packages = dep_value.get('packages', [])
+ for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
deps_to_add.append(
CipdDependency(parent=self,
name=name,

View File

@@ -9,8 +9,8 @@ permissions: {}
jobs: jobs:
issue-commented: issue-commented:
name: Remove blocked/{need-info,need-repro} on comment name: Remove blocked/need-repro on comment
if: ${{ (contains(github.event.issue.labels.*.name, 'blocked/need-repro') || contains(github.event.issue.labels.*.name, 'blocked/need-info ❌')) && !contains(fromJSON('["MEMBER", "OWNER", "COLLABORATOR"]'), github.event.comment.author_association) && github.event.comment.user.type != 'Bot' }} if: ${{ contains(github.event.issue.labels.*.name, 'blocked/need-repro') && !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && github.event.comment.user.type != 'Bot' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Generate GitHub App token - name: Generate GitHub App token
@@ -23,4 +23,4 @@ jobs:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
ISSUE_URL: ${{ github.event.issue.html_url }} ISSUE_URL: ${{ github.event.issue.html_url }}
run: | run: |
gh issue edit $ISSUE_URL --remove-label 'blocked/need-repro','blocked/need-info ❌' gh issue edit $ISSUE_URL --remove-label 'blocked/need-repro'

View File

@@ -20,13 +20,12 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: ✅ Triaged field-value: ✅ Triaged
fail-if-item-not-found: false
issue-labeled-blocked: issue-labeled-blocked:
name: blocked/* label added name: blocked/* label added
if: startsWith(github.event.label.name, 'blocked/') if: startsWith(github.event.label.name, 'blocked/')
@@ -39,13 +38,12 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: 🛑 Blocked field-value: 🛑 Blocked
fail-if-item-not-found: false
issue-labeled-blocked-need-repro: issue-labeled-blocked-need-repro:
name: blocked/need-repro label added name: blocked/need-repro label added
if: github.event.label.name == 'blocked/need-repro' if: github.event.label.name == 'blocked/need-repro'

View File

@@ -19,7 +19,7 @@ jobs:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- name: Add to Issue Triage - name: Add to Issue Triage
uses: dsanders11/project-actions/add-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/add-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
field: Reporter field: Reporter
field-value: ${{ github.event.issue.user.login }} field-value: ${{ github.event.issue.user.login }}
@@ -35,10 +35,9 @@ jobs:
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron org: electron
- run: npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0 - run: npm install mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0
- name: Add labels - name: Add labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: add-labels
env: env:
ISSUE_BODY: ${{ github.event.issue.body }} ISSUE_BODY: ${{ github.event.issue.body }}
with: with:
@@ -57,11 +56,7 @@ jobs:
const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim(); const electronVersion = select('heading:has(> text[value="Electron Version"]) + paragraph > text', tree)?.value.trim();
if (electronVersion !== undefined) { if (electronVersion !== undefined) {
// It's possible for multiple versions to be listed - const major = semver.parse(electronVersion)?.major;
// for now check for comma or space separated version.
const versions = electronVersion.split(/, | /);
for (const version of versions) {
const major = semver.coerce(version, { loose: true })?.major;
if (major) { if (major) {
const versionLabel = `${major}-x-y`; const versionLabel = `${major}-x-y`;
let labelExists = false; let labelExists = false;
@@ -76,45 +71,10 @@ jobs:
} catch {} } catch {}
if (labelExists) { if (labelExists) {
// Check if it's an unsupported major
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
const versions = await ElectronVersions.create(undefined, { ignoreCache: true });
const validVersions = [...versions.supportedMajors, ...versions.prereleaseMajors];
if (validVersions.includes(major)) {
labels.push(versionLabel); labels.push(versionLabel);
} }
} }
} }
}
if (labels.length === 0) {
core.setOutput('unsupportedMajor', true);
labels.push('blocked/need-info ❌');
}
}
const operatingSystems = select('heading:has(> text[value="What operating system(s) are you using?"]) + paragraph > text', tree)?.value.trim().split(', ');
const platformLabels = new Set();
for (const operatingSystem of (operatingSystems ?? [])) {
switch (operatingSystem) {
case 'Windows':
platformLabels.add('platform/windows');
break;
case 'macOS':
platformLabels.add('platform/macOS');
break;
case 'Ubuntu':
case 'Other Linux':
platformLabels.add('platform/linux');
break;
}
}
if (platformLabels.size === 3) {
labels.push('platform/all');
} else {
labels.push(...platformLabels);
}
const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim(); const gistUrl = select('heading:has(> text[value="Testcase Gist URL"]) + paragraph > text', tree)?.value.trim();
if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) { if (gistUrl !== undefined && gistUrl.startsWith('https://gist.github.com/')) {
@@ -129,17 +89,3 @@ jobs:
labels, labels,
}); });
} }
- name: Create unsupported major comment
if: ${{ steps.add-labels.outputs.unsupportedMajor }}
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
with:
actions: 'create-comment'
token: ${{ steps.generate-token.outputs.token }}
body: |
<!-- end-of-life -->
Hello @${{ github.event.issue.user.login }}. Thanks for reporting this and helping to make Electron better!
The version of Electron reported in this issue has reached end-of-life and is [no longer supported](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline). If you're still experiencing this issue on a [supported version](https://www.electronjs.org/releases/stable) of Electron, please update this issue to reflect that version of Electron.
Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-info%20%E2%9D%8C label for this reason. This issue will be closed in 10 days if the above is not addressed.

View File

@@ -1,27 +0,0 @@
name: Issue Transferred
on:
issues:
types: [transferred]
permissions: {}
jobs:
issue-transferred:
name: Issue Transferred
runs-on: ubuntu-latest
if: ${{ !github.event.changes.new_repository.private }}
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
org: electron
- name: Remove from issue triage
uses: dsanders11/project-actions/delete-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0
with:
token: ${{ steps.generate-token.outputs.token }}
project-number: 90
item: ${{ github.event.changes.new_issue.html_url }}
fail-if-item-not-found: false

View File

@@ -30,10 +30,9 @@ jobs:
org: electron org: electron
- name: Set status - name: Set status
if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }} if: ${{ steps.check-for-blocked-labels.outputs.NOT_BLOCKED }}
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 90 project-number: 90
field: Status field: Status
field-value: 📥 Was Blocked field-value: 📥 Was Blocked
fail-if-item-not-found: false

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
required: false required: false
@@ -19,7 +19,7 @@ on:
jobs: jobs:
checkout-linux: checkout-linux:
runs-on: electron-arc-linux-amd64-32core runs-on: aks-linux-large
container: container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root options: --user root
@@ -27,12 +27,10 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache - /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas - /var/run/sas:/var/run/sas
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }} GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
@@ -44,14 +42,13 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: x64 target-arch: x64
is-release: true is-release: true
gn-build-type: release gn-build-type: release
generate-symbols: true generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit secrets: inherit
@@ -60,14 +57,13 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: arm target-arch: arm
is-release: true is-release: true
gn-build-type: release gn-build-type: release
generate-symbols: true generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit secrets: inherit
@@ -76,13 +72,12 @@ jobs:
needs: checkout-linux needs: checkout-linux
with: with:
environment: production-release environment: production-release
build-runs-on: electron-arc-linux-amd64-32core build-runs-on: aks-linux-large
build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' build-container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
target-platform: linux target-platform: linux
target-arch: arm64 target-arch: arm64
is-release: true is-release: true
gn-build-type: release gn-build-type: release
generate-symbols: true generate-symbols: true
strip-binaries: true
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit secrets: inherit

View File

@@ -6,7 +6,7 @@ on:
build-image-sha: build-image-sha:
type: string type: string
description: 'SHA for electron/build image' description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373' default: 'cf814a4d2501e8e843caea071a6b70a48e78b855'
required: true required: true
upload-to-storage: upload-to-storage:
description: 'Uploads to Azure storage' description: 'Uploads to Azure storage'
@@ -20,7 +20,7 @@ on:
jobs: jobs:
checkout-macos: checkout-macos:
runs-on: electron-arc-linux-amd64-32core runs-on: aks-linux-large
container: container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }} image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root options: --user root
@@ -28,12 +28,10 @@ jobs:
- /mnt/cross-instance-cache:/mnt/cross-instance-cache - /mnt/cross-instance-cache:/mnt/cross-instance-cache
- /var/run/sas:/var/run/sas - /var/run/sas:/var/run/sas
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
@@ -41,9 +39,8 @@ jobs:
uses: ./src/electron/.github/actions/checkout uses: ./src/electron/.github/actions/checkout
with: with:
generate-sas-token: 'true' generate-sas-token: 'true'
target-platform: macos
publish-x64-darwin: publish-x64:
uses: ./.github/workflows/pipeline-segment-electron-build.yml uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos needs: checkout-macos
with: with:
@@ -51,29 +48,13 @@ jobs:
build-runs-on: macos-14-xlarge build-runs-on: macos-14-xlarge
target-platform: macos target-platform: macos
target-arch: x64 target-arch: x64
target-variant: darwin
is-release: true is-release: true
gn-build-type: release gn-build-type: release
generate-symbols: true generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit secrets: inherit
publish-x64-mas: publish-arm64:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
environment: production-release
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: x64
target-variant: mas
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-darwin:
uses: ./.github/workflows/pipeline-segment-electron-build.yml uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos needs: checkout-macos
with: with:
@@ -81,22 +62,6 @@ jobs:
build-runs-on: macos-14-xlarge build-runs-on: macos-14-xlarge
target-platform: macos target-platform: macos
target-arch: arm64 target-arch: arm64
target-variant: darwin
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-mas:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-macos
with:
environment: production-release
build-runs-on: macos-14-xlarge
target-platform: macos
target-arch: arm64
target-variant: mas
is-release: true is-release: true
gn-build-type: release gn-build-type: release
generate-symbols: true generate-symbols: true

View File

@@ -1,37 +0,0 @@
name: Check for Non-Maintainer Dependency Change
on:
pull_request_target:
paths:
- 'yarn.lock'
- 'spec/yarn.lock'
permissions: {}
jobs:
check-for-non-maintainer-dependency-change:
name: Check for non-maintainer dependency change
if: ${{ !contains(fromJSON('["MEMBER", "OWNER"]'), github.event.pull_request.author_association) && github.event.pull_request.user.type != 'Bot' && !github.event.pull_request.draft }}
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Check for existing review
id: check-for-review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
set -eo pipefail
REVIEW_COUNT=$(gh pr view $PR_URL --json reviews | jq '[ .reviews[] | select(.author.login == "github-actions") | select(.body | startswith("<!-- no-dependency-change -->")) ] | length')
if [[ $REVIEW_COUNT -eq 0 ]]; then
echo "SHOULD_REVIEW=1" >> "$GITHUB_OUTPUT"
fi
- name: Request changes
if: ${{ steps.check-for-review.outputs.SHOULD_REVIEW }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
printf "<!-- no-dependency-change -->\n\nHello @${{ github.event.pull_request.user.login }}! It looks like this pull request touches one of our dependency files, and per [our contribution policy](https://github.com/electron/electron/blob/main/CONTRIBUTING.md#dependencies-upgrades-policy) we do not accept these types of changes in PRs." | gh pr review $PR_URL -r --body-file=-

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux.' description: 'Platform to run on, can be macos or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -49,15 +49,10 @@ on:
required: true required: true
type: string type: string
default: '0' default: '0'
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency: concurrency:
group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
jobs: jobs:
build: build:

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -49,20 +49,10 @@ on:
required: true required: true
type: string type: string
default: '0' default: '0'
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency: concurrency:
group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions:
contents: read
issues: read
pull-requests: read
jobs: jobs:
build: build:
@@ -76,7 +66,16 @@ jobs:
gn-build-type: ${{ inputs.gn-build-type }} gn-build-type: ${{ inputs.gn-build-type }}
generate-symbols: ${{ inputs.generate-symbols }} generate-symbols: ${{ inputs.generate-symbols }}
upload-to-storage: ${{ inputs.upload-to-storage }} upload-to-storage: ${{ inputs.upload-to-storage }}
is-asan: ${{ inputs.is-asan}} secrets: inherit
gn-check:
if: ${{ inputs.target-platform == 'macos' || inputs.target-arch != 'arm' }}
uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
with:
target-platform: ${{ inputs.target-platform }}
target-arch: ${{ inputs.target-arch }}
check-runs-on: ${{ inputs.build-runs-on }}
check-container: ${{ inputs.build-container }}
gn-build-type: ${{ inputs.gn-build-type }}
secrets: inherit secrets: inherit
test: test:
uses: ./.github/workflows/pipeline-segment-electron-test.yml uses: ./.github/workflows/pipeline-segment-electron-test.yml
@@ -86,5 +85,4 @@ jobs:
target-platform: ${{ inputs.target-platform }} target-platform: ${{ inputs.target-platform }}
test-runs-on: ${{ inputs.test-runs-on }} test-runs-on: ${{ inputs.test-runs-on }}
test-container: ${{ inputs.test-container }} test-container: ${{ inputs.test-container }}
is-asan: ${{ inputs.is-asan}}
secrets: inherit secrets: inherit

View File

@@ -15,18 +15,19 @@ concurrency:
jobs: jobs:
docs-only: docs-only:
name: Docs Only Compile name: Docs Only Compile
runs-on: electron-arc-linux-amd64-4core runs-on: aks-linux-medium
timeout-minutes: 20 timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install
- name: Run TS/JS compile - name: Run TS/JS compile
shell: bash shell: bash
run: | run: |

View File

@@ -9,35 +9,30 @@ on:
type: string type: string
concurrency: concurrency:
group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-lint-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
jobs: jobs:
lint: lint:
name: Lint name: Lint
runs-on: electron-arc-linux-amd64-4core runs-on: aks-linux-medium
timeout-minutes: 20 timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }} container: ${{ fromJSON(inputs.container) }}
steps: steps:
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
- name: Set Chromium Git Helper cd src/electron
uses: ./src/electron/.github/actions/set-chromium-git-helper node script/yarn install
- name: Setup third_party Depot Tools - name: Setup third_party Depot Tools
shell: bash shell: bash
run: | run: |
# "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file. # "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
echo "$(pwd)/src/third_party/depot_tools" >> $GITHUB_PATH echo "$(pwd)/src/third_party/depot_tools" >> $GITHUB_PATH
- name: Download GN Binary - name: Download GN Binary
shell: bash shell: bash
@@ -61,10 +56,7 @@ jobs:
mkdir -p src/buildtools mkdir -p src/buildtools
curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]" gclient runhooks --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
- name: Add ESLint problem matcher
shell: bash
run: echo "::add-matcher::src/electron/.github/problem-matchers/eslint-stylish.json"
- name: Run Lint - name: Run Lint
shell: bash shell: bash
run: | run: |

View File

@@ -9,16 +9,12 @@ on:
type: string type: string
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos, linux or windows'
required: true required: true
target-arch: target-arch:
type: string type: string
description: 'Arch to build for, can be x64, arm64, ia32 or arm' description: 'Arch to build for, can be x64, arm64 or arm'
required: true required: true
target-variant:
type: string
description: 'Variant to build for, no effect on non-macOS target platforms. Can be darwin, mas or all.'
default: all
build-runs-on: build-runs-on:
type: string type: string
description: 'What host to run the build' description: 'What host to run the build'
@@ -48,37 +44,28 @@ on:
required: true required: true
type: string type: string
default: '0' default: '0'
strip-binaries:
description: 'Strip the binaries before release (Linux only)'
required: false
type: boolean
default: false
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency: concurrency:
group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }} AZURE_AKS_CACHE_STORAGE_ACCOUNT: ${{ secrets.AZURE_AKS_CACHE_STORAGE_ACCOUNT }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }} AZURE_AKS_CACHE_SHARE_NAME: ${{ secrets.AZURE_AKS_CACHE_SHARE_NAME }}
ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }} ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }} ELECTRON_GITHUB_TOKEN: ${{ secrets.ELECTRON_GITHUB_TOKEN }}
SUDOWOODO_EXCHANGE_TOKEN: ${{ secrets.SUDOWOODO_EXCHANGE_TOKEN }} # Disable pre-compiled headers to reduce out size - only useful for rebuilds
GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || inputs.target-platform == 'win' && '--custom-var=checkout_win=True' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }} GN_BUILDFLAG_ARGS: 'enable_precompiled_headers=false'
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') }}
# Only disable this in the Asan build
CHECK_DIST_MANIFEST: true
IS_GHA_RELEASE: true
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
jobs: jobs:
build: build:
defaults:
run:
shell: bash
runs-on: ${{ inputs.build-runs-on }} runs-on: ${{ inputs.build-runs-on }}
container: ${{ fromJSON(inputs.build-container) }} container: ${{ fromJSON(inputs.build-container) }}
environment: ${{ inputs.environment }} environment: ${{ inputs.environment }}
@@ -86,98 +73,122 @@ jobs:
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
steps: steps:
- name: Create src dir - name: Create src dir
run: | run: mkdir src
mkdir src
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos
- name: Check disk space after freeing up space
if: ${{ inputs.target-platform == 'macos' }}
run: df -h
- name: Setup Node.js/npm - name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with: with:
node-version: 20.19.x node-version: 20.11.x
cache: yarn cache: yarn
cache-dependency-path: src/electron/yarn.lock cache-dependency-path: src/electron/yarn.lock
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies run: |
cd src/electron
node script/yarn install
- name: Install AZCopy - name: Install AZCopy
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
run: brew install azcopy run: brew install azcopy
- name: Enable windows toolchain
if: ${{ inputs.target-platform == 'windows' }}
run: |
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Set GN_EXTRA_ARGS for Linux - name: Set GN_EXTRA_ARGS for Linux
if: ${{ inputs.target-platform == 'linux' }} if: ${{ inputs.target-platform == 'linux' }}
run: | run: |
if [ "${{ inputs.target-arch }}" = "arm" ]; then if [ "${{ inputs.target-arch }}" = "arm" ]; then
if [ "${{ inputs.is-release }}" = true ]; then
GN_EXTRA_ARGS='target_cpu="arm" build_tflite_with_xnnpack=false symbol_level=1'
else
GN_EXTRA_ARGS='target_cpu="arm" build_tflite_with_xnnpack=false' GN_EXTRA_ARGS='target_cpu="arm" build_tflite_with_xnnpack=false'
fi
elif [ "${{ inputs.target-arch }}" = "arm64" ]; then elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
GN_EXTRA_ARGS='target_cpu="arm64" fatal_linker_warnings=false enable_linux_installer=false' GN_EXTRA_ARGS='target_cpu="arm64" fatal_linker_warnings=false enable_linux_installer=false'
elif [ "${{ inputs.is-asan }}" = true ]; then
GN_EXTRA_ARGS='is_asan=true'
fi fi
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Set Chromium Git Helper - name: Get Depot Tools
uses: ./src/electron/.github/actions/set-chromium-git-helper timeout-minutes: 5
- name: Install Build Tools run: |
uses: ./src/electron/.github/actions/install-build-tools 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 - name: Generate DEPS Hash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash) DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy - name: Restore src cache via AZCopy
if: ${{ inputs.target-platform != 'linux' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy uses: ./src/electron/.github/actions/restore-cache-azcopy
with:
target-platform: ${{ inputs.target-platform }}
- name: Restore src cache via AKS - name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' }} if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'windows' }}
uses: ./src/electron/.github/actions/restore-cache-aks uses: ./src/electron/.github/actions/restore-cache-aks
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} - name: Load 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: | run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} export BUILD_TOOLS_SHA=ff3e40a9a2ebb735c18b6450ecd5ddaa8bb364a9
npm i -g @electron/build-tools
e auto-update disable
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
- name: Run Electron Only Hooks - name: Run Electron Only Hooks
run: | run: |
e d 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
# Fix VS Toolchain
if [ "${{ inputs.target-platform }}" = "windows" ]; then
rm -rf src/third_party/depot_tools/win_toolchain/vs_files
e d python3 src/build/vs_toolchain.py update --force
fi
- name: Regenerate DEPS Hash - name: Regenerate DEPS Hash
run: | run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env - name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Setup Number of Ninja Processes - name: Fix Sync (macOS)
if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/fix-sync-macos
- name: Install build-tools & Setup RBE
run: | run: |
echo "NUMBER_OF_NINJA_PROCESSES=${{ inputs.target-platform != 'macos' && '300' || '200' }}" >> $GITHUB_ENV 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) - name: Free up space (macOS)
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/free-space-macos uses: ./src/electron/.github/actions/free-space-macos
- name: Build Electron - name: Build Electron
if: ${{ inputs.target-platform != 'macos' || (inputs.target-variant == 'all' || inputs.target-variant == 'darwin') }}
uses: ./src/electron/.github/actions/build-electron uses: ./src/electron/.github/actions/build-electron
with: with:
target-arch: ${{ inputs.target-arch }} target-arch: ${{ inputs.target-arch }}
@@ -185,17 +196,15 @@ jobs:
artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }} artifact-platform: ${{ inputs.target-platform == 'macos' && 'darwin' || inputs.target-platform }}
is-release: '${{ inputs.is-release }}' is-release: '${{ inputs.is-release }}'
generate-symbols: '${{ inputs.generate-symbols }}' generate-symbols: '${{ inputs.generate-symbols }}'
strip-binaries: '${{ inputs.strip-binaries }}'
upload-to-storage: '${{ inputs.upload-to-storage }}' upload-to-storage: '${{ inputs.upload-to-storage }}'
is-asan: '${{ inputs.is-asan }}'
- name: Set GN_EXTRA_ARGS for MAS Build - name: Set GN_EXTRA_ARGS for MAS Build
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }} if: ${{ inputs.target-platform == 'macos' }}
run: | run: |
echo "MAS_BUILD=true" >> $GITHUB_ENV echo "MAS_BUILD=true" >> $GITHUB_ENV
GN_EXTRA_ARGS='is_mas_build=true' GN_EXTRA_ARGS='is_mas_build=true'
echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
- name: Build Electron (MAS) - name: Build Electron (MAS)
if: ${{ inputs.target-platform == 'macos' && (inputs.target-variant == 'all' || inputs.target-variant == 'mas') }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/build-electron uses: ./src/electron/.github/actions/build-electron
with: with:
target-arch: ${{ inputs.target-arch }} target-arch: ${{ inputs.target-arch }}

View File

@@ -5,11 +5,11 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos or linux'
required: true required: true
target-archs: target-arch:
type: string type: string
description: 'Archs to check for, can be x64, x86, arm64 or arm space separated' description: 'Arch to build for, can be x64, arm64 or arm'
required: true required: true
check-runs-on: check-runs-on:
type: string type: string
@@ -27,134 +27,129 @@ on:
default: testing default: testing
concurrency: concurrency:
group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }} group: electron-gn-check-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env: env:
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
GN_BUILDFLAG_ARGS: 'enable_precompiled_headers=false'
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') }} 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 ELECTRON_OUT_DIR: Default
TARGET_ARCH: ${{ inputs.target-arch }}
jobs: jobs:
gn-check: gn-check:
defaults: # TODO(codebytere): Change this to medium VM
run:
shell: bash
runs-on: ${{ inputs.check-runs-on }} runs-on: ${{ inputs.check-runs-on }}
container: ${{ fromJSON(inputs.check-container) }} container: ${{ fromJSON(inputs.check-container) }}
strategy:
fail-fast: false
matrix:
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'windows' && fromJSON('["windows"]') || fromJSON('["linux"]')) }}
env:
BUILD_TYPE: ${{ matrix.build-type }}
TARGET_ARCH: ${{ inputs.target-arch }}
steps: steps:
- name: Load Build Tools
run: |
export BUILD_TOOLS_SHA=ff3e40a9a2ebb735c18b6450ecd5ddaa8bb364a9
npm i -g @electron/build-tools
e auto-update disable
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }} - name: Get Depot Tools
- name: Cleanup disk space on macOS timeout-minutes: 5
if: ${{ inputs.target-platform == 'macos' }}
shell: bash
run: | run: |
sudo mkdir -p $TMPDIR/del-target git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
tmpify() { SEDOPTION="-i"
if [ -d "$1" ]; then if [ "`uname`" = "Darwin" ]; then
sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1) SEDOPTION="-i ''"
fi fi
}
tmpify /Library/Developer/CoreSimulator # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
tmpify ~/Library/Developer/CoreSimulator sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
sudo rm -rf $TMPDIR/del-target
- name: Check disk space after freeing up space # Ensure depot_tools does not update.
if: ${{ inputs.target-platform == 'macos' }} test -d depot_tools && cd depot_tools
run: df -h if [ "`uname`" = "Linux" ]; then
- name: Set Chromium Git Helper git apply --3way ../src/electron/.github/workflows/config/gclient.diff
uses: ./src/electron/.github/actions/set-chromium-git-helper fi
- name: Install Build Tools touch .disable_auto_update
uses: ./src/electron/.github/actions/install-build-tools - name: Add Depot Tools to PATH
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- 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: 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 - name: Enable windows toolchain
if: ${{ inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'windows' }}
run: | run: |
echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
- name: Generate DEPS Hash - name: Generate DEPS Hash
run: | run: |
node src/electron/script/generate-deps-hash.js node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
DEPSHASH=v1-src-cache-$(cat src/electron/.depshash) DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
- name: Restore src cache via AZCopy - name: Restore src cache via AZCopy
if: ${{ inputs.target-platform == 'macos' }} if: ${{ inputs.target-platform == 'macos' }}
uses: ./src/electron/.github/actions/restore-cache-azcopy uses: ./src/electron/.github/actions/restore-cache-azcopy
with:
target-platform: ${{ inputs.target-platform }}
- name: Restore src cache via AKS - name: Restore src cache via AKS
if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }} if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'windows' }}
uses: ./src/electron/.github/actions/restore-cache-aks uses: ./src/electron/.github/actions/restore-cache-aks
with:
target-platform: ${{ inputs.target-platform }}
- name: Run Electron Only Hooks - name: Run Electron Only Hooks
run: | run: |
echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
if [ "${{ inputs.target-platform }}" = "win" ]; then 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 "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 echo "target_os=['win']" >> tmpgclient
fi fi
e d gclient runhooks --gclientfile=tmpgclient gclient runhooks --gclientfile=tmpgclient
# Fix VS Toolchain
if [ "${{ inputs.target-platform }}" = "win" ]; then
rm -rf src/third_party/depot_tools/win_toolchain/vs_files
e d python3 src/build/vs_toolchain.py update --force
fi
- name: Regenerate DEPS Hash - name: Regenerate DEPS Hash
run: | run: |
(cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
- name: Add CHROMIUM_BUILDTOOLS_PATH to env - name: Add CHROMIUM_BUILDTOOLS_PATH to env
run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies
- name: Default GN gen - name: Default GN gen
run: | run: |
cd src/electron cd src/electron
git pack-refs git pack-refs
- name: Run GN Check for ${{ inputs.target-archs }} cd ..
run: |
for target_cpu in ${{ inputs.target-archs }}
do
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
cd src
export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
if [ "${{ inputs.target-platform }}" = "linux" ]; then
if [ "$target_cpu" = "arm" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
elif [ "$target_cpu" = "arm64" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
fi
fi
if [ "${{ inputs.target-platform }}" = "win" ]; then
export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
fi
e build --only-gen e build --only-gen
- name: Run GN Check
run: |
cd src
e d gn check out/Default //electron:electron_lib 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:electron_app
e d gn check out/Default //electron/shell/common:mojo e d gn check out/Default //electron/shell/common/api:mojo
e d gn check out/Default //electron/shell/common:plugin
# Check the hunspell filenames # Check the hunspell filenames
node electron/script/gen-hunspell-filenames.js --check node electron/script/gen-hunspell-filenames.js --check
node electron/script/gen-libc++-filenames.js --check node electron/script/gen-libc++-filenames.js --check
cd ..
done
- name: Wait for active SSH sessions - name: Wait for active SSH sessions
if: always() && !cancelled() if: always() && !cancelled()
shell: bash
run: | run: |
while [ -f /var/.ssh-lock ] while [ -f /var/.ssh-lock ]
do do

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -20,176 +20,85 @@ on:
description: 'JSON container information for aks runs-on' description: 'JSON container information for aks runs-on'
required: false required: false
default: '{"image":null}' default: '{"image":null}'
is-asan:
description: 'Building the Address Sanitizer (ASan) Linux build'
required: false
type: boolean
default: false
concurrency: concurrency:
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
permissions:
contents: read
issues: read
pull-requests: read
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
jobs: jobs:
test: test:
defaults:
run:
shell: bash
runs-on: ${{ inputs.test-runs-on }} runs-on: ${{ inputs.test-runs-on }}
container: ${{ fromJSON(inputs.test-container) }} container: ${{ fromJSON(inputs.test-container) }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'win' && fromJSON('["win"]') || fromJSON('["linux"]')) }} build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || (inputs.target-platform == 'windows' && fromJSON('["windows"]') || fromJSON('["linux"]')) }}
shard: ${{ inputs.target-platform == 'linux' && fromJSON('[1, 2, 3]') || fromJSON('[1, 2]') }} shard: ${{ inputs.target-platform == 'macos' && fromJSON('[1]') || fromJSON('[1, 2, 3]') }}
env: env:
BUILD_TYPE: ${{ matrix.build-type }} BUILD_TYPE: ${{ matrix.build-type }}
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
ARTIFACT_KEY: ${{ matrix.build-type }}_${{ inputs.target-arch }}
steps: steps:
- name: Fix node20 on arm32 runners
if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }}
run: |
cp $(which node) /mnt/runner-externals/node20/bin/
- name: Install Git on Windows arm64 runners
if: ${{ inputs.target-arch == 'arm64' && inputs.target-platform == 'win' }}
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y --no-progress git.install --params "'/GitAndUnixToolsOnPath'"
choco install -y --no-progress git
choco install -y --no-progress python --version 3.11.9
choco install -y --no-progress visualstudio2022-workload-vctools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Python311" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cp "C:\Python311\python.exe" "C:\Python311\python3.exe"
- name: Setup Node.js/npm
if: ${{ inputs.target-platform == 'win' }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 20.19.x
- name: Add TCC permissions on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: |
configure_user_tccdb () {
local values=$1
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
local sqlQuery="INSERT OR REPLACE INTO access VALUES($values);"
sqlite3 "$dbPath" "$sqlQuery"
}
configure_sys_tccdb () {
local values=$1
local dbPath="/Library/Application Support/com.apple.TCC/TCC.db"
local sqlQuery="INSERT OR REPLACE INTO access VALUES($values);"
sudo sqlite3 "$dbPath" "$sqlQuery"
}
userValuesArray=(
"'kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
"'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
)
for values in "${userValuesArray[@]}"; do
# Sonoma and higher have a few extra values
# Ref: https://github.com/actions/runner-images/blob/main/images/macos/scripts/build/configure-tccdb-macos.sh
if [ "$OSTYPE" = "darwin23" ]; then
configure_user_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
configure_sys_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
else
configure_user_tccdb "$values"
configure_sys_tccdb "$values"
fi
done
- name: Turn off the unexpectedly quit dialog on macOS
if: ${{ inputs.target-platform == 'macos' }}
run: defaults write com.apple.CrashReporter DialogType server
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/install-dependencies shell: bash
- name: Set Chromium Git Helper run: |
uses: ./src/electron/.github/actions/set-chromium-git-helper cd src/electron
node script/yarn install
- name: Get Depot Tools - name: Get Depot Tools
timeout-minutes: 5 timeout-minutes: 5
shell: bash
run: | run: |
git config --global core.filemode false git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
git config --global core.autocrlf false if [ "`uname`" = "Darwin" ]; then
git config --global branch.autosetuprebase always # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
git config --global core.fscache true sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
git config --global core.preloadindex true else
git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
fi
# Ensure depot_tools does not update. # Ensure depot_tools does not update.
test -d depot_tools && cd depot_tools test -d depot_tools && cd depot_tools
touch .disable_auto_update touch .disable_auto_update
- name: Add Depot Tools to PATH - name: Add Depot Tools to PATH
shell: bash
run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
- name: Load ASan specific environment variables
if: ${{ inputs.is-asan == true }}
run: |
echo "ARTIFACT_KEY=${{ matrix.build-type }}_${{ inputs.target-arch }}_asan" >> $GITHUB_ENV
echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV
echo "IS_ASAN=true" >> $GITHUB_ENV
- name: Download Generated Artifacts - name: Download Generated Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: generated_artifacts_${{ env.ARTIFACT_KEY }} name: generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: src_artifacts_${{ env.ARTIFACT_KEY }} name: src_artifacts_${{ matrix.build-type }}_${{ env.TARGET_ARCH }}
path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} path: ./src_artifacts_${{ matrix.build-type }}_${{ env.TARGET_ARCH }}
- name: Restore Generated Artifacts - name: Restore Generated Artifacts
shell: bash
run: ./src/electron/script/actions/restore-artifacts.sh run: ./src/electron/script/actions/restore-artifacts.sh
- name: Unzip Dist, Mksnapshot & Chromedriver (win) - name: Unzip Dist, Mksnapshot & Chromedriver
if: ${{ inputs.target-platform == 'win' }} shell: bash
shell: powershell
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force
cd src/out/Default
Expand-Archive -Force dist.zip -DestinationPath ./
Expand-Archive -Force chromedriver.zip -DestinationPath ./
Expand-Archive -Force mksnapshot.zip -DestinationPath ./
- name: Unzip Dist, Mksnapshot & Chromedriver (unix)
if: ${{ inputs.target-platform != 'win' }}
run: | run: |
cd src/out/Default cd src/out/Default
unzip -:o dist.zip unzip -:o dist.zip
unzip -:o chromedriver.zip unzip -:o chromedriver.zip
unzip -:o mksnapshot.zip unzip -:o mksnapshot.zip
- name: Import & Trust Self-Signed Codesigning Cert on MacOS # - name: Import & Trust Self-Signed Codesigning Cert on MacOS
if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }} # if: ${{ inputs.target-platform == 'macos' }}
run: | # run: |
sudo security authorizationdb write com.apple.trust-settings.admin allow # sudo security authorizationdb write com.apple.trust-settings.admin allow
cd src/electron # cd src/electron
./script/codesign/generate-identity.sh # ./script/codesign/generate-identity.sh
- name: Install Datadog CLI
run: |
cd src/electron
node script/yarn global add @datadog/datadog-ci
- name: Run Electron Tests - name: Run Electron Tests
shell: bash shell: bash
env: env:
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1 ELECTRON_DISABLE_SECURITY_WARNINGS: 1
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
@@ -197,63 +106,19 @@ jobs:
NPM_CONFIG_MSVS_VERSION: '2022' NPM_CONFIG_MSVS_VERSION: '2022'
run: | run: |
cd src/electron cd src/electron
export ELECTRON_TEST_RESULTS_DIR=`pwd`/junit
# Get which tests are on this shard # Get which tests are on this shard
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'linux' && 3 || 2 }}) tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 1 || 3 }})
# Run tests # Run tests
if [ "${{ inputs.target-platform }}" != "linux" ]; then if [ "${{ inputs.target-platform }}" != "linux" ]; then
echo "About to start tests"
if [ "${{ inputs.target-platform }}" = "win" ]; then
if [ "${{ inputs.target-arch }}" = "x86" ]; then
export npm_config_arch="ia32"
fi
if [ "${{ inputs.target-arch }}" = "arm64" ]; then
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
fi
fi
node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
else else
chown :builduser .. && chmod g+w .. chown :builduser .. && chmod g+w ..
chown -R :builduser . && chmod -R g+w . chown -R :builduser . && chmod -R g+w .
chmod 4755 ../out/Default/chrome-sandbox chmod 4755 ../out/Default/chrome-sandbox
runuser -u builduser -- git config --global --add safe.directory $(pwd) runuser -u builduser -- git config --global --add safe.directory $(pwd)
if [ "${{ inputs.is-asan }}" == "true" ]; then
cd ..
ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron"
export ASAN_OPTIONS="symbolize=0 handle_abort=1"
export G_SLICE=always-malloc
export NSS_DISABLE_ARENA_FREE_LIST=1
export NSS_DISABLE_UNLOAD=1
export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
export MOCHA_TIMEOUT=180000
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
cd electron
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files | $ASAN_SYMBOLIZE
else
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
fi fi
fi
- name: Upload Test results to Datadog
env:
DD_ENV: ci
DD_SERVICE: electron
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_CIVISIBILITY_LOGS_ENABLED: true
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
run: |
if ! [ -z $DD_API_KEY ] && [ -f src/electron/junit/test-results-main.xml ]; then
export DATADOG_PATH=`node src/electron/script/yarn global bin`
$DATADOG_PATH/datadog-ci junit upload src/electron/junit/test-results-main.xml
fi
if: always() && !cancelled()
- name: Upload Test Artifacts
if: always() && !cancelled()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }}
path: src/electron/spec/artifacts
if-no-files-found: ignore
- name: Wait for active SSH sessions - name: Wait for active SSH sessions
if: always() && !cancelled() if: always() && !cancelled()
shell: bash shell: bash

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
target-platform: target-platform:
type: string type: string
description: 'Platform to run on, can be macos, win or linux' description: 'Platform to run on, can be macos or linux'
required: true required: true
target-arch: target-arch:
type: string type: string
@@ -27,47 +27,57 @@ on:
default: testing default: testing
concurrency: concurrency:
group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_protected != true }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
env: env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
ELECTRON_OUT_DIR: Default ELECTRON_OUT_DIR: Default
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
jobs: jobs:
node-tests: node-tests:
name: Run Node.js Tests name: Run Node.js Tests
runs-on: electron-arc-linux-amd64-8core runs-on: aks-linux-medium-plus
timeout-minutes: 30 timeout-minutes: 20
env: env:
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux BUILD_TYPE: linux
container: ${{ fromJSON(inputs.test-container) }} container: ${{ fromJSON(inputs.test-container) }}
steps: steps:
- name: Load Build Tools
run: |
export BUILD_TOOLS_SHA=ff3e40a9a2ebb735c18b6450ecd5ddaa8bb364a9
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 - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- 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 }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/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 - name: Download Generated Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }} name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
@@ -85,7 +95,6 @@ jobs:
node electron/script/node-spec-runner.js --default --jUnitDir=junit node electron/script/node-spec-runner.js --default --jUnitDir=junit
- name: Wait for active SSH sessions - name: Wait for active SSH sessions
if: always() && !cancelled() if: always() && !cancelled()
shell: bash
run: | run: |
while [ -f /var/.ssh-lock ] while [ -f /var/.ssh-lock ]
do do
@@ -93,35 +102,47 @@ jobs:
done done
nan-tests: nan-tests:
name: Run Nan Tests name: Run Nan Tests
runs-on: electron-arc-linux-amd64-4core runs-on: aks-linux-medium
timeout-minutes: 30 timeout-minutes: 20
env: env:
TARGET_ARCH: ${{ inputs.target-arch }} TARGET_ARCH: ${{ inputs.target-arch }}
BUILD_TYPE: linux BUILD_TYPE: linux
container: ${{ fromJSON(inputs.test-container) }} container: ${{ fromJSON(inputs.test-container) }}
steps: steps:
- name: Load Build Tools
run: |
export BUILD_TOOLS_SHA=ff3e40a9a2ebb735c18b6450ecd5ddaa8bb364a9
npm i -g @electron/build-tools
e auto-update disable
e init --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Checkout Electron - name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with: with:
path: src/electron path: src/electron
fetch-depth: 0 fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Chromium Git Helper
uses: ./src/electron/.github/actions/set-chromium-git-helper
- name: Install Build Tools
uses: ./src/electron/.github/actions/install-build-tools
- name: Init Build Tools
run: |
e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
- name: Install Dependencies - name: Install Dependencies
uses: ./src/electron/.github/actions/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 - name: Download Generated Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
- name: Download Src Artifacts - name: Download Src Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with: with:
name: src_artifacts_linux_${{ env.TARGET_ARCH }} name: src_artifacts_linux_${{ env.TARGET_ARCH }}
path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
@@ -133,12 +154,11 @@ jobs:
unzip -:o dist.zip unzip -:o dist.zip
- name: Setup Linux for Headless Testing - name: Setup Linux for Headless Testing
run: sh -e /etc/init.d/xvfb start run: sh -e /etc/init.d/xvfb start
- name: Run Nan Tests - name: Run Node.js Tests
run: | run: |
cd src cd src
node electron/script/nan-spec-runner.js node electron/script/nan-spec-runner.js
- name: Wait for active SSH sessions - name: Wait for active SSH sessions
shell: bash
if: always() && !cancelled() if: always() && !cancelled()
run: | run: |
while [ -f /var/.ssh-lock ] while [ -f /var/.ssh-lock ]

View File

@@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Trigger Slack workflow - name: Trigger Slack workflow
uses: slackapi/slack-github-action@b0fa283ad8fea605de13dc3f449259339835fc52 # v2.1.0 uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
with: with:
webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: | payload: |
{ {
"url": "${{ github.event.pull_request.html_url }}" "url": "${{ github.event.pull_request.html_url }}"
} }
env:
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
pull-request-labeled-deprecation-review-complete: pull-request-labeled-deprecation-review-complete:
name: deprecation-review/complete label added name: deprecation-review/complete label added
if: github.event.label.name == 'deprecation-review/complete ✅' if: github.event.label.name == 'deprecation-review/complete ✅'
@@ -33,7 +33,7 @@ jobs:
creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }} creds: ${{ secrets.RELEASE_BOARD_GH_APP_CREDS }}
org: electron org: electron
- name: Set status - name: Set status
uses: dsanders11/project-actions/edit-item@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/edit-item@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
token: ${{ steps.generate-token.outputs.token }} token: ${{ steps.generate-token.outputs.token }}
project-number: 94 project-number: 94

View File

@@ -22,13 +22,13 @@ jobs:
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with: with:
persist-credentials: false persist-credentials: false
# This is a pre-submit / pre-release. # This is a pre-submit / pre-release.
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
@@ -42,7 +42,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab. # format to the repository Actions tab.
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
@@ -50,6 +50,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18 uses: github/codeql-action/upload-sarif@f079b8493333aace61c81488f8bd40919487bd9f # v3.25.7
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: semantic-pull-request - name: semantic-pull-request
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3 uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e # v5.5.2
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:

View File

@@ -27,7 +27,7 @@ jobs:
PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number') PROJECT_NUMBER=$(gh project list --owner electron --format json | jq -r '.projects | map(select(.title | test("^[0-9]+-x-y$"))) | max_by(.number) | .number')
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT" echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> "$GITHUB_OUTPUT"
- name: Update Completed Stable Prep Items - name: Update Completed Stable Prep Items
uses: dsanders11/project-actions/completed-by@2134fe7cc71c58b7ae259c82a8e63c6058255678 # v1.7.0 uses: dsanders11/project-actions/completed-by@eb760c48894b5702398529cbb8f6e98378e315d0 # v1.3.0
with: with:
field: Prep Status field: Prep Status
field-value: ✅ Complete field-value: ✅ Complete

View File

@@ -16,7 +16,7 @@ jobs:
id: generate-token id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with: with:
repo-token: ${{ steps.generate-token.outputs.token }} repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: 90 days-before-stale: 90
@@ -39,7 +39,7 @@ jobs:
id: generate-token id: generate-token
with: with:
creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # tag: v9.0.0
with: with:
repo-token: ${{ steps.generate-token.outputs.token }} repo-token: ${{ steps.generate-token.outputs.token }}
days-before-stale: -1 days-before-stale: -1

View File

@@ -0,0 +1,73 @@
name: Update AppVeyor Image
# Run chron daily Mon-Fri
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * 1-5' # runs 8:00 every business day (see https://crontab.guru)
permissions: {}
jobs:
bake-appveyor-image:
name: Bake AppVeyor Image
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
id: generate-token
with:
creds: ${{ secrets.APPVEYOR_UPDATER_GH_APP_CREDS }}
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Yarn install
run: |
node script/yarn.js install --frozen-lockfile
- name: Set Repo for Commit
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Check AppVeyor Image
env:
APPVEYOR_TOKEN: ${{ secrets.APPVEYOR_TOKEN }}
run: |
node ./script/prepare-appveyor
if [ -f ./image_version.txt ]; then
echo "APPVEYOR_IMAGE_VERSION="$(cat image_version.txt)"" >> $GITHUB_ENV
rm image_version.txt
fi
- name: (Optionally) Update Appveyor Image
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: mikefarah/yq@557dcb87b8efe786f89a12c09e9046b4753ab72e # v4.44.1
with:
cmd: |
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor.yml" > "appveyor2.yml"
yq '.image = "${{ env.APPVEYOR_IMAGE_VERSION }}"' "appveyor-woa.yml" > "appveyor-woa2.yml"
- name: (Optionally) Generate Commit Diff
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor.yml appveyor2.yml > appveyor.diff || true
patch -f appveyor.yml < appveyor.diff
rm appveyor2.yml appveyor.diff
git add appveyor.yml
- name: (Optionally) Generate Commit Diff for WOA
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
diff -w -B appveyor-woa.yml appveyor-woa2.yml > appveyor-woa.diff || true
patch -f appveyor-woa.yml < appveyor-woa.diff
rm appveyor-woa2.yml appveyor-woa.diff
git add appveyor-woa.yml
- name: (Optionally) Commit to Branch
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
uses: dsanders11/github-app-commit-action@48d2ff8c1a855eb15d16afa97ae12616456d7cbc # v1.4.0
with:
message: 'build: update appveyor image to latest version'
ref: bump-appveyor-image
token: ${{ steps.generate-token.outputs.token }}
- name: (Optionally) Create Pull Request
if: ${{ env.APPVEYOR_IMAGE_VERSION }}
run: |
printf "This PR updates appveyor.yml to the latest baked image, ${{ env.APPVEYOR_IMAGE_VERSION }}.\n\nNotes: none" | gh pr create --head bump-appveyor-image --label no-backport --label semver/none --title 'build: update appveyor image to latest version' --body-file=-
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

View File

@@ -1,90 +0,0 @@
name: Publish Windows
on:
workflow_dispatch:
inputs:
build-image-sha:
type: string
description: 'SHA for electron/build image'
default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
required: true
upload-to-storage:
description: 'Uploads to Azure storage'
required: false
default: '1'
type: string
run-windows-publish:
description: 'Run the publish jobs vs just the build jobs'
type: boolean
default: false
jobs:
checkout-windows:
runs-on: electron-arc-linux-amd64-32core
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
options: --user root --device /dev/fuse --cap-add SYS_ADMIN
volumes:
- /mnt/win-cache:/mnt/win-cache
- /var/run/sas:/var/run/sas
env:
CHROMIUM_GIT_AUTH: ${{ secrets.CHROMIUM_GIT_AUTH }}
CHROMIUM_GIT_USER: ${{ secrets.CHROMIUM_GIT_USER }}
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
TARGET_OS: 'win'
ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
outputs:
build-image-sha: ${{ inputs.build-image-sha }}
steps:
- name: Checkout Electron
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: src/electron
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
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-arm64-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: arm64
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit
publish-x86-win:
uses: ./.github/workflows/pipeline-segment-electron-build.yml
needs: checkout-windows
with:
environment: production-release
build-runs-on: electron-arc-windows-amd64-16core
target-platform: win
target-arch: x86
is-release: true
gn-build-type: release
generate-symbols: true
upload-to-storage: ${{ inputs.upload-to-storage }}
secrets: inherit

1
.gitignore vendored
View File

@@ -48,6 +48,7 @@ ts-gen
# Used to accelerate CI builds # Used to accelerate CI builds
.depshash .depshash
.depshash-target
# Used to accelerate builds after sync # Used to accelerate builds after sync
patches/mtime-cache.json patches/mtime-cache.json

View File

@@ -1,14 +1,10 @@
{ {
"config": { "config": {
"extends": "@electron/lint-roller/configs/markdownlint.json", "extends": "@electron/lint-roller/configs/markdownlint.json",
"descriptive-link-text": false,
"link-image-style": { "link-image-style": {
"autolink": false, "autolink": false,
"shortcut": false "shortcut": false
}, },
"MD049": {
"style": "underscore"
},
"no-angle-brackets": true, "no-angle-brackets": true,
"no-curly-braces": true, "no-curly-braces": true,
"no-inline-html": { "no-inline-html": {
@@ -27,6 +23,6 @@
"no-newline-in-links": true "no-newline-in-links": true
}, },
"customRules": [ "customRules": [
"./node_modules/@electron/lint-roller/markdownlint-rules/index.mjs" "@electron/lint-roller/markdownlint-rules/"
] ]
} }

2
.nvmrc
View File

@@ -1 +1 @@
20 16

109
BUILD.gn
View File

@@ -9,7 +9,7 @@ import("//pdf/features.gni")
import("//ppapi/buildflags/buildflags.gni") import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//third_party/electron_node/node.gni") import("//third_party/electron_node/electron_node.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni") import("//third_party/ffmpeg/ffmpeg_options.gni")
import("//tools/generate_library_loader/generate_library_loader.gni") import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
@@ -17,28 +17,29 @@ import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/snapshot_toolchain.gni") import("//v8/gni/snapshot_toolchain.gni")
import("build/asar.gni") import("build/asar.gni")
import("build/electron_paks.gni")
import("build/extract_symbols.gni") import("build/extract_symbols.gni")
import("build/js2c_toolchain.gni")
import("build/npm.gni") import("build/npm.gni")
import("build/templated_file.gni") import("build/templated_file.gni")
import("build/tsc.gni") import("build/tsc.gni")
import("build/webpack/webpack.gni") import("build/webpack/webpack.gni")
import("buildflags/buildflags.gni") import("buildflags/buildflags.gni")
import("electron_paks.gni")
import("filenames.auto.gni") import("filenames.auto.gni")
import("filenames.gni") import("filenames.gni")
import("filenames.hunspell.gni") import("filenames.hunspell.gni")
import("filenames.libcxx.gni") import("filenames.libcxx.gni")
import("filenames.libcxxabi.gni") import("filenames.libcxxabi.gni")
import("js2c_toolchain.gni")
if (is_mac) { if (is_mac) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
import("build/rules.gni") import("build/rules.gni")
assert( assert(
mac_deployment_target == "11.0", mac_deployment_target == "10.15",
"Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change") "Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
} }
@@ -74,7 +75,7 @@ if (is_linux) {
"notify_notification_set_image_from_pixbuf", "notify_notification_set_image_from_pixbuf",
"notify_notification_set_timeout", "notify_notification_set_timeout",
"notify_notification_set_urgency", "notify_notification_set_urgency",
"notify_notification_set_hint", "notify_notification_set_hint_string",
"notify_notification_show", "notify_notification_show",
"notify_notification_close", "notify_notification_close",
] ]
@@ -84,10 +85,7 @@ if (is_linux) {
# from the gtk library. Function signatures for which stubs are # from the gtk library. Function signatures for which stubs are
# required should be declared in the sig files. # required should be declared in the sig files.
generate_stubs("electron_gtk_stubs") { generate_stubs("electron_gtk_stubs") {
sigs = [ sigs = [ "shell/browser/ui/electron_gdk_pixbuf.sigs" ]
"shell/browser/ui/electron_gdk.sigs",
"shell/browser/ui/electron_gdk_pixbuf.sigs",
]
extra_header = "shell/browser/ui/electron_gtk.fragment" extra_header = "shell/browser/ui/electron_gtk.fragment"
output_name = "electron_gtk_stubs" output_name = "electron_gtk_stubs"
public_deps = [ "//ui/gtk:gtk_config" ] public_deps = [ "//ui/gtk:gtk_config" ]
@@ -224,21 +222,11 @@ webpack_build("electron_utility_bundle") {
out_file = "$target_gen_dir/js2c/utility_init.js" out_file = "$target_gen_dir/js2c/utility_init.js"
} }
webpack_build("electron_preload_realm_bundle") {
deps = [ ":build_electron_definitions" ]
inputs = auto_filenames.preload_realm_bundle_deps
config_file = "//electron/build/webpack/webpack.config.preload_realm.js"
out_file = "$target_gen_dir/js2c/preload_realm_bundle.js"
}
action("electron_js2c") { action("electron_js2c") {
deps = [ deps = [
":electron_browser_bundle", ":electron_browser_bundle",
":electron_isolated_renderer_bundle", ":electron_isolated_renderer_bundle",
":electron_node_bundle", ":electron_node_bundle",
":electron_preload_realm_bundle",
":electron_renderer_bundle", ":electron_renderer_bundle",
":electron_sandboxed_renderer_bundle", ":electron_sandboxed_renderer_bundle",
":electron_utility_bundle", ":electron_utility_bundle",
@@ -250,7 +238,6 @@ action("electron_js2c") {
"$target_gen_dir/js2c/browser_init.js", "$target_gen_dir/js2c/browser_init.js",
"$target_gen_dir/js2c/isolated_bundle.js", "$target_gen_dir/js2c/isolated_bundle.js",
"$target_gen_dir/js2c/node_init.js", "$target_gen_dir/js2c/node_init.js",
"$target_gen_dir/js2c/preload_realm_bundle.js",
"$target_gen_dir/js2c/renderer_init.js", "$target_gen_dir/js2c/renderer_init.js",
"$target_gen_dir/js2c/sandbox_bundle.js", "$target_gen_dir/js2c/sandbox_bundle.js",
"$target_gen_dir/js2c/utility_init.js", "$target_gen_dir/js2c/utility_init.js",
@@ -314,7 +301,7 @@ asar("default_app_asar") {
} }
grit("resources") { grit("resources") {
source = "build/electron_resources.grd" source = "electron_resources.grd"
outputs = [ outputs = [
"grit/electron_resources.h", "grit/electron_resources.h",
@@ -422,7 +409,7 @@ action("electron_generate_node_defines") {
source_set("electron_lib") { source_set("electron_lib") {
configs += [ configs += [
"//v8:external_startup_data", "//v8:external_startup_data",
"//third_party/electron_node:node_external_config", "//third_party/electron_node:node_internals",
] ]
public_configs = [ public_configs = [
@@ -439,9 +426,7 @@ source_set("electron_lib") {
"buildflags", "buildflags",
"chromium_src:chrome", "chromium_src:chrome",
"chromium_src:chrome_spellchecker", "chromium_src:chrome_spellchecker",
"shell/common:mojo", "shell/common/api:mojo",
"shell/common:plugin",
"shell/common:web_contents_utility",
"shell/services/node/public/mojom", "shell/services/node/public/mojom",
"//base:base_static", "//base:base_static",
"//base/allocator:buildflags", "//base/allocator:buildflags",
@@ -451,7 +436,7 @@ source_set("electron_lib") {
"//components/autofill/core/common:features", "//components/autofill/core/common:features",
"//components/certificate_transparency", "//components/certificate_transparency",
"//components/compose:buildflags", "//components/compose:buildflags",
"//components/embedder_support:user_agent", "//components/embedder_support:browser_util",
"//components/input:input", "//components/input:input",
"//components/language/core/browser", "//components/language/core/browser",
"//components/net_log", "//components/net_log",
@@ -498,7 +483,7 @@ source_set("electron_lib") {
"//third_party/blink/public:blink_devtools_inspector_resources", "//third_party/blink/public:blink_devtools_inspector_resources",
"//third_party/blink/public/platform/media", "//third_party/blink/public/platform/media",
"//third_party/boringssl", "//third_party/boringssl",
"//third_party/electron_node:libnode", "//third_party/electron_node:node_lib",
"//third_party/inspector_protocol:crdtp", "//third_party/inspector_protocol:crdtp",
"//third_party/leveldatabase", "//third_party/leveldatabase",
"//third_party/libyuv", "//third_party/libyuv",
@@ -533,10 +518,7 @@ source_set("electron_lib") {
"//third_party/blink/renderer", "//third_party/blink/renderer",
] ]
defines = [ defines = [ "V8_DEPRECATION_WARNINGS" ]
"BLINK_MOJO_IMPL=1",
"V8_DEPRECATION_WARNINGS",
]
libs = [] libs = []
if (is_linux) { if (is_linux) {
@@ -550,7 +532,7 @@ source_set("electron_lib") {
] ]
} }
deps += [ "//electron/build/config:generate_mas_config" ] configs += [ "//electron/build/config:mas_build" ]
sources = filenames.lib_sources sources = filenames.lib_sources
if (is_win) { if (is_win) {
@@ -670,8 +652,6 @@ source_set("electron_lib") {
sources += [ sources += [
"shell/browser/certificate_manager_model.cc", "shell/browser/certificate_manager_model.cc",
"shell/browser/certificate_manager_model.h", "shell/browser/certificate_manager_model.h",
"shell/browser/linux/x11_util.cc",
"shell/browser/linux/x11_util.h",
"shell/browser/ui/gtk_util.cc", "shell/browser/ui/gtk_util.cc",
"shell/browser/ui/gtk_util.h", "shell/browser/ui/gtk_util.h",
] ]
@@ -693,11 +673,22 @@ source_set("electron_lib") {
} }
if (enable_plugins) { if (enable_plugins) {
deps += [ "chromium_src:plugins" ]
sources += [ sources += [
"shell/browser/electron_plugin_info_host_impl.cc",
"shell/browser/electron_plugin_info_host_impl.h",
"shell/common/plugin_info.cc", "shell/common/plugin_info.cc",
"shell/common/plugin_info.h", "shell/common/plugin_info.h",
"shell/renderer/electron_renderer_pepper_host_factory.cc",
"shell/renderer/electron_renderer_pepper_host_factory.h",
"shell/renderer/pepper_helper.cc",
"shell/renderer/pepper_helper.h",
]
}
if (enable_ppapi) {
deps += [
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/shared_impl",
] ]
} }
@@ -755,7 +746,6 @@ source_set("electron_lib") {
"//components/pdf/common:util", "//components/pdf/common:util",
"//components/pdf/renderer", "//components/pdf/renderer",
"//pdf", "//pdf",
"//pdf:content_restriction",
] ]
sources += [ sources += [
"shell/browser/electron_pdf_document_helper_client.cc", "shell/browser/electron_pdf_document_helper_client.cc",
@@ -822,7 +812,7 @@ if (is_mac) {
group("electron_framework_libraries") { group("electron_framework_libraries") {
} }
} }
if (use_egl) {
# Add the ANGLE .dylibs in the Libraries directory of the Framework. # Add the ANGLE .dylibs in the Libraries directory of the Framework.
bundle_data("electron_angle_binaries") { bundle_data("electron_angle_binaries") {
sources = [ sources = [
@@ -842,14 +832,18 @@ if (is_mac) {
outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ] public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
} }
}
group("electron_angle_library") { group("electron_angle_library") {
if (use_egl) {
deps = [ ":electron_angle_binaries" ] deps = [ ":electron_angle_binaries" ]
} }
}
group("electron_swiftshader_library") { group("electron_swiftshader_library") {
if (use_egl) {
deps = [ ":electron_swiftshader_binaries" ] deps = [ ":electron_swiftshader_binaries" ]
} }
}
bundle_data("electron_crashpad_helper") { bundle_data("electron_crashpad_helper") {
sources = [ "$root_out_dir/chrome_crashpad_handler" ] sources = [ "$root_out_dir/chrome_crashpad_handler" ]
@@ -885,7 +879,6 @@ if (is_mac) {
":electron_framework_resources", ":electron_framework_resources",
":electron_swiftshader_library", ":electron_swiftshader_library",
":electron_xibs", ":electron_xibs",
"//third_party/electron_node:libnode",
] ]
if (!is_mas_build) { if (!is_mas_build) {
deps += [ ":electron_crashpad_helper" ] deps += [ ":electron_crashpad_helper" ]
@@ -929,18 +922,17 @@ if (is_mac) {
assert(defined(invoker.helper_name_suffix)) assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix output_name = electron_helper_name + invoker.helper_name_suffix
deps = [ deps = [ ":electron_framework+link" ]
":electron_framework+link",
"//electron/build/config:generate_mas_config",
]
if (!is_mas_build) { if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ] deps += [ "//sandbox/mac:seatbelt" ]
} }
defines = [ "HELPER_EXECUTABLE" ] defines = [ "HELPER_EXECUTABLE" ]
configs += [ "//electron/build/config:mas_build" ]
sources = [ sources = [
"shell/app/electron_main_mac.cc", "shell/app/electron_main_mac.cc",
"shell/app/uv_stdio_fix.cc", "shell/app/uv_stdio_fix.cc",
"shell/app/uv_stdio_fix.h", "shell/app/uv_stdio_fix.h",
"shell/common/electron_constants.cc",
] ]
include_dirs = [ "." ] include_dirs = [ "." ]
info_plist = "shell/renderer/resources/mac/Info.plist" info_plist = "shell/renderer/resources/mac/Info.plist"
@@ -1091,7 +1083,6 @@ if (is_mac) {
":electron_app_plist", ":electron_app_plist",
":electron_app_resources", ":electron_app_resources",
":electron_fuses", ":electron_fuses",
"//electron/build/config:generate_mas_config",
"//electron/buildflags", "//electron/buildflags",
] ]
if (is_mas_build) { if (is_mas_build) {
@@ -1106,6 +1097,7 @@ if (is_mac) {
"-rpath", "-rpath",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
] ]
configs += [ "//electron/build/config:mas_build" ]
} }
if (enable_dsyms) { if (enable_dsyms) {
@@ -1209,7 +1201,6 @@ if (is_mac) {
"//components/crash/core/app", "//components/crash/core/app",
"//content:sandbox_helper_win", "//content:sandbox_helper_win",
"//electron/buildflags", "//electron/buildflags",
"//third_party/electron_node:libnode",
"//ui/strings", "//ui/strings",
] ]
@@ -1248,7 +1239,7 @@ if (is_mac) {
"//components/crash/core/app:run_as_crashpad_handler", "//components/crash/core/app:run_as_crashpad_handler",
] ]
ldflags = [ "/DELAYLOAD:ffmpeg.dll" ] ldflags = []
libs = [ libs = [
"comctl32.lib", "comctl32.lib",
@@ -1521,8 +1512,21 @@ group("electron") {
##### node_headers ##### node_headers
node_dir = "../third_party/electron_node" node_dir = "../third_party/electron_node"
node_files = read_file("$node_dir/filenames.json", "json")
node_headers_dir = "$root_gen_dir/node_headers" node_headers_dir = "$root_gen_dir/node_headers"
header_group_index = 0
header_groups = []
foreach(header_group, node_files.headers) {
copy("node_headers_${header_group_index}") {
sources = rebase_path(header_group.files, ".", node_dir)
outputs =
[ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
}
header_groups += [ ":node_headers_${header_group_index}" ]
header_group_index += 1
}
copy("zlib_headers") { copy("zlib_headers") {
sources = [ sources = [
"$node_dir/deps/zlib/zconf.h", "$node_dir/deps/zlib/zconf.h",
@@ -1543,19 +1547,13 @@ copy("node_gypi_headers") {
action("node_version_header") { action("node_version_header") {
inputs = [ "$node_dir/src/node_version.h" ] inputs = [ "$node_dir/src/node_version.h" ]
outputs = [ "$node_headers_dir/include/node/node_version.h" ] outputs = [ "$node_headers_dir/include/node/node_version.h" ]
script = "script/node/generate_node_version_header.py" script = "script/generate_node_version_header.py"
args = rebase_path(inputs) + rebase_path(outputs) args = rebase_path(inputs) + rebase_path(outputs)
if (node_module_version != "") { if (node_module_version != "") {
args += [ "$node_module_version" ] args += [ "$node_module_version" ]
} }
} }
action("generate_node_headers") {
deps = [ ":generate_config_gypi" ]
script = "script/node/generate_node_headers.py"
outputs = [ "$root_gen_dir/node_headers.json" ]
}
action("tar_node_headers") { action("tar_node_headers") {
deps = [ ":copy_node_headers" ] deps = [ ":copy_node_headers" ]
outputs = [ "$root_gen_dir/node_headers.tar.gz" ] outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
@@ -1567,8 +1565,7 @@ action("tar_node_headers") {
} }
group("copy_node_headers") { group("copy_node_headers") {
public_deps = [ public_deps = header_groups + [
":generate_node_headers",
":node_gypi_headers", ":node_gypi_headers",
":node_version_header", ":node_version_header",
":zlib_headers", ":zlib_headers",

View File

@@ -12,7 +12,7 @@ propose changes to this document in a pull request.
## [Issues](https://electronjs.org/docs/development/issues) ## [Issues](https://electronjs.org/docs/development/issues)
Issues are created [here](https://github.com/electron/electron/issues/new/choose). Issues are created [here](https://github.com/electron/electron/issues/new).
* [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues) * [How to Contribute in Issues](https://electronjs.org/docs/development/issues#how-to-contribute-in-issues)
* [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help) * [Asking for General Help](https://electronjs.org/docs/development/issues#asking-for-general-help)
@@ -71,4 +71,4 @@ See [Coding Style](https://electronjs.org/docs/development/coding-style) for inf
## Further Reading ## Further Reading
For more in-depth guides on developing Electron, see For more in-depth guides on developing Electron, see
[/docs/development](/docs/development/README.md). [/docs/development](/docs/development/README.md)

10
DEPS
View File

@@ -2,9 +2,9 @@ gclient_gn_args_from = 'src'
vars = { vars = {
'chromium_version': 'chromium_version':
'138.0.7178.0', '127.0.6521.0',
'node_version': 'node_version':
'v22.15.1', 'v20.14.0',
'nan_version': 'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213', 'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version': 'squirrel.mac_version':
@@ -62,6 +62,10 @@ vars = {
'checkout_nacl': 'checkout_nacl':
False, False,
'checkout_libaom':
True,
'checkout_oculus_sdk':
False,
'checkout_openxr': 'checkout_openxr':
False, False,
'build_with_chromium': 'build_with_chromium':
@@ -70,6 +74,8 @@ vars = {
False, False,
'checkout_android_native_support': 'checkout_android_native_support':
False, False,
'checkout_google_benchmark':
False,
'checkout_clang_tidy': 'checkout_clang_tidy':
True, True,
} }

View File

@@ -1,6 +1,7 @@
[![Electron Logo](https://electronjs.org/images/electron-logo.svg)](https://electronjs.org) [![Electron Logo](https://electronjs.org/images/electron-logo.svg)](https://electronjs.org)
[![GitHub Actions Build Status](https://github.com/electron/electron/actions/workflows/build.yml/badge.svg)](https://github.com/electron/electron/actions/workflows/build.yml) [![CircleCI Build Status](https://circleci.com/gh/electron/electron/tree/main.svg?style=shield)](https://circleci.com/gh/electron/electron/tree/main)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4lggi9dpjc1qob7k/branch/main?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/main)
[![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.gg/electronjs) [![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.gg/electronjs)
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪. :memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
@@ -37,7 +38,7 @@ For more installation options and troubleshooting tips, see
Each Electron release provides binaries for macOS, Windows, and Linux. Each Electron release provides binaries for macOS, Windows, and Linux.
* macOS (Big Sur and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS. * macOS (Catalina and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
* Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). * Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice).
* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on: * Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
* Ubuntu 18.04 and newer * Ubuntu 18.04 and newer

107
appveyor-bake.yml Normal file
View File

@@ -0,0 +1,107 @@
# The config is used to bake appveyor images, not for running CI jobs.
# The config expects the following environment variables to be set:
# - "APPVEYOR_BAKE_IMAGE" e.g. 'electron-99.0.4767.0'. Name of the image to be baked.
# Typically named after the Chromium version on which the image is built.
# This can be set dynamically in the prepare-appveyor script.
version: 1.0.{build}
build_cloud: electronhq-16-core
image: base-bake-image
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
PYTHONIOENCODING: UTF-8
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - appveyor version
# - ps: $ErrorActionPreference = 'Stop'
# - ps: 'Write-Host "OS Build: $((Get-CimInstance Win32_OperatingSystem).BuildNumber)"'
# clone_folder: '%USERPROFILE%\image-bake-scripts'
# clone_script:
# - ps: Invoke-WebRequest "https://github.com/appveyor/build-images/archive/1f90d94e74c8243c909a09b994e527584dfcb838.zip" -OutFile "$env:temp\scripts.zip"
# - ps: Expand-Archive -Path "$env:temp\scripts.zip" -DestinationPath "$env:temp\scripts" -Force
# - ps: Copy-Item -Path "$env:temp\scripts\build-images-1f90d94e74c8243c909a09b994e527584dfcb838\scripts\Windows\*" -Destination $env:APPVEYOR_BUILD_FOLDER -Recurse
build_script:
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# - ps: .\init_server.ps1
# - ps: .\extend_system_volume.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - appveyor version
# - ps: .\install_path_utils.ps1
# - ps: .\install_powershell_core.ps1
# - ps: .\install_powershell_get.ps1
# - ps: .\install_7zip.ps1
# - ps: .\install_chocolatey.ps1
# - ps: .\install_webpi.ps1
# - ps: .\install_nuget.ps1
# - ps: .\install_pstools.ps1
# - ps: .\install_git.ps1
# - ps: .\install_git_lfs.ps1
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# END LINES FOR COMPLETELY NEW IMAGE
- git config --global core.longpaths true
- ps: >-
if (-not (Test-Path -Path C:\projects\src)) {
New-Item -Path C:\projects\src -ItemType Directory
}
- cd C:\projects\
- git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/electron/electron.git C:\projects\src\electron
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- update_depot_tools.bat
# Uncomment the following line if windows deps change
# - src\electron\script\setup-win-for-dev.bat
- >-
gclient config
--name "src\electron"
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: Copy-Item -path .\.depshash -destination ..\.depshash
- ps: cd ..\..
- gclient sync --with_branch_heads --with_tags --nohooks
- ps: regsvr32 /s "C:\Program Files\Microsoft Visual Studio\2022\Community\DIA SDK\bin\amd64\msdia140.dll"
- ps: set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
# The following lines are needed when baking from a completely new image (eg MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest via image: base-windows-server2019)
# # Restart VM
# - ps: Start-Sleep -s 5; Restart-Computer
# - ps: Start-Sleep -s 5
# - cd %USERPROFILE%\image-bake-scripts
# - appveyor version
# - ps: .\optimize_dotnet_runtime.ps1
# - ps: .\disable_windows_background_services.ps1
# - ps: .\enforce_windows_firewall.ps1
# - ps: .\cleanup_windows.ps1
# END LINES FOR COMPLETELY NEW IMAGE
on_image_bake:
- ps: >-
echo "Baking image: $env:APPVEYOR_BAKE_IMAGE at dir $PWD"
- ps: Remove-Item -Recurse -Force C:\projects\depot_tools
- ps: Remove-Item -Recurse -Force C:\projects\src\electron
# Uncomment these lines and set APPVEYOR_RDP_PASSWORD in project settings to enable RDP after bake is done
# # on_finish:
# - ps: >-
# $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

320
appveyor-woa.yml Normal file
View File

@@ -0,0 +1,320 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-127.0.6521.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build Arm on X64 Windows
- job_name: Test On Windows On Arm Hardware
job_depends_on: Build Arm on X64 Windows
APPVEYOR_BUILD_WORKER_IMAGE: base-woa
APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build Arm on X64 Windows
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- 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
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- 7z a nan.zip third_party\nan
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} elseif (
$artifact_name -eq 'nan.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test On Windows On Arm Hardware
environment:
IGNORE_YARN_INSTALL_ERROR: 1
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build Arm on X64 Windows") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
# 7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
- ps: 7z x -y -osrc nan.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- set npm_config_nodedir=%cd%\out\Default\gen\node_headers
- set npm_config_arch=arm64
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

313
appveyor.yml Normal file
View File

@@ -0,0 +1,313 @@
# NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor-woa.yml
# IF APPLICABLE!!!!
#
#
# The config expects the following environment variables to be set:
# - "GN_CONFIG" Build type. One of {'testing', 'release'}.
# - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
# e.g. 'target_cpu="x86"' to build for a 32bit platform.
# https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
# Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
# if you pass a custom value for 'target_cpu'.
# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
# - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
# - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
# Is used in some publishing scripts, but does NOT affect the Electron binary.
# Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
# - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
# Otherwise the release will be uploaded to the GitHub Releases.
# (The value is only checked if "ELECTRON_RELEASE" is defined.)
#
# The publishing scripts expect access tokens to be defined as env vars,
# but those are not covered here.
#
# AppVeyor docs on variables:
# https://www.appveyor.com/docs/environment-variables/
# https://www.appveyor.com/docs/build-configuration/#secure-variables
# https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
version: 1.0.{build}
build_cloud: electronhq-16-core
image: e-127.0.6521.0
environment:
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
ELECTRON_ALSO_LOG_TO_STDERR: 1
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
DEPOT_TOOLS_WIN_TOOLCHAIN: 1
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
GYP_MSVS_HASH_7393122652: 3ba76c5c20
PYTHONIOENCODING: UTF-8
matrix:
- job_name: Build
- job_name: Test
job_depends_on: Build
clone_script:
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
clone_folder: C:\projects\src\electron
skip_branch_with_pr: true
# the first failed job cancels other jobs and fails entire build
matrix:
fast_finish: true
for:
- matrix:
only:
- job_name: Build
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc-only change"
$env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- ps: Write-Host "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- ps: >-
if (Test-Path -Path "$pwd\depot_tools") {
Remove-Item -Recurse -Force $pwd\depot_tools
}
- ps: >-
if (Test-Path -Path "$pwd\build-tools") {
Remove-Item -Recurse -Force $pwd\build-tools
}
- git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
- ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
- depot_tools\bootstrap\win_tools.bat
- ps: $env:PATH="$pwd\depot_tools;$env:PATH"
- ps: >-
if (Test-Path -Path "$pwd\src\electron") {
Remove-Item -Recurse -Force $pwd\src\electron
}
- git clone https://github.com/electron/build-tools.git
- cd build-tools
- npx yarn --ignore-engines
- mkdir third_party
- ps: >-
node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
- ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
- ps: >-
& $env:RECLIENT_HELPER login
- ps: >-
$env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
- ps: >-
$env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
- ps: >-
$env:RBE_experimental_credentials_helper_args = "print"
- cd ..\..
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: >-
if ($env:GN_CONFIG -ne 'release') {
$env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
}
- gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
# Patches are applied in the image bake. Check depshash to see if patches have changed.
- ps: $env:RUN_GCLIENT_SYNC="false"
- ps: $depshash_baked = Get-Content .\src\.depshash -Raw
- ps: cd src\electron
- ps: node script\generate-deps-hash.js
- ps: $depshash = Get-Content .\.depshash -Raw
- ps: cd ..\..
- ps: >-
if ($depshash_baked -ne $depshash) {
$env:RUN_GCLIENT_SYNC="true"
}
- if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
- cd src
- ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
- set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
- gn check out/Default //electron:electron_lib
- gn check out/Default //electron:electron_app
- gn check out/Default //electron/shell/common/api:mojo
- if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
- if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
- 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
- autoninja -C out/Default electron:electron_dist_zip
- gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
# Remove unused args from mksnapshot_args
- ps: >-
Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') -And -not $_.Contains('The gn arg use_goma=true') } | Set-Content out/Default/mksnapshot_args
- autoninja -C out/Default electron:electron_mksnapshot_zip
- cd out\Default
- 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
- cd ..\..
- autoninja -C out/Default electron:hunspell_dictionaries_zip
- autoninja -C out/Default electron:electron_chromedriver_zip
- autoninja -C out/Default electron:node_headers
- ps: >-
Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
- python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
- 7z a node_headers.zip out\Default\gen\node_headers
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
autoninja -C out/Default electron:electron_symbols
}
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python3 electron\script\zip-symbols.py
appveyor-retry appveyor PushArtifact out/Default/symbols.zip
} else {
# It's useful to have pdb files when debugging testing builds that are
# built on CI.
7z a pdb.zip out\Default\*.pdb
}
- ps: |
$manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
if ($LASTEXITCODE -ne 0) {
throw "Zip contains files not listed in the manifest $manifest_file"
}
- ps: |
cd C:\projects\src
$missing_artifacts = $false
if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
} else {
$artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
foreach($artifact_name in $artifacts_to_validate) {
if ($artifact_name -eq 'ffmpeg.zip') {
$artifact_file = "out\ffmpeg\ffmpeg.zip"
} elseif (
$artifact_name -eq 'node_headers.zip') {
$artifact_file = $artifact_name
} else {
$artifact_file = "out\Default\$artifact_name"
}
if (-not(Test-Path $artifact_file)) {
Write-warning "$artifact_name is missing and cannot be added to artifacts"
$missing_artifacts = $true
}
}
}
if ($missing_artifacts) {
throw "Build failed due to missing artifacts"
}
deploy_script:
- cd electron
- ps: >-
if (Test-Path Env:\ELECTRON_RELEASE) {
if (Test-Path Env:\UPLOAD_TO_STORAGE) {
Write-Output "Uploading Electron release distribution to azure"
& python3 script\release\uploaders\upload.py --verbose --upload_to_storage
} else {
Write-Output "Uploading Electron release distribution to github releases"
& python3 script\release\uploaders\upload.py --verbose
}
}
on_finish:
# Uncomment this lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- cd C:\projects\src
- if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
- if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
- if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
- if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
- if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
- if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
- if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
- if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
- ps: >-
if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
appveyor-retry appveyor PushArtifact pdb.zip
}
- matrix:
only:
- job_name: Test
init:
- ps: |
if ($env:RUN_TESTS -ne 'true') {
Write-warning "Skipping tests for $env:APPVEYOR_PROJECT_NAME"; Exit-AppveyorBuild
}
build_script:
- ps: |
node script/yarn.js install --frozen-lockfile
node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
if ($LASTEXITCODE -eq 0) {
Write-warning "Skipping build for doc only change"
Exit-AppveyorBuild
} else {
$global:LASTEXITCODE = 0
}
- cd ..
- mkdir out\Default
- cd ..
- ps: |
# Download build artifacts
$apiUrl = 'https://ci.appveyor.com/api'
$build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
$artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
foreach ($job in $build_info.build.jobs) {
if ($job.name -eq "Build") {
$jobId = $job.jobId
foreach($artifact_name in $artifacts_to_download) {
if ($artifact_name -eq 'electron.lib') {
$outfile = "src\out\Default\$artifact_name"
} else {
$outfile = $artifact_name
}
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
}
# Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
# Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
# 7z x -y -osrc pdb.zip
}
}
- ps: |
$out_default_zips = @('dist.zip','chromedriver.zip','mksnapshot.zip')
foreach($zip_name in $out_default_zips) {
7z x -y -osrc\out\Default $zip_name
}
- ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
- ps: 7z x -y -osrc node_headers.zip
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: |
cd src
New-Item .\out\Default\gen\node_headers\Release -Type directory
Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
- cd electron
# Explicitly set npm_config_arch because the .env doesn't persist
- ps: >-
if ($env:TARGET_ARCH -eq 'ia32') {
$env:npm_config_arch = "ia32"
}
- echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
- cd ..
- echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
- echo "About to verify mksnapshot"
- echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
- echo "Done verifying mksnapshot"
- echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd%
- echo "Done verifying chromedriver"
on_finish:
# Uncomment these lines to enable RDP
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )

View File

@@ -2,7 +2,7 @@ is_electron_build = true
root_extra_deps = [ "//electron" ] root_extra_deps = [ "//electron" ]
# Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json # Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
node_module_version = 136 node_module_version = 128
v8_promise_internal_field_count = 1 v8_promise_internal_field_count = 1
v8_embedder_string = "-electron.0" v8_embedder_string = "-electron.0"
@@ -14,8 +14,8 @@ v8_enable_snapshot_native_code_counters = false
v8_enable_javascript_promise_hooks = true v8_enable_javascript_promise_hooks = true
enable_cdm_host_verification = false enable_cdm_host_verification = false
ffmpeg_branding = "Chrome"
proprietary_codecs = true proprietary_codecs = true
ffmpeg_branding = "Chrome"
enable_printing = true enable_printing = true
@@ -48,8 +48,7 @@ enable_cet_shadow_stack = false
is_cfi = false is_cfi = false
# TODO: fix this once sysroots have been updated. # TODO: fix this once sysroots have been updated.
use_qt5 = false use_qt = false
use_qt6 = false
# Disables the builtins PGO for V8 # Disables the builtins PGO for V8
v8_builtins_profiling_log_file = "" v8_builtins_profiling_log_file = ""
@@ -66,10 +65,11 @@ v8_enable_private_mapping_fork_optimization = true
# Expose public V8 symbols for native modules. # Expose public V8 symbols for native modules.
v8_expose_public_symbols = true v8_expose_public_symbols = true
# Disables unsafe-buffers-usage plugin due to incompatibilities with our reclient implementation
# Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5426599
# Ref: https://github.com/electron/electron/commit/8e20f16ea35eeaeb149ae63bad3703d782665f6a
clang_unsafe_buffers_paths = ""
# Disable snapshotting a page when printing for its content to be analyzed for # Disable snapshotting a page when printing for its content to be analyzed for
# sensitive content by enterprise users. # sensitive content by enterprise users.
enterprise_cloud_content_analysis = false enterprise_cloud_content_analysis = false
# TODO: remove dependency on legacy ipc
# https://issues.chromium.org/issues/40943039
content_enable_legacy_ipc = true

View File

@@ -1,7 +1,7 @@
import("//electron/build/args/all.gn") import("all.gn")
is_component_build = false is_component_build = false
is_component_ffmpeg = true is_component_ffmpeg = true
is_official_build = true is_official_build = true
proprietary_codecs = false
ffmpeg_branding = "Chromium" ffmpeg_branding = "Chromium"
enable_dsyms = false enable_dsyms = false
proprietary_codecs = false

View File

@@ -1,7 +1,14 @@
import("//electron/build/args/all.gn") import("all.gn")
is_component_build = false is_component_build = false
is_official_build = true is_official_build = true
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs
# By default, Electron builds ffmpeg with proprietary codecs enabled. In order # By default, Electron builds ffmpeg with proprietary codecs enabled. In order
# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or # to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
# who have an LGPL requirement to ship ffmpeg as a dynamically linked library, # who have an LGPL requirement to ship ffmpeg as a dynamically linked library,

View File

@@ -1,7 +1,14 @@
import("//electron/build/args/all.gn") import("all.gn")
is_debug = false is_debug = false
is_component_build = false is_component_build = false
is_component_ffmpeg = true is_component_ffmpeg = true
is_official_build = false is_official_build = false
dcheck_always_on = true dcheck_always_on = true
symbol_level = 1 symbol_level = 1
# This may be guarded behind is_chrome_branded alongside
# proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
# explicitly override here to build OpenH264 encoder/FFmpeg decoder.
# The initialization of the decoder depends on whether ffmpeg has
# been built with H.264 support.
rtc_use_h264 = proprietary_codecs

View File

@@ -1,11 +1,8 @@
action("generate_mas_config") { # For MAS build, we force defining "MAS_BUILD".
outputs = [ "$target_gen_dir/../../mas.h" ] config("mas_build") {
script = "../../script/generate-mas-config.py"
if (is_mas_build) { if (is_mas_build) {
args = [ "true" ] defines = [ "IS_MAS_BUILD()=1" ]
} else { } else {
args = [ "false" ] defines = [ "IS_MAS_BUILD()=0" ]
} }
args += rebase_path(outputs)
} }

View File

@@ -24,8 +24,11 @@ template("extract_symbols") {
assert(defined(invoker.binary), "Need binary to dump") assert(defined(invoker.binary), "Need binary to dump")
assert(defined(invoker.symbol_dir), "Need directory for symbol output") assert(defined(invoker.symbol_dir), "Need directory for symbol output")
dump_syms_label = if (host_os == "win" && target_cpu == "x86") {
"//third_party/breakpad:dump_syms($host_system_allocator_toolchain)" dump_syms_label = "//third_party/breakpad:dump_syms(//build/toolchain/win:win_clang_x64)"
} else {
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
}
dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") + dump_syms_binary = get_label_info(dump_syms_label, "root_out_dir") +
"/dump_syms$_host_executable_suffix" "/dump_syms$_host_executable_suffix"

View File

@@ -36,6 +36,7 @@ TEMPLATE_CC = """
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/string_util.h"
#include <string> #include <string>
#endif #endif

View File

@@ -2,7 +2,7 @@ import os
import re import re
import sys import sys
DEFINE_EXTRACT_REGEX = re.compile(r'^ *# *define (\w*)', re.MULTILINE) DEFINE_EXTRACT_REGEX = re.compile('^ *# *define (\w*)', re.MULTILINE)
def main(out_dir, headers): def main(out_dir, headers):
defines = [] defines = []

View File

@@ -45,7 +45,7 @@ def windows_profile():
win_sdk_dir = SetEnvironmentAndGetSDKDir() win_sdk_dir = SetEnvironmentAndGetSDKDir()
path = NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']) path = NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH'])
# since current windows executable are symbols path dependent, # since current windows executable are symbols path dependant,
# profile the current directory too # profile the current directory too
return { return {
'pwd': os.getcwd(), 'pwd': os.getcwd(),

View File

@@ -29,7 +29,7 @@ template("compile_ib_files") {
_output_extension = invoker.output_extension _output_extension = invoker.output_extension
script = "//build/config/apple/compile_ib_files.py" script = "//build/config/ios/compile_ib_files.py"
sources = invoker.sources sources = invoker.sources
outputs = [ outputs = [
"$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension", "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",

View File

@@ -1,9 +1,8 @@
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');
const WrapperPlugin = require('wrapper-webpack-plugin');
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const WrapperPlugin = require('wrapper-webpack-plugin');
const electronRoot = path.resolve(__dirname, '../..'); const electronRoot = path.resolve(__dirname, '../..');

View File

@@ -1,6 +0,0 @@
module.exports = require('./webpack.config.base')({
target: 'preload_realm',
alwaysHasNode: false,
wrapInitWithProfilingTimeout: true,
wrapInitWithTryCatch: true
});

View File

@@ -59,7 +59,7 @@ def skip_path(dep, dist_zip, target_cpu):
and dep == "snapshot_blob.bin" and dep == "snapshot_blob.bin"
) )
) )
if should_skip and os.environ.get('ELECTRON_DEBUG_ZIP_SKIP') == '1': if should_skip:
print("Skipping {}".format(dep)) print("Skipping {}".format(dep))
return should_skip return should_skip

View File

@@ -6,6 +6,7 @@ import("//build/config/ozone.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//components/spellcheck/spellcheck_build_features.gni") import("//components/spellcheck/spellcheck_build_features.gni")
import("//electron/buildflags/buildflags.gni") import("//electron/buildflags/buildflags.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni")
import("//third_party/widevine/cdm/widevine.gni") import("//third_party/widevine/cdm/widevine.gni")
@@ -13,8 +14,6 @@ import("//third_party/widevine/cdm/widevine.gni")
static_library("chrome") { static_library("chrome") {
visibility = [ "//electron:electron_lib" ] visibility = [ "//electron:electron_lib" ]
sources = [ sources = [
"//ash/style/rounded_rect_cutout_path_builder.cc",
"//ash/style/rounded_rect_cutout_path_builder.h",
"//chrome/browser/app_mode/app_mode_utils.cc", "//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h", "//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_features.cc", "//chrome/browser/browser_features.cc",
@@ -30,18 +29,16 @@ static_library("chrome") {
"//chrome/browser/devtools/devtools_file_system_indexer.cc", "//chrome/browser/devtools/devtools_file_system_indexer.cc",
"//chrome/browser/devtools/devtools_file_system_indexer.h", "//chrome/browser/devtools/devtools_file_system_indexer.h",
"//chrome/browser/devtools/devtools_settings.h", "//chrome/browser/devtools/devtools_settings.h",
"//chrome/browser/devtools/features.cc",
"//chrome/browser/devtools/features.h",
"//chrome/browser/devtools/visual_logging.cc", "//chrome/browser/devtools/visual_logging.cc",
"//chrome/browser/devtools/visual_logging.h", "//chrome/browser/devtools/visual_logging.h",
"//chrome/browser/extensions/global_shortcut_listener.cc",
"//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/file_system_access/file_system_access_features.cc", "//chrome/browser/file_system_access/file_system_access_features.cc",
"//chrome/browser/file_system_access/file_system_access_features.h", "//chrome/browser/file_system_access/file_system_access_features.h",
"//chrome/browser/icon_loader.cc", "//chrome/browser/icon_loader.cc",
"//chrome/browser/icon_loader.h", "//chrome/browser/icon_loader.h",
"//chrome/browser/icon_manager.cc", "//chrome/browser/icon_manager.cc",
"//chrome/browser/icon_manager.h", "//chrome/browser/icon_manager.h",
"//chrome/browser/media/webrtc/delegated_source_list_capturer.cc",
"//chrome/browser/media/webrtc/delegated_source_list_capturer.h",
"//chrome/browser/media/webrtc/desktop_capturer_wrapper.cc", "//chrome/browser/media/webrtc/desktop_capturer_wrapper.cc",
"//chrome/browser/media/webrtc/desktop_capturer_wrapper.h", "//chrome/browser/media/webrtc/desktop_capturer_wrapper.h",
"//chrome/browser/media/webrtc/desktop_media_list.cc", "//chrome/browser/media/webrtc/desktop_media_list.cc",
@@ -68,8 +65,6 @@ static_library("chrome") {
"//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h", "//chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker_observer.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc", "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h", "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.cc",
"//chrome/browser/picture_in_picture/picture_in_picture_window_manager_uma_helper.h",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc", "//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.cc",
"//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h", "//chrome/browser/picture_in_picture/scoped_picture_in_picture_occlusion_observation.h",
"//chrome/browser/platform_util.cc", "//chrome/browser/platform_util.cc",
@@ -85,8 +80,6 @@ static_library("chrome") {
"//chrome/browser/process_singleton.h", "//chrome/browser/process_singleton.h",
"//chrome/browser/process_singleton_internal.cc", "//chrome/browser/process_singleton_internal.cc",
"//chrome/browser/process_singleton_internal.h", "//chrome/browser/process_singleton_internal.h",
"//chrome/browser/serial/serial_blocklist.cc",
"//chrome/browser/serial/serial_blocklist.h",
"//chrome/browser/themes/browser_theme_pack.cc", "//chrome/browser/themes/browser_theme_pack.cc",
"//chrome/browser/themes/browser_theme_pack.h", "//chrome/browser/themes/browser_theme_pack.h",
"//chrome/browser/themes/custom_theme_supplier.cc", "//chrome/browser/themes/custom_theme_supplier.cc",
@@ -115,19 +108,14 @@ static_library("chrome") {
"//chrome/browser/ui/frame/window_frame_util.h", "//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/ui_features.cc", "//chrome/browser/ui/ui_features.cc",
"//chrome/browser/ui/ui_features.h", "//chrome/browser/ui/ui_features.h",
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc", "//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.h", "//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
"//chrome/browser/ui/views/overlay/back_to_tab_button.cc",
"//chrome/browser/ui/views/overlay/back_to_tab_button.h",
"//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc", "//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.cc", "//chrome/browser/ui/views/overlay/close_image_button.cc",
"//chrome/browser/ui/views/overlay/close_image_button.h", "//chrome/browser/ui/views/overlay/close_image_button.h",
"//chrome/browser/ui/views/overlay/constants.h", "//chrome/browser/ui/views/overlay/constants.h",
"//chrome/browser/ui/views/overlay/hang_up_button.cc", "//chrome/browser/ui/views/overlay/hang_up_button.cc",
"//chrome/browser/ui/views/overlay/hang_up_button.h", "//chrome/browser/ui/views/overlay/hang_up_button.h",
"//chrome/browser/ui/views/overlay/minimize_button.cc",
"//chrome/browser/ui/views/overlay/minimize_button.h",
"//chrome/browser/ui/views/overlay/overlay_window_image_button.cc", "//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
"//chrome/browser/ui/views/overlay/overlay_window_image_button.h", "//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
"//chrome/browser/ui/views/overlay/playback_image_button.cc", "//chrome/browser/ui/views/overlay/playback_image_button.cc",
@@ -146,12 +134,8 @@ static_library("chrome") {
"//chrome/browser/ui/views/overlay/video_overlay_window_views.h", "//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
"//chrome/browser/ui/webui/accessibility/accessibility_ui.cc", "//chrome/browser/ui/webui/accessibility/accessibility_ui.cc",
"//chrome/browser/ui/webui/accessibility/accessibility_ui.h", "//chrome/browser/ui/webui/accessibility/accessibility_ui.h",
"//chrome/browser/usb/usb_blocklist.cc",
"//chrome/browser/usb/usb_blocklist.h",
"//extensions/browser/app_window/size_constraints.cc", "//extensions/browser/app_window/size_constraints.cc",
"//extensions/browser/app_window/size_constraints.h", "//extensions/browser/app_window/size_constraints.h",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h",
"//ui/views/native_window_tracker.h", "//ui/views/native_window_tracker.h",
] ]
@@ -161,17 +145,18 @@ static_library("chrome") {
if (is_win) { if (is_win) {
sources += [ sources += [
"//chrome/browser/extensions/global_shortcut_listener_win.cc",
"//chrome/browser/extensions/global_shortcut_listener_win.h",
"//chrome/browser/icon_loader_win.cc", "//chrome/browser/icon_loader_win.cc",
"//chrome/browser/media/webrtc/window_icon_util_win.cc", "//chrome/browser/media/webrtc/window_icon_util_win.cc",
"//chrome/browser/process_singleton_win.cc", "//chrome/browser/process_singleton_win.cc",
"//chrome/browser/ui/frame/window_frame_util.h",
"//chrome/browser/ui/view_ids.h",
"//chrome/browser/win/chrome_process_finder.cc", "//chrome/browser/win/chrome_process_finder.cc",
"//chrome/browser/win/chrome_process_finder.h", "//chrome/browser/win/chrome_process_finder.h",
"//chrome/browser/win/chrome_select_file_dialog_factory.cc",
"//chrome/browser/win/chrome_select_file_dialog_factory.h",
"//chrome/browser/win/titlebar_config.cc", "//chrome/browser/win/titlebar_config.cc",
"//chrome/browser/win/titlebar_config.h", "//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/util_win_service.cc", "//chrome/browser/win/titlebar_config.h",
"//chrome/browser/win/util_win_service.h",
"//chrome/child/v8_crashpad_support_win.cc", "//chrome/child/v8_crashpad_support_win.cc",
"//chrome/child/v8_crashpad_support_win.h", "//chrome/child/v8_crashpad_support_win.h",
] ]
@@ -182,15 +167,15 @@ static_library("chrome") {
} }
public_deps = [ public_deps = [
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser/resources/accessibility:resources", "//chrome/browser/resources/accessibility:resources",
"//chrome/browser/ui/color:color_headers",
"//chrome/browser/ui/color:mixers", "//chrome/browser/ui/color:mixers",
"//chrome/common", "//chrome/common",
"//chrome/common:version_header", "//chrome/common:version_header",
"//components/global_media_controls",
"//components/keyed_service/content", "//components/keyed_service/content",
"//components/paint_preview/buildflags", "//components/paint_preview/buildflags",
"//components/proxy_config", "//components/proxy_config",
"//components/services/language_detection/public/mojom",
"//content/public/browser", "//content/public/browser",
"//services/strings", "//services/strings",
] ]
@@ -199,16 +184,11 @@ static_library("chrome") {
"//chrome/app/vector_icons", "//chrome/app/vector_icons",
"//chrome/browser:resource_prefetch_predictor_proto", "//chrome/browser:resource_prefetch_predictor_proto",
"//chrome/browser/resource_coordinator:mojo_bindings", "//chrome/browser/resource_coordinator:mojo_bindings",
"//chrome/browser/task_manager/common:impl",
"//chrome/browser/ui/webui/tab_search:mojo_bindings",
"//chrome/browser/web_applications/mojom:mojom_web_apps_enum", "//chrome/browser/web_applications/mojom:mojom_web_apps_enum",
"//components/enterprise/buildflags", "//components/enterprise/buildflags",
"//components/enterprise/common/proto:browser_events_proto",
"//components/enterprise/common/proto:connectors_proto", "//components/enterprise/common/proto:connectors_proto",
"//components/enterprise/obfuscation/core:enterprise_obfuscation",
"//components/safe_browsing/core/browser/db:safebrowsing_proto", "//components/safe_browsing/core/browser/db:safebrowsing_proto",
"//components/vector_icons:vector_icons", "//components/vector_icons:vector_icons",
"//ui/base/accelerators/global_accelerator_listener",
"//ui/snapshot", "//ui/snapshot",
"//ui/views/controls/webview", "//ui/views/controls/webview",
] ]
@@ -224,11 +204,14 @@ static_library("chrome") {
} }
if (is_linux) { if (is_linux) {
sources += [ "//chrome/browser/icon_loader_auralinux.cc" ]
if (use_ozone) {
deps += [ "//ui/ozone" ]
sources += [ sources += [
"//chrome/browser/icon_loader_auralinux.cc", "//chrome/browser/extensions/global_shortcut_listener_ozone.cc",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.cc", "//chrome/browser/extensions/global_shortcut_listener_ozone.h",
"//ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_linux.h",
] ]
}
sources += [ sources += [
"//chrome/browser/ui/views/status_icons/concat_menu_model.cc", "//chrome/browser/ui/views/status_icons/concat_menu_model.cc",
"//chrome/browser/ui/views/status_icons/concat_menu_model.h", "//chrome/browser/ui/views/status_icons/concat_menu_model.h",
@@ -239,7 +222,10 @@ static_library("chrome") {
"//chrome/browser/ui/views/dark_mode_manager_linux.cc", "//chrome/browser/ui/views/dark_mode_manager_linux.cc",
"//chrome/browser/ui/views/dark_mode_manager_linux.h", "//chrome/browser/ui/views/dark_mode_manager_linux.h",
] ]
public_deps += [ "//components/dbus" ] public_deps += [
"//components/dbus/menu",
"//components/dbus/thread_linux",
]
} }
if (is_win) { if (is_win) {
@@ -252,15 +238,13 @@ static_library("chrome") {
"//chrome/services/util_win:lib", "//chrome/services/util_win:lib",
"//components/webapps/common:mojo_bindings", "//components/webapps/common:mojo_bindings",
] ]
deps += [ deps += [ "//components/segmentation_platform/public/proto" ]
"//chrome/services/util_win/public/mojom",
"//components/compose/core/browser:mojo_bindings",
"//components/segmentation_platform/public/proto",
]
} }
if (is_mac) { if (is_mac) {
sources += [ sources += [
"//chrome/browser/extensions/global_shortcut_listener_mac.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.mm",
"//chrome/browser/icon_loader_mac.mm", "//chrome/browser/icon_loader_mac.mm",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h", "//chrome/browser/media/webrtc/system_media_capture_permissions_mac.h",
"//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm", "//chrome/browser/media/webrtc/system_media_capture_permissions_mac.mm",
@@ -269,13 +253,11 @@ static_library("chrome") {
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.h", "//chrome/browser/media/webrtc/thumbnail_capturer_mac.h",
"//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm", "//chrome/browser/media/webrtc/thumbnail_capturer_mac.mm",
"//chrome/browser/media/webrtc/window_icon_util_mac.mm", "//chrome/browser/media/webrtc/window_icon_util_mac.mm",
"//chrome/browser/permissions/system/media_authorization_wrapper_mac.h",
"//chrome/browser/platform_util_mac.mm", "//chrome/browser/platform_util_mac.mm",
"//chrome/browser/process_singleton_mac.mm", "//chrome/browser/process_singleton_mac.mm",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h", "//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm", "//chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm",
] ]
deps += [ ":system_media_capture_permissions_mac_conflict" ]
} }
if (enable_widevine) { if (enable_widevine) {
@@ -427,6 +409,46 @@ static_library("chrome") {
} }
} }
source_set("plugins") {
sources = []
deps = []
frameworks = []
# browser side
sources += [
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc",
"//chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h",
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc",
"//chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h",
]
# renderer side
sources += [
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc",
"//chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
]
deps += [
"//components/strings",
"//media:media_buildflags",
"//services/device/public/mojom",
"//skia",
"//storage/browser",
]
if (enable_ppapi) {
deps += [
"//ppapi/buildflags",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",
"//ppapi/shared_impl",
]
}
}
# This source set is just so we don't have to depend on all of //chrome/browser # This source set is just so we don't have to depend on all of //chrome/browser
# You may have to add new files here during the upgrade if //chrome/browser/spellchecker # You may have to add new files here during the upgrade if //chrome/browser/spellchecker
# gets more files # gets more files
@@ -495,16 +517,3 @@ source_set("chrome_spellchecker") {
"//components/spellcheck/renderer", "//components/spellcheck/renderer",
] ]
} }
# These sources create an object file conflict with one in |:chrome|, so they
# must live in a separate target.
# Conflicting sources:
# //chrome/browser/media/webrtc/system_media_capture_permissions_stats_mac.mm
# //chrome/browser/permissions/system/system_media_capture_permissions_mac.mm
source_set("system_media_capture_permissions_mac_conflict") {
sources = [
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.h",
"//chrome/browser/permissions/system/system_media_capture_permissions_mac.mm",
]
deps = [ "//chrome/common" ]
}

View File

@@ -1,6 +1,5 @@
import { shell } from 'electron/common'; import { shell } from 'electron/common';
import { app, dialog, BrowserWindow, ipcMain } from 'electron/main'; import { app, dialog, BrowserWindow, ipcMain } from 'electron/main';
import * as path from 'node:path'; import * as path from 'node:path';
import * as url from 'node:url'; import * as url from 'node:url';

View File

@@ -4,7 +4,6 @@ import * as fs from 'node:fs';
import { Module } from 'node:module'; import { Module } from 'node:module';
import * as path from 'node:path'; import * as path from 'node:path';
import * as url from 'node:url'; import * as url from 'node:url';
const { app, dialog } = electron; const { app, dialog } = electron;
type DefaultAppOptions = { type DefaultAppOptions = {
@@ -93,7 +92,9 @@ async function loadApplicationPackage (packagePath: string) {
try { try {
process.emitWarning = () => {}; process.emitWarning = () => {};
packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), { packageJson = (await import(url.pathToFileURL(packageJsonPath).toString(), {
with: { type: 'json' } assert: {
type: 'json'
}
})).default; })).default;
} catch (e) { } catch (e) {
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`); showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${(e as Error).message}`);
@@ -254,7 +255,6 @@ async function startRepl () {
// start the default app. // start the default app.
if (option.file && !option.webdriver) { if (option.file && !option.webdriver) {
const file = option.file; const file = option.file;
// eslint-disable-next-line n/no-deprecated-api
const protocol = url.parse(file).protocol; const protocol = url.parse(file).protocol;
const extension = path.extname(file); const extension = path.extname(file);
if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') { if (protocol === 'http:' || protocol === 'https:' || protocol === 'file:' || protocol === 'chrome:') {

View File

@@ -34,25 +34,18 @@ async function loadSVG (element: HTMLSpanElement) {
async function initialize () { async function initialize () {
const electronPath = await ipcRenderer.invoke('bootstrap'); const electronPath = await ipcRenderer.invoke('bootstrap');
function replaceText (selector: string, text: string, link?: string) {
function replaceText (selector: string, text: string) {
const element = document.querySelector<HTMLElement>(selector); const element = document.querySelector<HTMLElement>(selector);
if (element) { if (element) {
if (link) {
const anchor = document.createElement('a');
anchor.textContent = text;
anchor.href = link;
anchor.target = '_blank';
element.appendChild(anchor);
} else {
element.innerText = text; element.innerText = text;
} }
} }
}
replaceText('.electron-version', `Electron v${process.versions.electron}`, 'https://electronjs.org/docs'); replaceText('.electron-version', `Electron v${process.versions.electron}`);
replaceText('.chrome-version', `Chromium v${process.versions.chrome}`, 'https://developer.chrome.com/docs/chromium'); replaceText('.chrome-version', `Chromium v${process.versions.chrome}`);
replaceText('.node-version', `Node v${process.versions.node}`, `https://nodejs.org/docs/v${process.versions.node}/api`); replaceText('.node-version', `Node v${process.versions.node}`);
replaceText('.v8-version', `v8 v${process.versions.v8}`, 'https://v8.dev/docs'); replaceText('.v8-version', `v8 v${process.versions.v8}`);
replaceText('.command-example', `${electronPath} path-to-app`); replaceText('.command-example', `${electronPath} path-to-app`);
for (const element of document.querySelectorAll<HTMLSpanElement>('.octicon')) { for (const element of document.querySelectorAll<HTMLSpanElement>('.octicon')) {

View File

@@ -1,35 +0,0 @@
{
"extends": "standard",
"plugins": [
"markdown",
"unicorn"
],
"overrides": [
{
"files": ["*.md", "**/*.md"],
"processor": "markdown/markdown"
}
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"import/order": ["error", {
"alphabetize": {
"order": "asc"
},
"newlines-between": "always",
"pathGroups": [
{
"pattern": "{electron,electron/**}",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": []
}],
"n/no-callback-literal": "off",
"no-undef": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"unicorn/prefer-node-protocol": "error"
}
}

View File

@@ -21,6 +21,7 @@ an issue:
### Getting started ### Getting started
* [Introduction](tutorial/introduction.md) * [Introduction](tutorial/introduction.md)
* [Quick Start](tutorial/quick-start.md)
* [Process Model](tutorial/process-model.md) * [Process Model](tutorial/process-model.md)
### Learning the basics ### Learning the basics
@@ -36,7 +37,6 @@ an issue:
* [Offline/Online Detection](tutorial/online-offline-events.md) * [Offline/Online Detection](tutorial/online-offline-events.md)
* [Represented File for macOS BrowserWindows](tutorial/represented-file.md) * [Represented File for macOS BrowserWindows](tutorial/represented-file.md)
* [Native File Drag & Drop](tutorial/native-file-drag-drop.md) * [Native File Drag & Drop](tutorial/native-file-drag-drop.md)
* [Navigation History](tutorial/navigation-history.md)
* [Offscreen Rendering](tutorial/offscreen-rendering.md) * [Offscreen Rendering](tutorial/offscreen-rendering.md)
* [Dark Mode](tutorial/dark-mode.md) * [Dark Mode](tutorial/dark-mode.md)
* [Web embeds in Electron](tutorial/web-embeds.md) * [Web embeds in Electron](tutorial/web-embeds.md)
@@ -96,9 +96,8 @@ These individual tutorials expand on topics discussed in the guide above.
* [Chrome Extensions Support](api/extensions.md) * [Chrome Extensions Support](api/extensions.md)
* [Breaking API Changes](breaking-changes.md) * [Breaking API Changes](breaking-changes.md)
### Custom Web Features: ### Custom DOM Elements:
* [`-electron-corner-smoothing` CSS Rule](api/corner-smoothing-css.md)
* [`<webview>` Tag](api/webview-tag.md) * [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md) * [`window.open` Function](api/window-open.md)
@@ -113,7 +112,6 @@ These individual tutorials expand on topics discussed in the guide above.
* [dialog](api/dialog.md) * [dialog](api/dialog.md)
* [globalShortcut](api/global-shortcut.md) * [globalShortcut](api/global-shortcut.md)
* [inAppPurchase](api/in-app-purchase.md) * [inAppPurchase](api/in-app-purchase.md)
* [ImageView](api/image-view.md)
* [ipcMain](api/ipc-main.md) * [ipcMain](api/ipc-main.md)
* [Menu](api/menu.md) * [Menu](api/menu.md)
* [MenuItem](api/menu-item.md) * [MenuItem](api/menu-item.md)
@@ -129,7 +127,6 @@ These individual tutorials expand on topics discussed in the guide above.
* [pushNotifications](api/push-notifications.md) * [pushNotifications](api/push-notifications.md)
* [safeStorage](api/safe-storage.md) * [safeStorage](api/safe-storage.md)
* [screen](api/screen.md) * [screen](api/screen.md)
* [ServiceWorkerMain](api/service-worker-main.md)
* [session](api/session.md) * [session](api/session.md)
* [ShareMenu](api/share-menu.md) * [ShareMenu](api/share-menu.md)
* [systemPreferences](api/system-preferences.md) * [systemPreferences](api/system-preferences.md)

View File

@@ -1,47 +0,0 @@
{
"title": "JSON schema for API history blocks in Electron documentation",
"$schema": "http://json-schema.org/draft-07/schema#",
"$comment": "If you change this schema, remember to edit the TypeScript interfaces in the linting script.",
"definitions": {
"baseChangeSchema": {
"type": "object",
"properties": {
"pr-url": {
"description": "URL to the 'main' GitHub Pull Request for the change (i.e. not a backport PR)",
"type": "string", "pattern": "^https://github.com/electron/electron/pull/\\d+$",
"examples": [ "https://github.com/electron/electron/pull/26789" ]
},
"breaking-changes-header": {
"description": "Heading ID for the change in `electron/docs/breaking-changes.md`",
"type": "string", "minLength": 3,
"examples": [ "deprecated-browserwindowsettrafficlightpositionposition" ]
},
"description": {
"description": "Short description of the change",
"type": "string", "minLength": 3, "maxLength": 120,
"examples": [ "Made `trafficLightPosition` option work for `customButtonOnHover`." ]
}
},
"required": [ "pr-url" ],
"additionalProperties": false
},
"addedChangeSchema": {
"allOf": [ { "$ref": "#/definitions/baseChangeSchema" } ]
},
"deprecatedChangeSchema": {
"$comment": "TODO: Make 'breaking-changes-header' required in the future.",
"allOf": [ { "$ref": "#/definitions/baseChangeSchema" } ]
},
"changesChangeSchema": {
"$comment": "Unlike RFC, added `'type': 'object'` to appease AJV strict mode",
"allOf": [ { "$ref": "#/definitions/baseChangeSchema" }, { "type": "object", "required": [ "description" ] } ]
}
},
"type": "object",
"properties": {
"added": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "$ref": "#/definitions/addedChangeSchema" } },
"deprecated": { "type": "array", "minItems": 1, "maxItems": 1, "items": { "$ref": "#/definitions/deprecatedChangeSchema" } },
"changes": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/changesChangeSchema" } }
},
"additionalProperties": false
}

255
docs/api/app.md Normal file → Executable file
View File

@@ -9,7 +9,6 @@ closed:
```js ```js
const { app } = require('electron') const { app } = require('electron')
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
app.quit() app.quit()
}) })
@@ -42,10 +41,9 @@ that was used to open the application, if it was launched from Notification Cent
You can also call `app.isReady()` to check if this event has already fired and `app.whenReady()` You can also call `app.isReady()` to check if this event has already fired and `app.whenReady()`
to get a Promise that is fulfilled when Electron is initialized. to get a Promise that is fulfilled when Electron is initialized.
> [!NOTE] **Note**: The `ready` event is only fired after the main process has finished running the first
> The `ready` event is only fired after the main process has finished running the first tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure
> tick of the event loop. If an Electron API needs to be called before the `ready` event, ensure that it is called synchronously in the top-level context of the main process.
> that it is called synchronously in the top-level context of the main process.
### Event: 'window-all-closed' ### Event: 'window-all-closed'
@@ -68,14 +66,12 @@ Emitted before the application starts closing its windows.
Calling `event.preventDefault()` will prevent the default behavior, which is Calling `event.preventDefault()` will prevent the default behavior, which is
terminating the application. terminating the application.
> [!NOTE] **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
> If application quit was initiated by `autoUpdater.quitAndInstall()`, then `before-quit` is emitted _after_ emitting `close` event on all windows and
> then `before-quit` is emitted _after_ emitting `close` event on all windows and closing them.
> closing them.
> [!NOTE] **Note:** On Windows, this event will not be emitted if the app is closed due
> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
> to a shutdown/restart of the system or a user logout.
### Event: 'will-quit' ### Event: 'will-quit'
@@ -90,9 +86,8 @@ terminating the application.
See the description of the `window-all-closed` event for the differences between See the description of the `window-all-closed` event for the differences between
the `will-quit` and `window-all-closed` events. the `will-quit` and `window-all-closed` events.
> [!NOTE] **Note:** On Windows, this event will not be emitted if the app is closed due
> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
> to a shutdown/restart of the system or a user logout.
### Event: 'quit' ### Event: 'quit'
@@ -103,9 +98,8 @@ Returns:
Emitted when the application is quitting. Emitted when the application is quitting.
> [!NOTE] **Note:** On Windows, this event will not be emitted if the app is closed due
> On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
> to a shutdown/restart of the system or a user logout.
### Event: 'open-file' _macOS_ ### Event: 'open-file' _macOS_
@@ -351,10 +345,9 @@ app.on('select-client-certificate', (event, webContents, url, list, callback) =>
Returns: Returns:
* `event` Event * `event` Event
* `webContents` [WebContents](web-contents.md) (optional) * `webContents` [WebContents](web-contents.md)
* `authenticationResponseDetails` Object * `authenticationResponseDetails` Object
* `url` URL * `url` URL
* `pid` number
* `authInfo` Object * `authInfo` Object
* `isProxy` boolean * `isProxy` boolean
* `scheme` string * `scheme` string
@@ -365,7 +358,7 @@ Returns:
* `username` string (optional) * `username` string (optional)
* `password` string (optional) * `password` string (optional)
Emitted when `webContents` or [Utility process](../glossary.md#utility-process) wants to do basic auth. Emitted when `webContents` wants to do basic auth.
The default behavior is to cancel all authentications. To override this you The default behavior is to cancel all authentications. To override this you
should prevent the default behavior with `event.preventDefault()` and call should prevent the default behavior with `event.preventDefault()` and call
@@ -422,7 +415,7 @@ Returns:
* `launch-failed` - Process never successfully launched * `launch-failed` - Process never successfully launched
* `integrity-failure` - Windows code integrity checks failed * `integrity-failure` - Windows code integrity checks failed
* `exitCode` number - The exit code for the process * `exitCode` number - The exit code for the process
(e.g. status from waitpid if on POSIX, from GetExitCodeProcess on Windows). (e.g. status from waitpid if on posix, from GetExitCodeProcess on Windows).
* `serviceName` string (optional) - The non-localized name of the process. * `serviceName` string (optional) - The non-localized name of the process.
* `name` string (optional) - The name of the process. * `name` string (optional) - The name of the process.
Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc. Examples for utility: `Audio Service`, `Content Decryption Module Service`, `Network Service`, `Video Capture`, etc.
@@ -476,28 +469,24 @@ and `workingDirectory` is its current working directory. Usually
applications respond to this by making their primary window focused and applications respond to this by making their primary window focused and
non-minimized. non-minimized.
> [!NOTE] **Note:** `argv` will not be exactly the same list of arguments as those passed
> `argv` will not be exactly the same list of arguments as those passed to the second instance. The order might change and additional arguments might be appended.
> to the second instance. The order might change and additional arguments might be appended. If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
> If you need to maintain the exact same arguments, it's advised to use `additionalData` instead.
> [!NOTE] **Note:** If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
> If the second instance is started by a different user than the first, the `argv` array will not include the arguments.
This event is guaranteed to be emitted after the `ready` event of `app` This event is guaranteed to be emitted after the `ready` event of `app`
gets emitted. gets emitted.
> [!NOTE] **Note:** Extra command line arguments might be added by Chromium,
> Extra command line arguments might be added by Chromium, such as `--original-process-start-time`.
> such as `--original-process-start-time`.
## Methods ## Methods
The `app` object has the following methods: The `app` object has the following methods:
> [!NOTE] **Note:** Some methods are only available on specific operating systems and are
> Some methods are only available on specific operating systems and are labeled as such.
> labeled as such.
### `app.quit()` ### `app.quit()`
@@ -524,20 +513,20 @@ and `will-quit` events will not be emitted.
* `args` string[] (optional) * `args` string[] (optional)
* `execPath` string (optional) * `execPath` string (optional)
Relaunches the app when the current instance exits. Relaunches the app when current instance exits.
By default, the new instance will use the same working directory and command line By default, the new instance will use the same working directory and command line
arguments as the current instance. When `args` is specified, the `args` will be arguments with current instance. When `args` is specified, the `args` will be
passed as the command line arguments instead. When `execPath` is specified, the passed as command line arguments instead. When `execPath` is specified, the
`execPath` will be executed for the relaunch instead of the current app. `execPath` will be executed for relaunch instead of current app.
Note that this method does not quit the app when executed. You have to call Note that this method does not quit the app when executed, you have to call
`app.quit` or `app.exit` after calling `app.relaunch` to make the app restart. `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
When `app.relaunch` is called multiple times, multiple instances will be When `app.relaunch` is called for multiple times, multiple instances will be
started after the current instance exits. started after current instance exited.
An example of restarting the current instance immediately and adding a new command An example of restarting current instance immediately and adding a new command
line argument to the new instance: line argument to the new instance:
```js ```js
@@ -689,8 +678,7 @@ preferred over `name` by Electron.
Overrides the current application's name. Overrides the current application's name.
> [!NOTE] **Note:** This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
> This function overrides the name used internally by Electron; it does not affect the name that the OS uses.
### `app.getLocale()` ### `app.getLocale()`
@@ -699,22 +687,18 @@ Possible return values are documented [here](https://source.chromium.org/chromiu
To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md). To set the locale, you'll want to use a command line switch at app startup, which may be found [here](command-line-switches.md).
> [!NOTE] **Note:** When distributing your packaged app, you have to also ship the
> When distributing your packaged app, you have to also ship the `locales` folder.
> `locales` folder.
> [!NOTE] **Note:** This API must be called after the `ready` event is emitted.
> This API must be called after the `ready` event is emitted.
> [!NOTE] **Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
### `app.getLocaleCountryCode()` ### `app.getLocaleCountryCode()`
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs. Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
> [!NOTE] **Note:** When unable to detect locale country code, it returns empty string.
> When unable to detect locale country code, it returns empty string.
### `app.getSystemLocale()` ### `app.getSystemLocale()`
@@ -727,11 +711,9 @@ Different operating systems also use the regional data differently:
Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS. Therefore, this API can be used for purposes such as choosing a format for rendering dates and times in a calendar app, especially when the developer wants the format to be consistent with the OS.
> [!NOTE] **Note:** This API must be called after the `ready` event is emitted.
> This API must be called after the `ready` event is emitted.
> [!NOTE] **Note:** To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
> To see example return values of this API compared to other locale and language APIs, see [`app.getPreferredSystemLanguages()`](#appgetpreferredsystemlanguages).
### `app.getPreferredSystemLanguages()` ### `app.getPreferredSystemLanguages()`
@@ -794,18 +776,16 @@ Once registered, all links with `your-protocol://` will be opened with the
current executable. The whole link, including protocol, will be passed to your current executable. The whole link, including protocol, will be passed to your
application as a parameter. application as a parameter.
> [!NOTE] **Note:** On macOS, you can only register protocols that have been added to
> On macOS, you can only register protocols that have been added to your app's `info.plist`, which cannot be modified at runtime. However, you can
> your app's `info.plist`, which cannot be modified at runtime. However, you can change the file during build time via [Electron Forge][electron-forge],
> change the file during build time via [Electron Forge][electron-forge], [Electron Packager][electron-packager], or by editing `info.plist` with a text
> [Electron Packager][electron-packager], or by editing `info.plist` with a text editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
> editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
> [!NOTE] **Note:** In a Windows Store environment (when packaged as an `appx`) this API
> In a Windows Store environment (when packaged as an `appx`) this API will return `true` for all calls but the registry key it sets won't be accessible
> will return `true` for all calls but the registry key it sets won't be accessible by other applications. In order to register your Windows Store application
> by other applications. In order to register your Windows Store application as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
> as a default protocol handler you must [declare the protocol in your manifest](https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally. The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
@@ -829,12 +809,11 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
Returns `boolean` - Whether the current executable is the default handler for a Returns `boolean` - Whether the current executable is the default handler for a
protocol (aka URI scheme). protocol (aka URI scheme).
> [!NOTE] **Note:** On macOS, you can use this method to check if the app has been
> On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify
> registered as the default protocol handler for a protocol. You can also verify this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
> this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the macOS machine. Please refer to
> macOS machine. Please refer to [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
> [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally. The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
@@ -878,9 +857,8 @@ Adds `tasks` to the [Tasks][tasks] category of the Jump List on Windows.
Returns `boolean` - Whether the call succeeded. Returns `boolean` - Whether the call succeeded.
> [!NOTE] **Note:** If you'd like to customize the Jump List even more use
> If you'd like to customize the Jump List even more use `app.setJumpList(categories)` instead.
> `app.setJumpList(categories)` instead.
### `app.getJumpListSettings()` _Windows_ ### `app.getJumpListSettings()` _Windows_
@@ -918,24 +896,21 @@ following strings:
If `categories` is `null` the previously set custom Jump List (if any) will be If `categories` is `null` the previously set custom Jump List (if any) will be
replaced by the standard Jump List for the app (managed by Windows). replaced by the standard Jump List for the app (managed by Windows).
> [!NOTE] **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
> If a `JumpListCategory` object has neither the `type` nor the `name` property set then its `type` is assumed to be `tasks`. If the `name` property
> property set then its `type` is assumed to be `tasks`. If the `name` property
is set but the `type` property is omitted then the `type` is assumed to be is set but the `type` property is omitted then the `type` is assumed to be
`custom`. `custom`.
> [!NOTE] **Note:** Users can remove items from custom categories, and Windows will not
> Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until **after**
> allow a removed item to be added back into a custom category until **after** the next successful call to `app.setJumpList(categories)`. Any attempt to
> the next successful call to `app.setJumpList(categories)`. Any attempt to re-add a removed item to a custom category earlier than that will result in the
> re-add a removed item to a custom category earlier than that will result in the entire custom category being omitted from the Jump List. The list of removed
> entire custom category being omitted from the Jump List. The list of removed items can be obtained using `app.getJumpListSettings()`.
> items can be obtained using `app.getJumpListSettings()`.
> [!NOTE] **Note:** The maximum length of a Jump List item's `description` property is
> The maximum length of a Jump List item's `description` property is 260 characters. Beyond this limit, the item will not be added to the Jump
> 260 characters. Beyond this limit, the item will not be added to the Jump List, nor will it be displayed.
> List, nor will it be displayed.
Here's a very simple example of creating a custom Jump List: Here's a very simple example of creating a custom Jump List:
@@ -1024,7 +999,6 @@ starts:
```js ```js
const { app, BrowserWindow } = require('electron') const { app, BrowserWindow } = require('electron')
let myWindow = null let myWindow = null
const additionalData = { myKey: 'myValue' } const additionalData = { myKey: 'myValue' }
@@ -1135,11 +1109,6 @@ indicates success while any other value indicates failure according to Chromium
resolver will attempt to use the system's DNS settings to do DNS lookups resolver will attempt to use the system's DNS settings to do DNS lookups
itself. Enabled by default on macOS, disabled by default on Windows and itself. Enabled by default on macOS, disabled by default on Windows and
Linux. Linux.
* `enableHappyEyeballs` boolean (optional) - Whether the
[Happy Eyeballs V3][happy-eyeballs-v3] algorithm should be used in creating
network connections. When enabled, hostnames resolving to multiple IP
addresses will be attempted in parallel to have a chance at establishing a
connection more quickly.
* `secureDnsMode` string (optional) - Can be 'off', 'automatic' or 'secure'. * `secureDnsMode` string (optional) - Can be 'off', 'automatic' or 'secure'.
Configures the DNS-over-HTTP mode. When 'off', no DoH lookups will be Configures the DNS-over-HTTP mode. When 'off', no DoH lookups will be
performed. When 'automatic', DoH lookups will be performed first if DoH is performed. When 'automatic', DoH lookups will be performed first if DoH is
@@ -1213,8 +1182,7 @@ Returns [`ProcessMetric[]`](structures/process-metric.md): Array of `ProcessMetr
Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`. Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Feature Status from `chrome://gpu/`.
> [!NOTE] **Note:** This information is only usable after the `gpu-info-update` event is emitted.
> This information is only usable after the `gpu-info-update` event is emitted.
### `app.getGPUInfo(infoType)` ### `app.getGPUInfo(infoType)`
@@ -1228,8 +1196,6 @@ For `infoType` equal to `complete`:
For `infoType` equal to `basic`: For `infoType` equal to `basic`:
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response: Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
<!-- eslint-skip -->
```js ```js
{ {
auxAttributes: auxAttributes:
@@ -1270,13 +1236,11 @@ badge.
On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher. On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
> [!NOTE] **Note:** Unity launcher requires a `.desktop` file to work. For more information,
> Unity launcher requires a `.desktop` file to work. For more information, please read the [Unity integration documentation][unity-requirement].
> please read the [Unity integration documentation][unity-requirement].
> [!NOTE] **Note:** On macOS, you need to ensure that your application has the permission
> On macOS, you need to ensure that your application has the permission to display notifications for this method to work.
> to display notifications for this method to work.
### `app.getBadgeCount()` _Linux_ _macOS_ ### `app.getBadgeCount()` _Linux_ _macOS_
@@ -1337,25 +1301,23 @@ Returns `Object`:
Set the app's login item settings. Set the app's login item settings.
To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows], To work with Electron's `autoUpdater` on Windows, which uses [Squirrel][Squirrel-Windows],
you'll want to set the launch path to your executable's name but a directory up, which is you'll want to set the launch path to Update.exe, and pass arguments that specify your
a stub application automatically generated by Squirrel which will automatically launch the application name. For example:
latest version.
``` js ``` js
const { app } = require('electron') const { app } = require('electron')
const path = require('node:path') const path = require('node:path')
const appFolder = path.dirname(process.execPath) const appFolder = path.dirname(process.execPath)
const ourExeName = path.basename(process.execPath) const updateExe = path.resolve(appFolder, '..', 'Update.exe')
const stubLauncher = path.resolve(appFolder, '..', ourExeName) const exeName = path.basename(process.execPath)
app.setLoginItemSettings({ app.setLoginItemSettings({
openAtLogin: true, openAtLogin: true,
path: stubLauncher, path: updateExe,
args: [ args: [
// You might want to pass a parameter here indicating that this '--processStart', `"${exeName}"`,
// app was launched via login, but you don't have to '--process-start-args', '"--hidden"'
] ]
}) })
``` ```
@@ -1379,8 +1341,7 @@ details. Disabled by default.
This API must be called after the `ready` event is emitted. This API must be called after the `ready` event is emitted.
> [!NOTE] **Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
### `app.showAboutPanel()` ### `app.showAboutPanel()`
@@ -1396,7 +1357,7 @@ Show the app's about panel options. These options can be overridden with `app.se
* `credits` string (optional) _macOS_ _Windows_ - Credit information. * `credits` string (optional) _macOS_ _Windows_ - Credit information.
* `authors` string[] (optional) _Linux_ - List of app authors. * `authors` string[] (optional) _Linux_ - List of app authors.
* `website` string (optional) _Linux_ - The app's website. * `website` string (optional) _Linux_ - The app's website.
* `iconPath` string (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. On Windows, a 48x48 PNG will result in the best visual quality. * `iconPath` string (optional) _Linux_ _Windows_ - Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as 64x64 pixels while retaining aspect ratio.
Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults. Set the about panel options. This will override the values defined in the app's `.plist` file on macOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
@@ -1418,7 +1379,6 @@ Returns `Function` - This function **must** be called once you have finished acc
```js ```js
const { app, dialog } = require('electron') const { app, dialog } = require('electron')
const fs = require('node:fs') const fs = require('node:fs')
let filepath let filepath
@@ -1509,8 +1469,7 @@ By using this API, important information such as password and other sensitive in
See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more See [Apple's documentation](https://developer.apple.com/library/archive/technotes/tn2150/_index.html) for more
details. details.
> [!NOTE] **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
> Enable `Secure Keyboard Entry` only when it is needed and disable it when it is no longer needed.
### `app.setProxy(config)` ### `app.setProxy(config)`
@@ -1524,44 +1483,12 @@ and internal requests made by the runtime (ex: geolocation queries).
This method can only be called after app is ready. This method can only be called after app is ready.
### `app.resolveProxy(url)` #### `app.resolveProxy(url)`
* `url` URL * `url` URL
Returns `Promise<string>` - Resolves with the proxy information for `url` that will be used when attempting to make requests using [Net](net.md) in the [utility process](../glossary.md#utility-process). Returns `Promise<string>` - Resolves with the proxy information for `url` that will be used when attempting to make requests using [Net](net.md) in the [utility process](../glossary.md#utility-process).
### `app.setClientCertRequestPasswordHandler(handler)` _Linux_
* `handler` Function\<Promise\<string\>\>
* `clientCertRequestParams` Object
* `hostname` string - the hostname of the site requiring a client certificate
* `tokenName` string - the token (or slot) name of the cryptographic device
* `isRetry` boolean - whether there have been previous failed attempts at prompting the password
Returns `Promise<string>` - Resolves with the password
The handler is called when a password is needed to unlock a client certificate for
`hostname`.
```js
const { app } = require('electron')
async function passwordPromptUI (text) {
return new Promise((resolve, reject) => {
// display UI to prompt user for password
// ...
// ...
resolve('the password')
})
}
app.setClientCertRequestPasswordHandler(async ({ hostname, tokenName, isRetry }) => {
const text = `Please sign in to ${tokenName} to authenticate to ${hostname} with your certificate`
const password = await passwordPromptUI(text)
return password
})
```
## Properties ## Properties
### `app.accessibilitySupportEnabled` _macOS_ _Windows_ ### `app.accessibilitySupportEnabled` _macOS_ _Windows_
@@ -1572,8 +1499,7 @@ See [Chromium's accessibility docs](https://www.chromium.org/developers/design-d
This API must be called after the `ready` event is emitted. This API must be called after the `ready` event is emitted.
> [!NOTE] **Note:** Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
### `app.applicationMenu` ### `app.applicationMenu`
@@ -1586,13 +1512,11 @@ An `Integer` property that returns the badge count for current app. Setting the
On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher. On macOS, setting this with any nonzero integer shows on the dock icon. On Linux, this property only works for Unity launcher.
> [!NOTE] **Note:** Unity launcher requires a `.desktop` file to work. For more information,
> Unity launcher requires a `.desktop` file to work. For more information, please read the [Unity integration documentation][unity-requirement].
> please read the [Unity integration documentation][unity-requirement].
> [!NOTE] **Note:** On macOS, you need to ensure that your application has the permission
> On macOS, you need to ensure that your application has the permission to display notifications for this property to take effect.
> to display notifications for this property to take effect.
### `app.commandLine` _Readonly_ ### `app.commandLine` _Readonly_
@@ -1601,8 +1525,8 @@ command line arguments that Chromium uses.
### `app.dock` _macOS_ _Readonly_ ### `app.dock` _macOS_ _Readonly_
A `Dock | undefined` property ([`Dock`](./dock.md) on macOS, `undefined` on all other A [`Dock`](./dock.md) `| undefined` object that allows you to perform actions on your app icon in the user's
platforms) that allows you to perform actions on your app icon in the user's dock. dock on macOS.
### `app.isPackaged` _Readonly_ ### `app.isPackaged` _Readonly_
@@ -1621,7 +1545,6 @@ A `boolean` property that returns `true` if the app is packaged, `false` otherw
[Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows [Squirrel-Windows]: https://github.com/Squirrel/Squirrel.Windows
[JumpListBeginListMSDN]: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-icustomdestinationlist-beginlist [JumpListBeginListMSDN]: https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-icustomdestinationlist-beginlist
[about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc [about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc
[happy-eyeballs-v3]: https://datatracker.ietf.org/doc/draft-pauly-happy-happyeyeballs-v3/
### `app.name` ### `app.name`

View File

@@ -26,35 +26,28 @@ requirements, you can read [Server Support][server-support]. Note that
update process. Apps that need to disable ATS can add the update process. Apps that need to disable ATS can add the
`NSAllowsArbitraryLoads` key to their app's plist. `NSAllowsArbitraryLoads` key to their app's plist.
> [!IMPORTANT] **Note:** Your application must be signed for automatic updates on macOS.
> Your application must be signed for automatic updates on macOS. This is a requirement of `Squirrel.Mac`.
> This is a requirement of `Squirrel.Mac`.
### Windows ### Windows
On Windows, you have to install your app into a user's machine before you can On Windows, you have to install your app into a user's machine before you can
use the `autoUpdater`, so it is recommended that you use use the `autoUpdater`, so it is recommended that you use the
[electron-winstaller][installer-lib] or [Electron Forge's Squirrel.Windows maker][electron-forge-lib] to generate a Windows installer. [electron-winstaller][installer-lib], [Electron Forge][electron-forge-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer.
Apps built with Squirrel.Windows will trigger [custom launch events](https://github.com/Squirrel/Squirrel.Windows/blob/51f5e2cb01add79280a53d51e8d0cfa20f8c9f9f/docs/using/custom-squirrel-events-non-cs.md#application-startup-commands) When using [electron-winstaller][installer-lib] or [Electron Forge][electron-forge-lib] make sure you do not try to update your app [the first time it runs](https://github.com/electron/windows-installer#handling-squirrel-events) (Also see [this issue for more info](https://github.com/electron/electron/issues/7155)). It's also recommended to use [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) to get desktop shortcuts for your app.
that must be handled by your Electron application to ensure proper setup and teardown.
Squirrel.Windows apps will launch with the `--squirrel-firstrun` argument immediately The installer generated with Squirrel will create a shortcut icon with an
after installation. During this time, Squirrel.Windows will obtain a file lock on
your app, and `autoUpdater` requests will fail until the lock is released. In practice,
this means that you won't be able to check for updates on first launch for the first
few seconds. You can work around this by not checking for updates when `process.argv`
contains the `--squirrel-firstrun` flag or by setting a 10-second timeout on your
update checks (see [electron/electron#7155](https://github.com/electron/electron/issues/7155)
for more information).
The installer generated with Squirrel.Windows will create a shortcut icon with an
[Application User Model ID][app-user-model-id] in the format of [Application User Model ID][app-user-model-id] in the format of
`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are `com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, examples are
`com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the `com.squirrel.slack.Slack` and `com.squirrel.code.Code`. You have to use the
same ID for your app with `app.setAppUserModelId` API, otherwise Windows will same ID for your app with `app.setAppUserModelId` API, otherwise Windows will
not be able to pin your app properly in task bar. not be able to pin your app properly in task bar.
Like Squirrel.Mac, Windows can host updates on S3 or any other static file host.
You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details
about how Squirrel.Windows works.
## Events ## Events
The `autoUpdater` object emits the following events: The `autoUpdater` object emits the following events:
@@ -69,7 +62,7 @@ Emitted when there is an error while updating.
### Event: 'checking-for-update' ### Event: 'checking-for-update'
Emitted when checking for an available update has started. Emitted when checking if an update has started.
### Event: 'update-available' ### Event: 'update-available'
@@ -94,9 +87,8 @@ Emitted when an update has been downloaded.
On Windows only `releaseName` is available. On Windows only `releaseName` is available.
> [!NOTE] **Note:** It is not strictly necessary to handle this event. A successfully
> It is not strictly necessary to handle this event. A successfully downloaded update will still be applied the next time the application starts.
> downloaded update will still be applied the next time the application starts.
### Event: 'before-quit-for-update' ### Event: 'before-quit-for-update'
@@ -127,9 +119,8 @@ Returns `string` - The current update feed URL.
Asks the server whether there is an update. You must call `setFeedURL` before Asks the server whether there is an update. You must call `setFeedURL` before
using this API. using this API.
> [!NOTE] **Note:** If an update is available it will be downloaded automatically.
> If an update is available it will be downloaded automatically. Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
> Calling `autoUpdater.checkForUpdates()` twice will download the update two times.
### `autoUpdater.quitAndInstall()` ### `autoUpdater.quitAndInstall()`
@@ -140,14 +131,15 @@ Under the hood calling `autoUpdater.quitAndInstall()` will close all application
windows first, and automatically call `app.quit()` after all windows have been windows first, and automatically call `app.quit()` after all windows have been
closed. closed.
> [!NOTE] **Note:** It is not strictly necessary to call this function to apply an update,
> It is not strictly necessary to call this function to apply an update, as a successfully downloaded update will always be applied the next time the
> as a successfully downloaded update will always be applied the next time the application starts.
> application starts.
[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac [squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support [server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
[installer]: https://github.com/electron-archive/grunt-electron-installer
[installer-lib]: https://github.com/electron/windows-installer [installer-lib]: https://github.com/electron/windows-installer
[electron-forge-lib]: https://www.electronforge.io/config/makers/squirrel.windows [electron-forge-lib]: https://github.com/electron/forge
[app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids [app-user-model-id]: https://learn.microsoft.com/en-us/windows/win32/shell/appids
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter [event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter

View File

@@ -4,7 +4,7 @@
Process: [Main](../glossary.md#main-process) Process: [Main](../glossary.md#main-process)
> [!NOTE] > **Note**
> `BaseWindow` provides a flexible way to compose multiple web views in a > `BaseWindow` provides a flexible way to compose multiple web views in a
> single window. For windows with only a single, full-size web view, the > single window. For windows with only a single, full-size web view, the
> [`BrowserWindow`](browser-window.md) class may be a simpler option. > [`BrowserWindow`](browser-window.md) class may be a simpler option.
@@ -64,31 +64,6 @@ const child = new BaseWindow({ parent, modal: true })
* On Linux the type of modal windows will be changed to `dialog`. * On Linux the type of modal windows will be changed to `dialog`.
* On Linux many desktop environments do not support hiding a modal window. * On Linux many desktop environments do not support hiding a modal window.
## Resource management
When you add a [`WebContentsView`](web-contents-view.md) to a `BaseWindow` and the `BaseWindow`
is closed, the [`webContents`](web-contents.md) of the `WebContentsView` are not destroyed
automatically.
It is your responsibility to close the `webContents` when you no longer need them, e.g. when
the `BaseWindow` is closed:
```js
const { BaseWindow, WebContentsView } = require('electron')
const win = new BaseWindow({ width: 800, height: 600 })
const view = new WebContentsView()
win.contentView.addChildView(view)
win.on('closed', () => {
view.webContents.close()
})
```
Unlike with a [`BrowserWindow`](browser-window.md), if you don't explicitly close the
`webContents`, you'll encounter memory leaks.
## Class: BaseWindow ## Class: BaseWindow
> Create and control windows. > Create and control windows.
@@ -107,9 +82,8 @@ It creates a new `BaseWindow` with native properties as set by the `options`.
Objects created with `new BaseWindow` emit the following events: Objects created with `new BaseWindow` emit the following events:
> [!NOTE] **Note:** Some events are only available on specific operating systems and are
> Some events are only available on specific operating systems and are labeled as such.
> labeled as such.
#### Event: 'close' #### Event: 'close'
@@ -138,50 +112,24 @@ window.onbeforeunload = (e) => {
} }
``` ```
> [!NOTE] _**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
> There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and
> `window.addEventListener('beforeunload', handler)`. It is recommended to always set the
> `event.returnValue` explicitly, instead of only returning a value, as the former works more
> consistently within Electron.
#### Event: 'closed' #### Event: 'closed'
Emitted when the window is closed. After you have received this event you should Emitted when the window is closed. After you have received this event you should
remove the reference to the window and avoid using it any more. remove the reference to the window and avoid using it any more.
#### Event: 'query-session-end' _Windows_
Returns:
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off.
Calling `event.preventDefault()` can delay the system shutdown, though its generally best
to respect the users choice to end the session. However, you may choose to use it if
ending the session puts the user at risk of losing data.
#### Event: 'session-end' _Windows_ #### Event: 'session-end' _Windows_
Returns: Emitted when window session is going to end due to force shutdown or machine restart
or session log off.
* `event` [WindowSessionEndEvent][window-session-end-event]
Emitted when a session is about to end due to a shutdown, machine restart, or user log-off. Once this event fires, there is no way to prevent the session from ending.
#### Event: 'blur' #### Event: 'blur'
Returns:
* `event` Event
Emitted when the window loses focus. Emitted when the window loses focus.
#### Event: 'focus' #### Event: 'focus'
Returns:
* `event` Event
Emitted when the window gains focus. Emitted when the window gains focus.
#### Event: 'show' #### Event: 'show'
@@ -257,8 +205,7 @@ Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position. Emitted once when the window is moved to a new position.
> [!NOTE] **Note**: On macOS this event is an alias of `move`.
> On macOS, this event is an alias of `move`.
#### Event: 'enter-full-screen' #### Event: 'enter-full-screen'
@@ -294,7 +241,6 @@ e.g. `APPCOMMAND_BROWSER_BACKWARD` is emitted as `browser-backward`.
```js ```js
const { BaseWindow } = require('electron') const { BaseWindow } = require('electron')
const win = new BaseWindow() const win = new BaseWindow()
win.on('app-command', (e, cmd) => { win.on('app-command', (e, cmd) => {
// Navigate the window back when the user hits their mouse back button // Navigate the window back when the user hits their mouse back button
@@ -349,12 +295,12 @@ Emitted when the window has closed a sheet.
Emitted when the native new tab button is clicked. Emitted when the native new tab button is clicked.
#### Event: 'system-context-menu' _Windows_ _Linux_ #### Event: 'system-context-menu' _Windows_
Returns: Returns:
* `event` Event * `event` Event
* `point` [Point](structures/point.md) - The screen coordinates where the context menu was triggered. * `point` [Point](structures/point.md) - The screen coordinates the context menu was triggered at
Emitted when the system context menu is triggered on the window, this is Emitted when the system context menu is triggered on the window, this is
normally only triggered when the user right clicks on the non-client area normally only triggered when the user right clicks on the non-client area
@@ -363,8 +309,6 @@ as `-webkit-app-region: drag` in a frameless window.
Calling `event.preventDefault()` will prevent the menu from being displayed. Calling `event.preventDefault()` will prevent the menu from being displayed.
To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux).
### Static Methods ### Static Methods
The `BaseWindow` class has the following static methods: The `BaseWindow` class has the following static methods:
@@ -405,7 +349,7 @@ A `View` property for the content view of the window.
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set. A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
#### `win.autoHideMenuBar` _Linux_ _Windows_ #### `win.autoHideMenuBar`
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key. A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.
@@ -428,8 +372,7 @@ A `boolean` property that determines whether the window is focusable.
A `boolean` property that determines whether the window is visible on all workspaces. A `boolean` property that determines whether the window is visible on all workspaces.
> [!NOTE] **Note:** Always returns false on Windows.
> Always returns false on Windows.
#### `win.shadow` #### `win.shadow`
@@ -439,8 +382,7 @@ A `boolean` property that determines whether the window has a shadow.
A `boolean` property that determines whether the menu bar should be visible. A `boolean` property that determines whether the menu bar should be visible.
> [!NOTE] **Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
> If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
#### `win.kiosk` #### `win.kiosk`
@@ -461,8 +403,7 @@ and the icon of the file will show in window's title bar.
A `string` property that determines the title of the native window. A `string` property that determines the title of the native window.
> [!NOTE] **Note:** The title of the web page can be different from the title of the native window.
> The title of the web page can be different from the title of the native window.
#### `win.minimizable` _macOS_ _Windows_ #### `win.minimizable` _macOS_ _Windows_
@@ -503,7 +444,6 @@ A `boolean` property that determines whether the window is excluded from the app
```js @ts-expect-error=[12] ```js @ts-expect-error=[12]
const { Menu, BaseWindow } = require('electron') const { Menu, BaseWindow } = require('electron')
const win = new BaseWindow({ height: 600, width: 600 }) const win = new BaseWindow({ height: 600, width: 600 })
const template = [ const template = [
@@ -524,17 +464,12 @@ A `string` property that defines an alternative title provided only to
accessibility tools such as screen readers. This string is not directly accessibility tools such as screen readers. This string is not directly
visible to users. visible to users.
#### `win.snapped` _Windows_ _Readonly_
A `boolean` property that indicates whether the window is arranged via [Snap.](https://support.microsoft.com/en-us/windows/snap-your-windows-885a9b1e-a983-a3b1-16cd-c531795e6241)
### Instance Methods ### Instance Methods
Objects created with `new BaseWindow` have the following instance methods: Objects created with `new BaseWindow` have the following instance methods:
> [!NOTE] **Note:** Some methods are only available on specific operating systems and are
> Some methods are only available on specific operating systems and are labeled as such.
> labeled as such.
#### `win.setContentView(view)` #### `win.setContentView(view)`
@@ -544,7 +479,7 @@ Sets the content view of the window.
#### `win.getContentView()` #### `win.getContentView()`
Returns [`View`](view.md) - The content view of the window. Returns [View](view.md) - The content view of the window.
#### `win.destroy()` #### `win.destroy()`
@@ -626,8 +561,7 @@ Returns `boolean` - Whether the window is minimized.
Sets whether the window should be in fullscreen mode. Sets whether the window should be in fullscreen mode.
> [!NOTE] **Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
> On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or > ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
#### `win.isFullScreen()` #### `win.isFullScreen()`
@@ -729,7 +663,6 @@ Resizes and moves the window to the supplied bounds. Any properties that are not
```js ```js
const { BaseWindow } = require('electron') const { BaseWindow } = require('electron')
const win = new BaseWindow() const win = new BaseWindow()
// set all bounds properties // set all bounds properties
@@ -742,15 +675,13 @@ win.setBounds({ width: 100 })
console.log(win.getBounds()) console.log(win.getBounds())
``` ```
> [!NOTE] **Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
> On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
#### `win.getBounds()` #### `win.getBounds()`
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`. Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
> [!NOTE] **Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
> On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
#### `win.getBackgroundColor()` #### `win.getBackgroundColor()`
@@ -758,8 +689,7 @@ Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) fo
See [Setting `backgroundColor`](browser-window.md#setting-the-backgroundcolor-property). See [Setting `backgroundColor`](browser-window.md#setting-the-backgroundcolor-property).
> [!NOTE] **Note:** The alpha value is _not_ returned alongside the red, green, and blue values.
> The alpha value is _not_ returned alongside the red, green, and blue values.
#### `win.setContentBounds(bounds[, animate])` #### `win.setContentBounds(bounds[, animate])`
@@ -777,8 +707,7 @@ Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's cl
Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state Returns [`Rectangle`](structures/rectangle.md) - Contains the window bounds of the normal state
> [!NOTE] **Note:** whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
> Whatever the current state of the window : maximized, minimized or in fullscreen, this function always returns the position and size of the window in normal state. In normal state, getBounds and getNormalBounds returns the same [`Rectangle`](structures/rectangle.md).
#### `win.setEnabled(enable)` #### `win.setEnabled(enable)`
@@ -975,9 +904,8 @@ Changes the title of native window to `title`.
Returns `string` - The title of the native window. Returns `string` - The title of the native window.
> [!NOTE] **Note:** The title of the web page can be different from the title of the native
> The title of the web page can be different from the title of the native window.
> window.
#### `win.setSheetOffset(offsetY[, offsetX])` _macOS_ #### `win.setSheetOffset(offsetY[, offsetX])` _macOS_
@@ -990,7 +918,6 @@ a HTML-rendered toolbar. For example:
```js ```js
const { BaseWindow } = require('electron') const { BaseWindow } = require('electron')
const win = new BaseWindow() const win = new BaseWindow()
const toolbarRect = document.getElementById('toolbar').getBoundingClientRect() const toolbarRect = document.getElementById('toolbar').getBoundingClientRect()
@@ -999,17 +926,6 @@ win.setSheetOffset(toolbarRect.height)
#### `win.flashFrame(flag)` #### `win.flashFrame(flag)`
<!--
```YAML history
added:
- pr-url: https://github.com/electron/electron/pull/35658
changes:
- pr-url: https://github.com/electron/electron/pull/41391
description: "`window.flashFrame(bool)` will flash dock icon continuously on macOS"
breaking-changes-header: behavior-changed-windowflashframebool-will-flash-dock-icon-continuously-on-macos
```
-->
* `flag` boolean * `flag` boolean
Starts or stops flashing the window to attract user's attention. Starts or stops flashing the window to attract user's attention.
@@ -1252,9 +1168,8 @@ in the taskbar.
Sets the properties for the window's taskbar button. Sets the properties for the window's taskbar button.
> [!NOTE] **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
> `relaunchCommand` and `relaunchDisplayName` must always be set together. If one of those properties is not set, then neither will be used.
> together. If one of those properties is not set, then neither will be used.
#### `win.setIcon(icon)` _Windows_ _Linux_ #### `win.setIcon(icon)` _Windows_ _Linux_
@@ -1291,13 +1206,6 @@ Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
Returns `boolean` - Whether the menu bar is visible. Returns `boolean` - Whether the menu bar is visible.
#### `win.isSnapped()` _Windows_
Returns `boolean` - whether the window is arranged via [Snap.](https://support.microsoft.com/en-us/windows/snap-your-windows-885a9b1e-a983-a3b1-16cd-c531795e6241)
The window is snapped via buttons shown when the mouse is hovered over window
maximize button, or by dragging it to the edges of the screen.
#### `win.setVisibleOnAllWorkspaces(visible[, options])` _macOS_ _Linux_ #### `win.setVisibleOnAllWorkspaces(visible[, options])` _macOS_ _Linux_
* `visible` boolean * `visible` boolean
@@ -1314,15 +1222,13 @@ maximize button, or by dragging it to the edges of the screen.
Sets whether the window should be visible on all workspaces. Sets whether the window should be visible on all workspaces.
> [!NOTE] **Note:** This API does nothing on Windows.
> This API does nothing on Windows.
#### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_ #### `win.isVisibleOnAllWorkspaces()` _macOS_ _Linux_
Returns `boolean` - Whether the window is visible on all workspaces. Returns `boolean` - Whether the window is visible on all workspaces.
> [!NOTE] **Note:** This API always returns false on Windows.
> This API always returns false on Windows.
#### `win.setIgnoreMouseEvents(ignore[, options])` #### `win.setIgnoreMouseEvents(ignore[, options])`
@@ -1350,10 +1256,6 @@ On Windows it calls SetWindowDisplayAffinity with `WDA_EXCLUDEFROMCAPTURE`.
For Windows 10 version 2004 and up the window will be removed from capture entirely, For Windows 10 version 2004 and up the window will be removed from capture entirely,
older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window. older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window.
#### `win.isContentProtected()` _macOS_ _Windows_
Returns `boolean` - whether or not content protection is currently enabled.
#### `win.setFocusable(focusable)` _macOS_ _Windows_ #### `win.setFocusable(focusable)` _macOS_ _Windows_
* `focusable` boolean * `focusable` boolean
@@ -1443,8 +1345,7 @@ This method sets the browser window's system-drawn background material, includin
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details. See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
> [!NOTE] **Note:** This method is only supported on Windows 11 22H2 and up.
> This method is only supported on Windows 11 22H2 and up.
#### `win.setWindowButtonPosition(position)` _macOS_ #### `win.setWindowButtonPosition(position)` _macOS_
@@ -1466,23 +1367,20 @@ Sets the touchBar layout for the current window. Specifying `null` or
`undefined` clears the touch bar. This method only has an effect if the `undefined` clears the touch bar. This method only has an effect if the
machine has a touch bar. machine has a touch bar.
> [!NOTE] **Note:** The TouchBar API is currently experimental and may change or be
> The TouchBar API is currently experimental and may change or be removed in future Electron releases.
> removed in future Electron releases.
#### `win.setTitleBarOverlay(options)` _Windows_ _Linux_ #### `win.setTitleBarOverlay(options)` _Windows_
* `options` Object * `options` Object
* `color` String (optional) - The CSS color of the Window Controls Overlay when enabled. * `color` String (optional) _Windows_ - The CSS color of the Window Controls Overlay when enabled.
* `symbolColor` String (optional) - The CSS color of the symbols on the Window Controls Overlay when enabled. * `symbolColor` String (optional) _Windows_ - The CSS color of the symbols on the Window Controls Overlay when enabled.
* `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. * `height` Integer (optional) _Windows_ - The height of the title bar and Window Controls Overlay in pixels.
On a Window with Window Controls Overlay already enabled, this method updates the style of the title bar overlay. On a Window with Window Controls Overlay already enabled, this method updates
the style of the title bar overlay.
On Linux, the `symbolColor` is automatically calculated to have minimum accessible contrast to the `color` if not explicitly set.
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look [quick-look]: https://en.wikipedia.org/wiki/Quick_Look
[vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc [vibrancy-docs]: https://developer.apple.com/documentation/appkit/nsvisualeffectview?preferredLanguage=objc
[window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level [window-levels]: https://developer.apple.com/documentation/appkit/nswindow/level
[event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter [event-emitter]: https://nodejs.org/api/events.html#events_class_eventemitter
[window-session-end-event]:../api/structures/window-session-end-event.md

Some files were not shown because too many files have changed in this diff Show More