electron/.circleci/config.yml
Jeremy Apthorp 0efb5853d6 build: [gn] centralize GN args under build/args/*.gn
Devs can still locally override or add settings by adding lines after
the `import` statement in args.gn.

This will help make sure that everyone has a common set of build args,
and will allow us to update everyone's build args in git.
2018-07-25 14:24:45 -07:00

433 lines
12 KiB
YAML

notify-slack-failure: &notify-slack-failure
run:
name: Send a slack notification on failure
command: |
if [ "$NIGHTLY_BUILD" == "true" ]; then
export MESSAGE="Build failed for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build."
curl -g -H "Content-Type: application/json" -X POST \
-d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"#FC5C3C\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK
fi
when: on_fail
notify-slack-success: &notify-slack-success
run:
name: Send a slack notification on success
command: |
if [ "$NIGHTLY_BUILD" == "true" ]; then
export MESSAGE="Build succeeded for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build."
curl -g -H "Content-Type: application/json" -X POST \
-d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"good\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK
fi
when: on_success
build-steps: &build-steps
steps:
- checkout
- run:
name: Install Node.js 10 on MacOS
command: |
if [ "$INSTALL_MACOS_NODE" == "true" ]; then
echo 'Installing Node.js 10 for MacOS'
brew update
brew install node@10
fi
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 UPLOAD_TO_S3=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo "Bootstrapping Electron for release build for $TARGET_ARCH"
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo "Bootstrapping Electron for debug build for $TARGET_ARCH"
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run:
name: Lint
command: npm run lint
- run:
name: Build
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Building Electron for release'
script/build.py -c R
else
echo 'Building Electron for debug'
script/build.py -c D
fi
- run:
name: Create distribution
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Creating Electron release distribution'
script/create-dist.py
else
echo 'Skipping create distribution because build is not for release'
fi
- run:
name: Upload distribution
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$UPLOAD_TO_S3" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$UPLOAD_TO_S3" == "1" ]; then
echo 'Uploading Electron release distribution to s3'
script/upload.py --upload_to_s3
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Setup for headless testing
command: |
if [ "$RUN_HEADLESS_TESTS" == "true" ]; then
echo 'Setup for headless testing'
sh -e /etc/init.d/xvfb start
else
echo 'Headless testing not needed'
fi
- run:
name: Test
environment:
MOCHA_FILE: junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
command: |
if [ "$RUN_TESTS" == "true" ]; then
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Testing Electron debug build'
mkdir junit
script/test.py --ci --rebuild_native_modules
else
if [ "$UPLOAD_TO_S3" == "1" ]; then
echo 'Testing Electron release build'
mkdir junit
script/test.py --ci --rebuild_native_modules -c R
else
echo 'Skipping tests on GitHub release'
fi
fi
else
echo 'Skipping tests due to configuration'
fi
- run:
name: Verify FFmpeg
command: |
if [ "$RUN_TESTS" == "true" ]; then
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
echo 'Verifying ffmpeg on release build'
script/verify-ffmpeg.py -R
fi
else
echo 'Skipping tests due to configuration'
fi
- run:
name: Generate Typescript Definitions
command: |
if [ "$CREATE_TYPESCRIPT_DEFS" == "true" ]; then
npm run create-typescript-definitions
fi
- <<: *notify-slack-failure
- <<: *notify-slack-success
- persist_to_workspace:
root: out
paths:
- "*"
- store_test_results:
path: junit
- store_artifacts:
path: junit
- store_artifacts:
path: out
build-defaults: &build-defaults
docker:
- image: electronbuilds/electron:0.0.8
<<: *build-steps
version: 2
jobs:
electron-linux-arm:
environment:
TARGET_ARCH: arm
<<: *build-defaults
resource_class: 2xlarge
electron-linux-arm-test:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace/project/out
- checkout
- run:
name: Test in ARM docker container
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker run -it \
--mount type=bind,source=/tmp/workspace,target=/tmp/workspace \
--rm electronbuilds/electronarm7:0.0.5 > version.txt
cat version.txt
if grep -q `script/get-version.py` version.txt; then
echo "Versions match"
else
echo "Versions do not match"
exit 1
fi
else
echo "Skipping test for release build"
fi
electron-linux-arm-release-nightly:
environment:
TARGET_ARCH: arm
RUN_RELEASE_BUILD: true
NIGHTLY_BUILD: true
<<: *build-defaults
resource_class: 2xlarge
electron-linux-arm64:
environment:
TARGET_ARCH: arm64
<<: *build-defaults
resource_class: 2xlarge
electron-linux-arm64-test:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace/project/out
- checkout
- run:
name: Test in ARM64 docker container
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker run -it \
--mount type=bind,source=/tmp/workspace,target=/tmp/workspace \
--rm electronbuilds/electronarm64:0.0.6 > version.txt
cat version.txt
if grep -q `script/get-version.py` version.txt; then
echo "Versions match"
else
echo "Versions do not match"
exit 1
fi
else
echo "Skipping test for release build"
fi
electron-linux-arm64-release-nightly:
environment:
TARGET_ARCH: arm64
RUN_RELEASE_BUILD: true
NIGHTLY_BUILD: true
<<: *build-defaults
resource_class: 2xlarge
electron-linux-ia32:
environment:
TARGET_ARCH: ia32
DISPLAY: ':99.0'
RUN_TESTS: true
RUN_HEADLESS_TESTS: true
<<: *build-defaults
resource_class: xlarge
electron-linux-ia32-release-nightly:
environment:
TARGET_ARCH: ia32
RUN_RELEASE_BUILD: true
NIGHTLY_BUILD: true
<<: *build-defaults
resource_class: xlarge
electron-linux-mips64el:
environment:
TARGET_ARCH: mips64el
<<: *build-defaults
resource_class: xlarge
electron-linux-x64:
environment:
TARGET_ARCH: x64
DISPLAY: ':99.0'
RUN_TESTS: true
RUN_HEADLESS_TESTS: true
CREATE_TYPESCRIPT_DEFS: true
<<: *build-defaults
resource_class: xlarge
electron-linux-x64-release-nightly:
environment:
TARGET_ARCH: x64
RUN_RELEASE_BUILD: true
NIGHTLY_BUILD: true
<<: *build-defaults
resource_class: xlarge
electron-osx-x64:
environment:
TARGET_ARCH: x64
RUN_TESTS: true
INSTALL_MACOS_NODE: true
macos:
xcode: "8.3.3"
<<: *build-steps
electron-osx-x64-release-nightly:
environment:
TARGET_ARCH: x64
RUN_RELEASE_BUILD: true
INSTALL_MACOS_NODE: true
NIGHTLY_BUILD: true
macos:
xcode: "8.3.3"
<<: *build-steps
electron-mas-x64:
environment:
TARGET_ARCH: x64
MAS_BUILD: 1
RUN_TESTS: true
INSTALL_MACOS_NODE: true
macos:
xcode: "8.3.3"
<<: *build-steps
electron-mas-x64-release-nightly:
environment:
TARGET_ARCH: x64
MAS_BUILD: 1
RUN_RELEASE_BUILD: true
INSTALL_MACOS_NODE: true
NIGHTLY_BUILD: true
macos:
xcode: "8.3.3"
<<: *build-steps
electron-linux-gn-fyi:
environment:
DISPLAY: ':99.0'
docker:
- image: electronbuilds/electron:0.0.8
resource_class: 2xlarge
steps:
- run:
name: Setup depot tools
command: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo 'export PATH=$PATH:`pwd`/depot_tools' >> $BASH_ENV
- checkout:
path: src/electron
- restore_cache:
paths:
- ~/.gclient-cache
keys:
- v1-gclient-cache-{{ checksum "src/electron/DEPS" }}
- v1-gclient-cache-
- run:
name: Gclient sync
command: |
gclient config \
--name "src/electron" \
--unmanaged \
--cache-dir "$HOME/.gclient-cache" \
"$CIRCLE_REPOSITORY_URL"
gclient sync --with_branch_heads --with_tags
- save_cache:
paths:
- ~/.gclient-cache
key: v1-gclient-cache-{{ checksum "src/electron/DEPS" }}
- run:
name: GN gen
command: |
cd src
echo 'export SCCACHE_WRAPPER="'`pwd`'/libchromiumcontent/tools/sccache/aad2120/linux/sccache"' >> $BASH_ENV
echo 'export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools' >> $BASH_ENV
source $BASH_ENV
gn gen out/Default --args='import("//electron/build/args/debug.gn")'
- run:
name: Ninja build
command: |
cd src
ninja -C out/Default electron:electron_app
- run:
name: Check sccache stats after build
command: $SCCACHE_WRAPPER -s
- run:
name: Setup for headless testing
command: |
sh -e /etc/init.d/xvfb start
- run:
name: Test
environment:
MOCHA_REPORTER: mocha-junit-reporter
MOCHA_FILE: junit/test-results.xml
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: |
cd src
ninja -C out/Default electron/build/node:headers
export npm_config_nodedir="$PWD/out/Default/gen/node_headers"
(cd electron/spec && npm install)
./out/Default/electron electron/spec --ci --enable-logging
- store_test_results:
path: src/junit
- store_artifacts:
path: src/junit
workflows:
version: 2
build-arm:
jobs:
- electron-linux-arm
- electron-linux-arm-test:
requires:
- electron-linux-arm
build-arm64:
jobs:
- electron-linux-arm64
- electron-linux-arm64-test:
requires:
- electron-linux-arm64
build-ia32:
jobs:
- electron-linux-ia32
build-x64:
jobs:
- electron-linux-x64
build-osx-x64:
jobs:
- electron-osx-x64
build-mas-x64:
jobs:
- electron-mas-x64
build-gn-linux:
jobs:
- electron-linux-gn-fyi
nightly-release-test:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
- 2-0-x
- 1-8-x
- 1-7-x
jobs:
- electron-linux-arm-release-nightly
- electron-linux-arm64-release-nightly
- electron-linux-ia32-release-nightly
- electron-linux-x64-release-nightly