Skip to content

Commit

Permalink
ci: run linux arm tests on CircleCI (#29833)
Browse files Browse the repository at this point in the history
* ci: run linux arm tests on CircleCI

(cherry picked from commit c0d93a1)

* cleanup electron dirs after testing

* use start-stop-daemon to kill Xvfb

(cherry picked from commit 1d10a68)

* actually call cleanup step

* Save cross arch snapshots to workspace

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
  • Loading branch information
trop[bot] and jkleinsc committed Jun 28, 2021
1 parent b16d453 commit 810d8bd
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 26 deletions.
105 changes: 80 additions & 25 deletions .circleci/config.yml
Expand Up @@ -57,6 +57,16 @@ parameters:
type: boolean
default: false

# Executors
executors:
linux-arm:
resource_class: electronjs/linux-arm
machine: true

linux-arm64:
resource_class: electronjs/linux-arm64
machine: true

# The config expects the following environment variables to be set:
# - "SLACK_WEBHOOK" Slack hook URL to send notifications.
#
Expand Down Expand Up @@ -225,6 +235,25 @@ step-maybe-notify-slack-success: &step-maybe-notify-slack-success
fi
when: on_success

step-maybe-cleanup-arm: &step-maybe-cleanup-arm
run:
name: Cleanup after testing
command: |
if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
killall Electron || echo "No Electron processes left running"
killall Safari || echo "No Safari processes left running"
rm -rf ~/Library/Application\ Support/Electron*
rm -rf ~/Library/Application\ Support/electron*
elif [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
XVFB=/usr/bin/Xvfb
/sbin/start-stop-daemon --stop --exec $XVFB || echo "Xvfb not running"
pkill electron || echo "electron not running"
rm -rf ~/.config/Electron*
rm -rf ~/.config/electron*
fi
when: always

step-checkout-electron: &step-checkout-electron
checkout:
path: src/electron
Expand Down Expand Up @@ -672,6 +701,7 @@ step-persist-data-for-tests: &step-persist-data-for-tests
- src/electron
- src/third_party/electron_node
- src/third_party/nan
- src/cross-arch-snapshots

step-electron-dist-unzip: &step-electron-dist-unzip
run:
Expand Down Expand Up @@ -734,7 +764,11 @@ step-verify-mksnapshot: &step-verify-mksnapshot
name: Verify mksnapshot
command: |
cd src
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/cross-arch-snapshots
else
python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
fi
step-verify-chromedriver: &step-verify-chromedriver
run:
Expand Down Expand Up @@ -861,23 +895,6 @@ step-maybe-cross-arch-snapshot-store: &step-maybe-cross-arch-snapshot-store
path: src/cross-arch-snapshots
destination: cross-arch-snapshots

step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test
run:
name: Trigger an arm test on VSTS if applicable
command: |
cd src
# Only run for non-fork prs
if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
#Trigger VSTS job, passing along CircleCI job number and branch to build
if [ "`uname`" == "Darwin" ]; then
echo "Triggering electron-arm2-testing build on Azure DevOps"
node electron/script/release/ci-release-build.js --job=electron-arm2-testing --ci=DevOps --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
else
echo "Triggering electron-$TARGET_ARCH-testing build on VSTS"
node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
fi
fi
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
run:
name: Generate type declarations
Expand Down Expand Up @@ -1292,8 +1309,14 @@ steps-tests: &steps-tests
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: |
cd src
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split))
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split))
if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging)
else
(cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split))
(cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split))
fi
- run:
name: Check test results existence
command: |
Expand All @@ -1314,6 +1337,8 @@ steps-tests: &steps-tests

- *step-maybe-notify-slack-failure

- *step-maybe-cleanup-arm

steps-test-nan: &steps-test-nan
steps:
- attach_workspace:
Expand Down Expand Up @@ -1589,9 +1614,6 @@ commands:
steps:
- *step-save-out-cache

# Trigger tests on arm hardware if needed
- *step-maybe-trigger-arm-test

- *step-maybe-notify-slack-failure

electron-publish:
Expand Down Expand Up @@ -1919,7 +1941,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- electron-build:
persist: false
persist: true
checkout: true
use-out-cache: false

Expand Down Expand Up @@ -1977,7 +1999,7 @@ jobs:
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- electron-build:
persist: false
persist: true
checkout: true
use-out-cache: false

Expand Down Expand Up @@ -2365,6 +2387,24 @@ jobs:
<<: *env-send-slack-notifications
<<: *steps-verify-ffmpeg

linux-arm-testing-tests:
executor: linux-arm
environment:
<<: *env-arm
<<: *env-global
<<: *env-headless-testing
<<: *env-stack-dumping
<<: *steps-tests

linux-arm64-testing-tests:
executor: linux-arm64
environment:
<<: *env-arm64
<<: *env-global
<<: *env-headless-testing
<<: *env-stack-dumping
<<: *steps-tests

osx-testing-x64-tests:
<<: *machine-mac-large
environment:
Expand Down Expand Up @@ -2597,8 +2637,23 @@ workflows:
- linux-ia32-testing

- linux-arm-testing
- linux-arm-testing-tests:
filters:
branches:
# Do not run this on forked pull requests
ignore: /pull\/[0-9]+/
requires:
- linux-arm-testing

- linux-arm64-testing
- linux-arm64-testing-tests:
filters:
branches:
# Do not run this on forked pull requests
ignore: /pull\/[0-9]+/
requires:
- linux-arm64-testing

- linux-arm64-testing-gn-check:
requires:
- linux-checkout-fast
Expand Down
2 changes: 1 addition & 1 deletion spec-main/version-bump-spec.ts
Expand Up @@ -43,7 +43,7 @@ describe('version-bumper', () => {

// On macOS Circle CI we don't have a real git environment due to running
// gclient sync on a linux machine. These tests therefore don't run as expected.
ifdescribe(!(process.platform === 'linux' && process.arch === 'arm') && process.platform !== 'darwin')('nextVersion', () => {
ifdescribe(!(process.platform === 'linux' && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g;
const betaPattern = /[0-9.]*(-beta[0-9.]*)/g;

Expand Down

0 comments on commit 810d8bd

Please sign in to comment.