mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
build: fix linux tests (#42496)
* build: use runuser for electron spec runner * chown * run tests in priv * fixed * build: setup testing on arm for GHA * no build-tools for test * start xvfb for the right user * no more gn-build-type * debug env * ue xvfb-run * use 8 core for node tests * build: do test sharding on linux * fix: disable hung node test * build: index splits are hard * build: use --init to reap children * allow write junit * use custom xvfb wrapper * pipefail * dont kill xvfb, its already dead --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
@@ -20,11 +20,6 @@ on:
|
||||
description: 'JSON container information for aks runs-on'
|
||||
required: false
|
||||
default: '{"image":null}'
|
||||
gn-build-type:
|
||||
description: 'The gn build type - testing or release'
|
||||
required: true
|
||||
type: string
|
||||
default: testing
|
||||
|
||||
concurrency:
|
||||
group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
|
||||
@@ -42,16 +37,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build-type: ${{ inputs.target-platform == 'macos' && fromJSON('["darwin","mas"]') || fromJSON('["linux"]') }}
|
||||
shard: ${{ inputs.target-platform == 'macos' && fromJSON('[1]') || fromJSON('[1, 2, 3]') }}
|
||||
env:
|
||||
BUILD_TYPE: ${{ matrix.build-type }}
|
||||
TARGET_ARCH: ${{ inputs.target-arch }}
|
||||
steps:
|
||||
- name: Load Build Tools
|
||||
run: |
|
||||
export BUILD_TOOLS_SHA=ef894bc3cfa99d84a3b731252da0f83f500e4032
|
||||
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
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
||||
with:
|
||||
@@ -103,9 +93,6 @@ jobs:
|
||||
# sudo security authorizationdb write com.apple.trust-settings.admin allow
|
||||
# cd src/electron
|
||||
# ./script/codesign/generate-identity.sh
|
||||
- name: Setup for headless testing
|
||||
if: ${{ inputs.target-platform == 'linux' }}
|
||||
run: sh -e /etc/init.d/xvfb start
|
||||
- name: Run Electron Tests
|
||||
env:
|
||||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
@@ -113,9 +100,21 @@ jobs:
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
DISPLAY: ':99.0'
|
||||
run: |
|
||||
cd src/electron
|
||||
node script/yarn test --runners=main --trace-uncaught --enable-logging
|
||||
# Get which tests are on this shard
|
||||
tests_files=$(node script/split-tests ${{ matrix.shard }} ${{ inputs.target-platform == 'macos' && 1 || 3 }})
|
||||
|
||||
# Run tests
|
||||
if [ "`uname`" = "Darwin" ]; then
|
||||
node script/yarn test --runners=main --trace-uncaught --enable-logging
|
||||
else
|
||||
chown :builduser .. && chmod g+w ..
|
||||
chown -R :builduser . && chmod -R g+w .
|
||||
chmod 4755 ../out/Default/chrome-sandbox
|
||||
runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files
|
||||
fi
|
||||
- name: Wait for active SSH sessions
|
||||
if: always() && !cancelled()
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user