electron/.circleci/config.yml

423 lines
13 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:
- 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
echo 'export GIT_CACHE_PATH="$HOME/.gclient-cache"' >> $BASH_ENV
- checkout:
path: src/electron
- restore_cache:
paths:
- ~/.gclient-cache
keys:
- v1-gclient-cache-{{ arch }}-{{ checksum "src/electron/DEPS" }}
- v1-gclient-cache-{{ arch }}-
- run:
name: Gclient sync
command: |
gclient config \
--name "src/electron" \
--unmanaged \
$GCLIENT_EXTRA_ARGS \
"$CIRCLE_REPOSITORY_URL"
gclient sync --with_branch_heads --with_tags
- save_cache:
paths:
- ~/.gclient-cache
key: v1-gclient-cache-{{ arch }}-{{ checksum "src/electron/DEPS" }}
- run:
name: GN gen
command: |
cd src
SCCACHE_PATH="$PWD/electron/external_binaries/sccache"
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/buildtools"' >> $BASH_ENV
echo 'export SCCACHE_WRAPPER="'"$SCCACHE_PATH"'"' >> $BASH_ENV
source $BASH_ENV
gn gen out/Default --args='import("'$GN_CONFIG'") cc_wrapper="'"$SCCACHE_PATH"'"'" $GN_EXTRA_ARGS"
- run:
name: Ninja build
command: |
cd src
ninja -C out/Default electron:electron_app
- run:
name: ffmpeg GN gen
command: |
if [ "$BUILD_FFMPEG" == "true" ]; then
cd src
gn gen out/ffmpeg --args='import("//electron/build/args/ffmpeg.gn") cc_wrapper="'"$SCCACHE_PATH"'"'" $GN_EXTRA_ARGS"
fi
- run:
name: Non proprietary ffmpeg build
command: |
if [ "$BUILD_FFMPEG" == "true" ]; then
cd src
ninja -C out/ffmpeg third_party/ffmpeg
fi
- run:
name: native mksnapshot GN gen
command: |
if [ "$BUILD_NATIVE_MKSNAPSHOT" == "true" ]; then
cd src
gn gen out/native_mksnapshot --args='import("//electron/build/args/native_mksnapshot.gn") cc_wrapper="'"$SCCACHE_PATH"'" v8_snapshot_toolchain="'"$MKSNAPSHOT_TOOLCHAIN"'"'" $GN_EXTRA_ARGS"
fi
- run:
name: native mksnapshot (arm/arm64) build
command: |
if [ "$BUILD_NATIVE_MKSNAPSHOT" == "true" ]; then
cd src
ninja -C out/native_mksnapshot v8:mksnapshot
fi
- run:
name: Build dist.zip
command: |
cd src
ninja -C out/Default electron:electron_dist_zip
- 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: Verify ffmpeg
command: |
if [ "$RUN_TESTS" != "false" ] && [ "$BUILD_FFMPEG" == "true" ]; then
python src/electron/script/verify-ffmpeg.py --build-dir out/Default --source-root "$PWD/src" --ffmpeg-path out/ffmpeg
fi
- run:
name: Test
environment:
MOCHA_REPORTER: mocha-junit-reporter
MOCHA_FILE: junit/test-results.xml
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: |
if [ "$RUN_TESTS" != "false" ]; then
cd src
ninja -C out/Default third_party/electron_node:headers
export npm_config_nodedir="$PWD/out/Default/gen/node_headers"
(cd electron/spec && npm install)
python electron/script/lib/dbus_mock.py ./out/Default/electron electron/spec --ci --enable-logging
fi
- <<: *notify-slack-failure
- <<: *notify-slack-success
- store_test_results:
path: src/junit
- store_artifacts:
path: src/junit
- store_artifacts:
path: src/out/Default/dist.zip
- store_artifacts:
path: src/out/ffmpeg/libffmpeg.dylib
- store_artifacts:
path: src/out/ffmpeg/libffmpeg.so
- store_artifacts:
path: src/out/native_mksnapshot/mksnapshot
mac-build-steps: &mac-build-steps
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
echo 'export GIT_CACHE_PATH="$HOME/.gclient-cache"' >> $BASH_ENV
- run:
name: Install Node.js 10 on MacOS
command: |
echo 'Installing Node.js 10 for MacOS'
brew update
brew install node@10
brew install gnu-tar
echo 'export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"' >> $BASH_ENV
- checkout:
path: src/electron
- run:
name: Gclient sync
command: |
gclient config \
--name "src/electron" \
--unmanaged \
$GCLIENT_EXTRA_ARGS \
"$CIRCLE_REPOSITORY_URL"
gclient sync --with_branch_heads --with_tags
- run:
name: GN gen
command: |
cd src
SCCACHE_PATH="$PWD/libchromiumcontent/tools/sccache/aad2120/mac/sccache"
echo 'export SCCACHE_WRAPPER="'"$SCCACHE_PATH"'"' >> $BASH_ENV
echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/buildtools"' >> $BASH_ENV
source $BASH_ENV
gn gen out/Default --args='import("'$GN_CONFIG'") cc_wrapper="'"$SCCACHE_PATH"'"'" $GN_EXTRA_ARGS"
- run:
name: Ninja build
command: |
cd src
ninja -C out/Default electron:electron_app
- run:
name: Build dist.zip
command: |
cd src
ninja -C out/Default electron:electron_dist_zip
- run:
name: Check sccache stats after build
command: $SCCACHE_WRAPPER -s
- run:
name: Test
environment:
MOCHA_REPORTER: mocha-junit-reporter
MOCHA_FILE: junit/test-results.xml
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: |
if [ "$RUN_TESTS" != "false" ]; then
cd src
ninja -C out/Default third_party/electron_node:headers
export npm_config_nodedir="$PWD/out/Default/gen/node_headers"
(cd electron/spec && npm install)
./out/Default/Electron.app/Contents/MacOS/Electron electron/spec --ci --enable-logging
fi
- <<: *notify-slack-failure
- <<: *notify-slack-success
- store_test_results:
path: src/junit
- store_artifacts:
path: src/junit
- store_artifacts:
path: src/out/Default/dist.zip
linux-build-machine: &linux-build-machine
docker:
- image: electronbuilds/electron:0.0.8
resource_class: 2xlarge
mac-build-machine: &mac-build-machine
macos:
xcode: "8.3.3"
resource_class: large
version: 2
jobs:
electron-linux-x64-debug:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/debug.gn
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-x64-testing:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/testing.gn
BUILD_FFMPEG: true
<<: *linux-build-machine
<<: *build-steps
electron-linux-x64-release:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/release.gn
BUILD_FFMPEG: true
NIGHTLY_BUILD: true
<<: *linux-build-machine
<<: *build-steps
electron-linux-ia32-debug:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/debug.gn
GN_EXTRA_ARGS: 'target_cpu = "x86"'
NPM_CONFIG_ARCH: ia32
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-ia32-testing:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/testing.gn
GN_EXTRA_ARGS: 'target_cpu = "x86"'
NPM_CONFIG_ARCH: ia32
BUILD_FFMPEG: true
<<: *linux-build-machine
<<: *build-steps
electron-linux-ia32-release:
environment:
DISPLAY: ':99.0'
GN_CONFIG: //electron/build/args/release.gn
GN_EXTRA_ARGS: 'target_cpu = "x86"'
NPM_CONFIG_ARCH: ia32
BUILD_FFMPEG: true
NIGHTLY_BUILD: true
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm-debug:
environment:
GN_CONFIG: //electron/build/args/debug.gn
GN_EXTRA_ARGS: 'target_cpu = "arm"'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm-testing:
environment:
GN_CONFIG: //electron/build/args/testing.gn
GN_EXTRA_ARGS: 'target_cpu = "arm"'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm-release:
environment:
GN_CONFIG: //electron/build/args/release.gn
GN_EXTRA_ARGS: 'target_cpu = "arm"'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
RUN_TESTS: false
BUILD_FFMPEG: true
BUILD_NATIVE_MKSNAPSHOT: true
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm
NIGHTLY_BUILD: true
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm64-debug:
environment:
GN_CONFIG: //electron/build/args/debug.gn
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm64-testing:
environment:
GN_CONFIG: //electron/build/args/testing.gn
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
RUN_TESTS: false
<<: *linux-build-machine
<<: *build-steps
electron-linux-arm64-release:
environment:
GN_CONFIG: //electron/build/args/release.gn
GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
RUN_TESTS: false
BUILD_FFMPEG: true
BUILD_NATIVE_MKSNAPSHOT: true
MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64
NIGHTLY_BUILD: true
<<: *linux-build-machine
<<: *build-steps
electron-osx-release:
environment:
GN_CONFIG: //electron/build/args/release.gn
RUN_TESTS: true
NIGHTLY_BUILD: true
<<: *mac-build-machine
<<: *mac-build-steps
electron-osx-testing:
environment:
GN_CONFIG: //electron/build/args/testing.gn
RUN_TESTS: true
<<: *mac-build-machine
<<: *mac-build-steps
electron-osx-debug:
environment:
GN_CONFIG: //electron/build/args/debug.gn
RUN_TESTS: false
<<: *mac-build-machine
<<: *mac-build-steps
electron-mas-release:
environment:
GN_CONFIG: //electron/build/args/release.gn
RUN_TESTS: true
GN_EXTRA_ARGS: 'is_mas_build = true'
NIGHTLY_BUILD: true
<<: *mac-build-machine
<<: *mac-build-steps
electron-mas-testing:
environment:
GN_CONFIG: //electron/build/args/testing.gn
RUN_TESTS: true
GN_EXTRA_ARGS: 'is_mas_build = true'
<<: *mac-build-machine
<<: *mac-build-steps
electron-mas-debug:
environment:
GN_CONFIG: //electron/build/args/debug.gn
RUN_TESTS: false
GN_EXTRA_ARGS: 'is_mas_build = true'
<<: *mac-build-machine
<<: *mac-build-steps
workflows:
version: 2
build-linux:
jobs:
- electron-linux-x64-debug
- electron-linux-x64-testing
- electron-linux-ia32-debug
- electron-linux-ia32-testing
- electron-linux-arm-debug
- electron-linux-arm-testing
- electron-linux-arm64-debug
- electron-linux-arm64-testing
build-mac:
jobs:
- electron-mas-debug
- electron-mas-testing
- electron-osx-debug
- electron-osx-testing
nightly-release-test:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- electron-linux-x64-release
- electron-linux-ia32-release
- electron-linux-arm-release
- electron-linux-arm64-release
- electron-mas-release
- electron-osx-release