Skip to content

Commit b2e73d2

Browse files
authored
build: update to yarn v4 (#48994)
* build: update to yarn v4 (cherry picked from commit 6adec74) * chore: fixup types after yarn v4 migration * chore: update nan yarn.lock patch * build: automatically install git for dugite
1 parent aeb5af8 commit b2e73d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+18341
-11314
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ runs:
184184
shell: bash
185185
run: |
186186
cd src/electron
187-
node script/yarn create-typescript-definitions
187+
node script/yarn.js create-typescript-definitions
188188
- name: Publish Electron Dist ${{ inputs.step-suffix }}
189189
if: ${{ inputs.is-release == 'true' }}
190190
shell: bash

.github/actions/checkout/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ runs:
152152
if: ${{ inputs.target-platform == 'linux' && github.ref == 'refs/heads/main' }}
153153
shell: bash
154154
run: |
155-
npx node src/electron/script/patches-stats.mjs --upload-stats || true
155+
node src/electron/script/patches-stats.mjs --upload-stats || true
156156
# delete all .git directories under src/ except for
157157
# third_party/angle/ and third_party/dawn/ because of build time generation of files
158158
# gen/angle/commit.h depends on third_party/angle/.git/HEAD

.github/actions/generate-types/action.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ runs:
1313
- name: Generating Types for SHA in ${{ inputs.sha-file }}
1414
shell: bash
1515
run: |
16-
git checkout $(cat ${{ inputs.sha-file }})
17-
rm -rf node_modules
18-
yarn install --frozen-lockfile --ignore-scripts
16+
export ELECTRON_DIR=$(pwd)
17+
if [ "${{ inputs.sha-file }}" == ".dig-old" ]; then
18+
cd /tmp
19+
git clone https://github.com/electron/electron.git
20+
cd electron
21+
fi
22+
git checkout $(cat $ELECTRON_DIR/${{ inputs.sha-file }})
23+
node script/yarn.js install --immutable
1924
echo "#!/usr/bin/env node\nglobal.x=1" > node_modules/typescript/bin/tsc
2025
node node_modules/.bin/electron-docs-parser --dir=./ --outDir=./ --moduleVersion=0.0.0-development
2126
node node_modules/.bin/electron-typescript-definitions --api=electron-api.json --outDir=artifacts
22-
mv artifacts/electron.d.ts artifacts/${{ inputs.filename }}
23-
git checkout .
27+
mv artifacts/electron.d.ts $ELECTRON_DIR/artifacts/${{ inputs.filename }}
2428
working-directory: ./electron

.github/actions/install-dependencies/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runs:
66
- name: Get yarn cache directory path
77
shell: bash
88
id: yarn-cache-dir-path
9-
run: echo "dir=$(node src/electron/script/yarn cache dir)" >> $GITHUB_OUTPUT
9+
run: echo "dir=$(node src/electron/script/yarn.js config get cacheFolder)" >> $GITHUB_OUTPUT
1010
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
1111
id: yarn-cache
1212
with:
@@ -18,4 +18,7 @@ runs:
1818
shell: bash
1919
run: |
2020
cd src/electron
21-
node script/yarn install --frozen-lockfile --prefer-offline
21+
if [ "$TARGET_ARCH" = "x86" ]; then
22+
export npm_config_arch="ia32"
23+
fi
24+
node script/yarn.js install --immutable

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ jobs:
333333
build-runs-on: electron-arc-centralus-linux-amd64-32core
334334
test-runs-on: electron-arc-centralus-linux-arm64-4core
335335
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"]}'
336-
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"]}'
336+
test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init --memory=12g","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
337337
target-platform: linux
338338
target-arch: arm
339339
is-release: false

.github/workflows/pipeline-electron-docs-only.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ jobs:
5454
shell: bash
5555
run: |
5656
cd src/electron
57-
node script/yarn create-typescript-definitions
58-
node script/yarn tsc -p tsconfig.default_app.json --noEmit
57+
node script/yarn.js create-typescript-definitions
58+
node script/yarn.js tsc -p tsconfig.default_app.json --noEmit
5959
for f in build/webpack/*.js
6060
do
6161
out="${f:29}"
6262
if [ "$out" != "base.js" ]; then
63-
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
63+
node script/yarn.js webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
6464
fi
6565
done

.github/workflows/pipeline-electron-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ jobs:
7878
# but then we would lint its contents (at least gn format), and it doesn't pass it.
7979
8080
cd src/electron
81-
node script/yarn install --frozen-lockfile
82-
node script/yarn lint
81+
node script/yarn.js install --immutable
82+
node script/yarn.js lint
8383
- name: Run Script Typechecker
8484
shell: bash
8585
run: |
8686
cd src/electron
87-
node script/yarn tsc -p tsconfig.script.json
87+
node script/yarn.js tsc -p tsconfig.script.json
8888

.github/workflows/pipeline-segment-electron-test.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,7 @@ jobs:
196196
# sudo security authorizationdb write com.apple.trust-settings.admin allow
197197
# cd src/electron
198198
# ./script/codesign/generate-identity.sh
199-
- name: Install Datadog CLI
200-
run: |
201-
cd src/electron
202-
node script/yarn global add @datadog/datadog-ci
199+
203200
- name: Run Electron Tests
204201
shell: bash
205202
env:
@@ -225,7 +222,7 @@ jobs:
225222
export ELECTRON_FORCE_TEST_SUITE_EXIT="true"
226223
fi
227224
fi
228-
node script/yarn test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
225+
node script/yarn.js test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files
229226
else
230227
chown :builduser .. && chmod g+w ..
231228
chown -R :builduser . && chmod -R g+w .
@@ -242,9 +239,14 @@ jobs:
242239
export MOCHA_TIMEOUT=180000
243240
echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
244241
cd electron
245-
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files | $ASAN_SYMBOLIZE
242+
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --runners=main --trace-uncaught --enable-logging --files $tests_files | $ASAN_SYMBOLIZE
246243
else
247-
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
244+
if [ "${{ inputs.target-arch }}" = "arm" ]; then
245+
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --skipYarnInstall --runners=main --trace-uncaught --enable-logging --files $tests_files
246+
else
247+
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn.js test --runners=main --trace-uncaught --enable-logging --files $tests_files
248+
fi
249+
248250
fi
249251
fi
250252
- name: Upload Test results to Datadog
@@ -256,9 +258,10 @@ jobs:
256258
DD_TAGS: "os.architecture:${{ inputs.target-arch }},os.family:${{ inputs.target-platform }},os.platform:${{ inputs.target-platform }},asan:${{ inputs.is-asan }}"
257259
run: |
258260
if ! [ -z $DD_API_KEY ] && [ -f src/electron/junit/test-results-main.xml ]; then
259-
export DATADOG_PATH=`node src/electron/script/yarn global bin`
260-
$DATADOG_PATH/datadog-ci junit upload src/electron/junit/test-results-main.xml
261-
fi
261+
cd src/electron
262+
export DATADOG_PATH=`node script/yarn.js bin datadog-ci`
263+
$DATADOG_PATH junit upload junit/test-results-main.xml
264+
fi
262265
if: always() && !cancelled()
263266
- name: Upload Test Artifacts
264267
if: always() && !cancelled()

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ ts-gen
5353
patches/mtime-cache.json
5454

5555
spec/fixtures/logo.png
56+
57+
.yarn/install-state.gz

0 commit comments

Comments
 (0)