diff --git a/.circleci/config.yml b/.circleci/config.yml index a29d5d04f09a8..e55bebecfbb1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,11 @@ machine-mac: &machine-mac macos: xcode: "8.3.3" +machine-mac-large: &machine-mac-large + resource_class: large + macos: + xcode: "8.3.3" + # Build configurations options. env-debug-build: &env-debug-build GN_CONFIG: //electron/build/args/debug.gn @@ -34,6 +39,7 @@ env-testing-build: &env-testing-build env-release-build: &env-release-build GN_CONFIG: //electron/build/args/release.gn STRIP_BINARIES: true + GENERATE_SYMBOLS: true env-headless-testing: &env-headless-testing DISPLAY: ':99.0' @@ -71,6 +77,7 @@ env-arm64: &env-arm64 env-mas: &env-mas GN_EXTRA_ARGS: 'is_mas_build = true' + MAS_BUILD: 'true' # Misc build configuration options. env-enable-sccache: &env-enable-sccache @@ -79,6 +86,21 @@ env-enable-sccache: &env-enable-sccache env-send-slack-notifications: &env-send-slack-notifications NOTIFY_SLACK: true +env-linux-medium: &env-linux-medium + NUMBER_OF_NINJA_PROCESSES: 3 + +env-linux-2xlarge: &env-linux-2xlarge + NUMBER_OF_NINJA_PROCESSES: 18 + +env-machine-mac: &env-machine-mac + NUMBER_OF_NINJA_PROCESSES: 6 + +env-mac-large: &env-mac-large + NUMBER_OF_NINJA_PROCESSES: 10 + +env-disable-crash-reporter-tests: &env-disable-crash-reporter-tests + DISABLE_CRASH_REPORTER_TESTS: true + # Individual (shared) steps. step-maybe-notify-slack-failure: &step-maybe-notify-slack-failure run: @@ -147,6 +169,13 @@ step-setup-env-for-build: &step-setup-env-for-build fi fi +step-restore-brew-cache: &step-restore-brew-cache + restore_cache: + paths: + - /usr/local/Homebrew + keys: + - v1-brew-cache-{{ arch }} + step-install-nodejs-on-mac: &step-install-nodejs-on-mac run: name: Install Node.js 10 on MacOS @@ -157,6 +186,44 @@ step-install-nodejs-on-mac: &step-install-nodejs-on-mac echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> $BASH_ENV fi +# On macOS the npm install command during gclient sync was run on a linux +# machine and therefore installed a slightly different set of dependencies +# Notably "fsevents" is a macOS only dependency, we rerun npm install once +# we are on a macOS machine to get the correct state +step-install-npm-deps-on-mac: &step-install-npm-deps-on-mac + run: + name: Install NPM Dependencies on MacOS + command: | + if [ "`uname`" == "Darwin" ]; then + cd src/electron + npm install + fi + +# This step handles the differences between the linux "gclient sync" +# and the expected state on macOS +step-fix-sync-on-mac: &step-fix-sync-on-mac + run: + name: Fix Sync on macOS + command: | + if [ "`uname`" == "Darwin" ]; then + # Fix Clang Install (wrong binary) + rm -rf src/third_party/llvm-build + python src/tools/clang/scripts/update.py + # Fix Framework Header Installs (symlinks not retained) + rm -rf src/electron/external_binaries + python src/electron/script/update-external-binaries.py + fi + +step-install-gnutar-on-mac: &step-install-gnutar-on-mac + run: + name: Install gnu-tar on macos + command: | + if [ "`uname`" == "Darwin" ]; then + brew update + brew install gnu-tar + ln -fs /usr/local/bin/gtar /usr/local/bin/tar + fi + step-gn-gen-default: &step-gn-gen-default run: name: Default GN gen @@ -170,13 +237,13 @@ step-electron-build: &step-electron-build no_output_timeout: 30m command: | cd src - ninja -C out/Default electron -j18 + ninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES step-maybe-electron-dist-strip: &step-maybe-electron-dist-strip run: name: Strip electron binaries command: | - if [ "$STRIP_BINARIES" == "true" ]; then + if [ "$STRIP_BINARIES" == "true" ] && [ "`uname`" != "Darwin" ]; then cd src electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" fi @@ -198,9 +265,7 @@ step-electron-chromedriver-build: &step-electron-chromedriver-build name: Build chromedriver.zip command: | cd src - # NOTE(alexeykuzmin): -j3 because chromedriver is currently built - # on a smaller size machine and ninja mis-detects the number of CPUs available. - ninja -C out/Default chrome/test/chromedriver -j3 + ninja -C out/Default chrome/test/chromedriver -j $NUMBER_OF_NINJA_PROCESSES electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/out/Default/chromedriver ninja -C out/Default electron:electron_chromedriver_zip @@ -238,14 +303,11 @@ step-persist-data-for-tests: &step-persist-data-for-tests persist_to_workspace: root: . paths: - # To run `gn args` for that dir from the "verify-ffmpeg" script. - - src/out/Default/args.gn - - src/out/Default/build.ninja - # Build artifacts - src/out/Default/dist.zip - src/out/Default/mksnapshot.zip - src/out/Default/gen/node_headers + - src/out/ffmpeg/ffmpeg.zip step-electron-dist-unzip: &step-electron-dist-unzip run: @@ -256,6 +318,13 @@ step-electron-dist-unzip: &step-electron-dist-unzip # TODO(alexeykuzmin): Remove '-o' when it's no longer needed. unzip -o dist.zip +step-ffmpeg-unzip: &step-ffmpeg-unzip + run: + name: Unzip ffmpeg.zip + command: | + cd src/out/ffmpeg + unzip -o ffmpeg.zip + step-mksnapshot-unzip: &step-mksnapshot-unzip run: name: Unzip mksnapshot.zip @@ -275,9 +344,7 @@ step-ffmpeg-build: &step-ffmpeg-build name: Non proprietary ffmpeg build command: | cd src - # NOTE(jeremy): -j3 because ffmpeg is currently built on a smaller - # machine size and ninja mis-detects the number of CPUs available. - ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j3 + ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES step-verify-ffmpeg: &step-verify-ffmpeg run: @@ -328,33 +395,35 @@ step-mksnapshot-build: &step-mksnapshot-build electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot fi fi - # NOTE(jeremy): -j3 because mksnapshot is currently built on a smaller - # machine size and ninja mis-detects the number of CPUs available. - ninja -C out/Default electron:electron_mksnapshot_zip -j3 + ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES step-mksnapshot-store: &step-mksnapshot-store store_artifacts: path: src/out/Default/mksnapshot.zip destination: mksnapshot.zip -step-build-dump-syms: &step-build-dump-syms +step-maybe-build-dump-syms: &step-maybe-build-dump-syms run: name: Build dump_syms binary command: | - cd src - # Build needed dump_syms executable - ninja -C out/Default third_party/breakpad:dump_syms + if [ "$GENERATE_SYMBOLS" == "true" ]; then + cd src + # Build needed dump_syms executable + ninja -C out/Default third_party/breakpad:dump_syms + fi -step-generate-breakpad-symbols: &step-generate-breakpad-symbols +step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols run: name: Generate breakpad symbols command: | - cd src - export BUILD_PATH="$PWD/out/Default" - export DEST_PATH="$BUILD_PATH/breakpad_symbols" - electron/script/dump-symbols.py -b $BUILD_PATH -d $DEST_PATH -v + if [ "$GENERATE_SYMBOLS" == "true" ]; then + cd src + export BUILD_PATH="$PWD/out/Default" + export DEST_PATH="$BUILD_PATH/breakpad_symbols" + electron/script/dump-symbols.py -b $BUILD_PATH -d $DEST_PATH -v + fi -step-zip-symbols: &step-zip-symbols +step-maybe-zip-symbols: &step-maybe-zip-symbols run: name: Zip symbols command: | @@ -380,7 +449,7 @@ step-maybe-native-mksnapshot-build: &step-maybe-native-mksnapshot-build command: | if [ "$BUILD_NATIVE_MKSNAPSHOT" == "1" ]; then cd src - ninja -C out/native_mksnapshot electron:electron_mksnapshot_zip -j18 + ninja -C out/native_mksnapshot electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES else echo 'Skipping native mksnapshot build for non arm build' fi @@ -412,12 +481,25 @@ step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test echo "Triggering electron-$TARGET_ARCH-testing build on VSTS" node electron/script/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH fi + +step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs + run: + name: Generate type declarations + command: | + if [ "`uname`" == "Darwin" ]; then + cd src/electron + npm run create-typescript-definitions + fi + # Lists of steps. steps-checkout: &steps-checkout steps: - *step-checkout-electron - *step-depot-tools-get - *step-depot-tools-add-to-path + - *step-restore-brew-cache + - *step-install-nodejs-on-mac + - *step-install-gnutar-on-mac - restore_cache: paths: @@ -436,6 +518,10 @@ steps-checkout: &steps-checkout paths: - ~/.gclient-cache key: v1-gclient-cache-{{ arch }}-{{ checksum "src/electron/DEPS" }} + - save_cache: + paths: + - /usr/local/Homebrew + key: v1-brew-cache-{{ arch }} - run: name: Remove some unused data to avoid storing it in the workspace @@ -474,6 +560,10 @@ steps-electron-build-for-tests: &steps-electron-build-for-tests at: . - *step-depot-tools-add-to-path - *step-setup-env-for-build + - *step-restore-brew-cache + - *step-install-nodejs-on-mac + - *step-install-npm-deps-on-mac + - *step-fix-sync-on-mac - *step-gn-gen-default # Electron app @@ -506,11 +596,9 @@ steps-electron-build-for-tests: &steps-electron-build-for-tests # Save all data needed for a further tests run. - *step-persist-data-for-tests - # Breakpad symbols. - # TODO(alexeykuzmin): We should do it only in nightly builds. - - *step-build-dump-syms - - *step-generate-breakpad-symbols - - *step-zip-symbols + - *step-maybe-build-dump-syms + - *step-maybe-generate-breakpad-symbols + - *step-maybe-zip-symbols # Trigger tests on arm hardware if needed - *step-maybe-trigger-arm-test @@ -522,6 +610,8 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish - *step-checkout-electron - *step-depot-tools-get - *step-depot-tools-add-to-path + - *step-restore-brew-cache + - *step-install-nodejs-on-mac - *step-gclient-sync - *step-setup-env-for-build - *step-gn-gen-default @@ -531,9 +621,9 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish - *step-maybe-electron-dist-strip - *step-electron-dist-build - *step-electron-dist-store - - *step-build-dump-syms - - *step-generate-breakpad-symbols - - *step-zip-symbols + - *step-maybe-build-dump-syms + - *step-maybe-generate-breakpad-symbols + - *step-maybe-zip-symbols # mksnapshot - *step-mksnapshot-build @@ -558,6 +648,9 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish - *step-ffmpeg-build - *step-ffmpeg-store + # typescript defs + - *step-maybe-generate-typescript-defs + # Publish - *step-electron-publish @@ -567,6 +660,7 @@ steps-chromedriver-build: &steps-chromedriver-build at: . - *step-depot-tools-add-to-path - *step-setup-env-for-build + - *step-fix-sync-on-mac - *step-gn-gen-default - *step-electron-chromedriver-build @@ -586,26 +680,6 @@ steps-native-mksnapshot-build: &steps-native-mksnapshot-build - *step-maybe-notify-slack-failure -steps-ffmpeg-build: &steps-ffmpeg-build - steps: - - attach_workspace: - at: . - - *step-depot-tools-add-to-path - - *step-setup-env-for-build - - - *step-ffmpeg-gn-gen - - *step-ffmpeg-build - - *step-ffmpeg-store - - - persist_to_workspace: - root: . - paths: - - src/out/ffmpeg/libffmpeg.so - - src/out/ffmpeg/ffmpeg.zip - - - *step-show-sccache-stats - - *step-maybe-notify-slack-failure - steps-native-tests: &steps-native-tests steps: - attach_workspace: @@ -644,6 +718,7 @@ steps-verify-ffmpeg: &steps-verify-ffmpeg at: . - *step-depot-tools-add-to-path - *step-electron-dist-unzip + - *step-ffmpeg-unzip - *step-setup-linux-for-headless-testing - *step-verify-ffmpeg @@ -669,6 +744,7 @@ steps-tests: &steps-tests - *step-electron-dist-unzip - *step-mksnapshot-unzip - *step-setup-linux-for-headless-testing + - *step-restore-brew-cache - *step-install-nodejs-on-mac - run: @@ -681,7 +757,7 @@ steps-tests: &steps-tests command: | cd src export ELECTRON_OUT_DIR=Default - (cd electron && npm run test -- --ci) + (cd electron && npm run test -- --ci --enable-logging) - run: name: Check test results existence command: | @@ -697,64 +773,6 @@ steps-tests: &steps-tests - *step-maybe-notify-slack-failure -# Mac build are different in a few ways: -# 1. We can't use save_cache/restore_cache on Mac, -# unpacking with `tar` fails with "Attempt to write to an empty file" error. -# 2. We don't use a shared checkout job because persist_to_workspace -# and attach_workspace take too much time, more than the checkout itself. -steps-build-mac: &steps-build-mac - steps: - - *step-checkout-electron - - *step-depot-tools-get - - *step-depot-tools-add-to-path - - *step-install-nodejs-on-mac - - *step-gclient-sync - - *step-setup-env-for-build - - *step-gn-gen-default - - # Electron app - - *step-electron-build - - *step-electron-dist-build - - *step-electron-dist-store - - # mksnapshot - - *step-mksnapshot-build - - *step-mksnapshot-store - - # chromedriver - - *step-electron-chromedriver-build - - *step-electron-chromedriver-store - - # ffmpeg - - *step-ffmpeg-gn-gen - - *step-ffmpeg-build - - *step-ffmpeg-store - - # It would be better to verify ffmpeg as a part of a test job, - # but it requires `gn` to run, and it's complicated - # to store all gn's dependencies and configs. - - *step-verify-ffmpeg - - - *step-verify-mksnapshot - - # Node.js headers for tests - - *step-nodejs-headers-build - - - *step-show-sccache-stats - - - persist_to_workspace: - root: . - paths: - - src/electron - - # Save all data needed for a further tests run. - - *step-persist-data-for-tests - -filter-only-prs-from-forks: &filter-only-prs-from-forks - filters: - branches: - only: /^pull\/.*$/ - chromium-upgrade-branches: &chromium-upgrade-branches /chromium\-upgrade\/[0-9]+/ @@ -765,25 +783,36 @@ jobs: linux-checkout: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' <<: *steps-checkout linux-checkout-for-native-tests: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=checkout_pyyaml=True' <<: *steps-checkout linux-checkout-for-native-tests-with-no-patches: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=apply_patches=False --custom-var=checkout_pyyaml=True' <<: *steps-checkout + mac-checkout: + <<: *machine-linux-2xlarge + environment: + <<: *env-linux-2xlarge + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' + <<: *steps-checkout + # Layer 2: Builds. linux-x64-debug: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-debug-build <<: *env-enable-sccache <<: *steps-electron-build @@ -791,20 +820,15 @@ jobs: linux-x64-testing: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-testing-build <<: *env-enable-sccache <<: *steps-electron-build-for-tests - linux-x64-ffmpeg: - <<: *machine-linux-medium - environment: - <<: *env-enable-sccache - <<: *env-send-slack-notifications - <<: *steps-ffmpeg-build - linux-x64-chromedriver: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-release-build <<: *env-enable-sccache <<: *env-send-slack-notifications @@ -813,6 +837,7 @@ jobs: linux-x64-release: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-release-build <<: *env-enable-sccache <<: *env-send-slack-notifications @@ -821,6 +846,7 @@ jobs: linux-x64-publish: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True' <<: *env-release-build <<: *steps-electron-build-for-publish @@ -828,6 +854,7 @@ jobs: linux-ia32-debug: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-ia32 <<: *env-debug-build <<: *env-enable-sccache @@ -836,22 +863,16 @@ jobs: linux-ia32-testing: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-ia32 <<: *env-testing-build <<: *env-enable-sccache <<: *steps-electron-build-for-tests - linux-ia32-ffmpeg: - <<: *machine-linux-medium - environment: - <<: *env-ia32 - <<: *env-enable-sccache - <<: *env-send-slack-notifications - <<: *steps-ffmpeg-build - linux-ia32-chromedriver: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-ia32 <<: *env-release-build <<: *env-enable-sccache @@ -861,6 +882,7 @@ jobs: linux-ia32-release: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-ia32 <<: *env-release-build <<: *env-enable-sccache @@ -870,6 +892,7 @@ jobs: linux-ia32-publish: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True' <<: *env-ia32 <<: *env-release-build @@ -878,6 +901,7 @@ jobs: linux-arm-debug: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm <<: *env-debug-build <<: *env-enable-sccache @@ -886,23 +910,17 @@ jobs: linux-arm-testing: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm <<: *env-testing-build <<: *env-enable-sccache TRIGGER_ARM_TEST: true <<: *steps-electron-build-for-tests - linux-arm-ffmpeg: - <<: *machine-linux-medium - environment: - <<: *env-arm - <<: *env-enable-sccache - <<: *env-send-slack-notifications - <<: *steps-ffmpeg-build - linux-arm-chromedriver: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-arm <<: *env-release-build <<: *env-enable-sccache @@ -912,6 +930,7 @@ jobs: linux-arm-release: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm <<: *env-release-build <<: *env-enable-sccache @@ -921,6 +940,7 @@ jobs: linux-arm-publish: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm <<: *env-release-build GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True' @@ -929,6 +949,7 @@ jobs: linux-arm-native-mksnapshot: <<: *machine-linux-2xlarge environment: + <<: *env-linux-medium <<: *env-arm <<: *env-release-build <<: *env-enable-sccache @@ -938,6 +959,7 @@ jobs: linux-arm64-debug: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm64 <<: *env-debug-build <<: *env-enable-sccache @@ -946,23 +968,17 @@ jobs: linux-arm64-testing: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm64 <<: *env-testing-build <<: *env-enable-sccache TRIGGER_ARM_TEST: true <<: *steps-electron-build-for-tests - linux-arm64-ffmpeg: - <<: *machine-linux-medium - environment: - <<: *env-arm64 - <<: *env-enable-sccache - <<: *env-send-slack-notifications - <<: *steps-ffmpeg-build - linux-arm64-chromedriver: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-arm64 <<: *env-release-build <<: *env-enable-sccache @@ -972,6 +988,7 @@ jobs: linux-arm64-release: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm64 <<: *env-release-build <<: *env-enable-sccache @@ -981,6 +998,7 @@ jobs: linux-arm64-publish: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-arm64 <<: *env-release-build GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True' @@ -989,6 +1007,7 @@ jobs: linux-arm64-native-mksnapshot: <<: *machine-linux-2xlarge environment: + <<: *env-linux-medium <<: *env-arm64 <<: *env-release-build <<: *env-enable-sccache @@ -996,24 +1015,79 @@ jobs: <<: *steps-native-mksnapshot-build osx-testing: - <<: *machine-mac + <<: *machine-mac-large environment: + <<: *env-mac-large <<: *env-testing-build <<: *env-enable-sccache - <<: *steps-build-mac + <<: *steps-electron-build-for-tests - mas-testing: + osx-chromedriver: <<: *machine-mac environment: + <<: *env-machine-mac + <<: *env-release-build + <<: *env-enable-sccache + <<: *env-send-slack-notifications + <<: *steps-chromedriver-build + + osx-release: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-release-build + <<: *env-enable-sccache + <<: *steps-electron-build-for-tests + + osx-publish: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-release-build + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True' + <<: *steps-electron-build-for-publish + + mas-testing: + <<: *machine-mac-large + environment: + <<: *env-mac-large <<: *env-mas <<: *env-testing-build <<: *env-enable-sccache - <<: *steps-build-mac + <<: *steps-electron-build-for-tests + + mas-chromedriver: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-release-build + <<: *env-enable-sccache + <<: *env-send-slack-notifications + <<: *steps-chromedriver-build + + mas-release: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-mas + <<: *env-release-build + <<: *env-enable-sccache + <<: *steps-electron-build-for-tests + + mas-publish: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-mas + <<: *env-release-build + GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True' + <<: *steps-electron-build-for-publish # Layer 3: Tests. linux-x64-unittests: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-unittests <<: *env-enable-sccache <<: *env-headless-testing @@ -1022,6 +1096,7 @@ jobs: linux-x64-disabled-unittests: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-unittests <<: *env-enable-sccache <<: *env-headless-testing @@ -1031,6 +1106,7 @@ jobs: linux-x64-chromium-unittests: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-unittests <<: *env-enable-sccache <<: *env-headless-testing @@ -1040,6 +1116,7 @@ jobs: linux-x64-browsertests: <<: *machine-linux-2xlarge environment: + <<: *env-linux-2xlarge <<: *env-browsertests <<: *env-testing-build <<: *env-enable-sccache @@ -1049,6 +1126,7 @@ jobs: linux-x64-testing-tests: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-headless-testing <<: *env-stack-dumping <<: *steps-tests @@ -1056,6 +1134,7 @@ jobs: linux-x64-release-tests: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-headless-testing <<: *env-send-slack-notifications <<: *steps-tests @@ -1063,6 +1142,7 @@ jobs: linux-x64-verify-ffmpeg: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-headless-testing <<: *env-send-slack-notifications <<: *steps-verify-ffmpeg @@ -1070,6 +1150,7 @@ jobs: linux-x64-verify-mksnapshot: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-headless-testing <<: *env-send-slack-notifications <<: *steps-verify-mksnapshot @@ -1077,6 +1158,7 @@ jobs: linux-ia32-testing-tests: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-ia32 <<: *env-headless-testing <<: *env-stack-dumping @@ -1085,6 +1167,7 @@ jobs: linux-ia32-release-tests: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-ia32 <<: *env-headless-testing <<: *env-send-slack-notifications @@ -1093,6 +1176,7 @@ jobs: linux-ia32-verify-ffmpeg: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-ia32 <<: *env-headless-testing <<: *env-send-slack-notifications @@ -1101,49 +1185,118 @@ jobs: linux-ia32-verify-mksnapshot: <<: *machine-linux-medium environment: + <<: *env-linux-medium <<: *env-ia32 <<: *env-headless-testing <<: *env-send-slack-notifications <<: *steps-verify-mksnapshot osx-testing-tests: - <<: *machine-mac + <<: *machine-mac-large environment: + <<: *env-mac-large <<: *env-stack-dumping + <<: *env-disable-crash-reporter-tests <<: *steps-tests - mas-testing-tests: + osx-release-tests: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-stack-dumping + <<: *env-send-slack-notifications + <<: *env-disable-crash-reporter-tests + <<: *steps-tests + + osx-verify-ffmpeg: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications + <<: *steps-verify-ffmpeg + + osx-verify-mksnapshot: <<: *machine-mac environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications + <<: *steps-verify-mksnapshot + + mas-testing-tests: + <<: *machine-mac-large + environment: + <<: *env-mac-large + <<: *env-stack-dumping + <<: *steps-tests + + mas-release-tests: + <<: *machine-mac-large + environment: + <<: *env-mac-large <<: *env-stack-dumping + <<: *env-send-slack-notifications <<: *steps-tests + mas-verify-ffmpeg: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications + <<: *steps-verify-ffmpeg + + mas-verify-mksnapshot: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications + <<: *steps-verify-mksnapshot + # Layer 4: Summary. linux-x64-release-summary: <<: *machine-linux-medium environment: - - *env-send-slack-notifications + <<: *env-linux-medium + <<: *env-send-slack-notifications steps: - *step-maybe-notify-slack-success linux-ia32-release-summary: <<: *machine-linux-medium environment: - - *env-send-slack-notifications + <<: *env-linux-medium + <<: *env-send-slack-notifications steps: - *step-maybe-notify-slack-success linux-arm-release-summary: <<: *machine-linux-medium environment: - - *env-send-slack-notifications + <<: *env-linux-medium + <<: *env-send-slack-notifications steps: - *step-maybe-notify-slack-success linux-arm64-release-summary: <<: *machine-linux-medium environment: - - *env-send-slack-notifications + <<: *env-linux-medium + <<: *env-send-slack-notifications + steps: + - *step-maybe-notify-slack-success + + mas-release-summary: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications + steps: + - *step-maybe-notify-slack-success + + osx-release-summary: + <<: *machine-mac + environment: + <<: *env-machine-mac + <<: *env-send-slack-notifications steps: - *step-maybe-notify-slack-success @@ -1187,23 +1340,26 @@ workflows: requires: - linux-checkout - build-mac-fork-prs: + build-mac: jobs: + - mac-checkout - osx-testing: - <<: *filter-only-prs-from-forks + requires: + - mac-checkout + - osx-testing-tests: - <<: *filter-only-prs-from-forks requires: - osx-testing - mas-testing: - <<: *filter-only-prs-from-forks + requires: + - mac-checkout + - mas-testing-tests: - <<: *filter-only-prs-from-forks requires: - mas-testing - nightly-release-test: + nightly-linux-release-test: triggers: - schedule: cron: "0 0 * * *" @@ -1221,13 +1377,9 @@ workflows: - linux-x64-release-tests: requires: - linux-x64-release - - linux-x64-ffmpeg: - requires: - - linux-checkout - linux-x64-verify-ffmpeg: requires: - linux-x64-release - - linux-x64-ffmpeg - linux-x64-verify-mksnapshot: requires: - linux-x64-release @@ -1238,7 +1390,6 @@ workflows: requires: - linux-x64-release - linux-x64-release-tests - - linux-x64-ffmpeg - linux-x64-verify-ffmpeg - linux-x64-chromedriver @@ -1248,13 +1399,9 @@ workflows: - linux-ia32-release-tests: requires: - linux-ia32-release - - linux-ia32-ffmpeg: - requires: - - linux-checkout - linux-ia32-verify-ffmpeg: requires: - linux-ia32-release - - linux-ia32-ffmpeg - linux-ia32-verify-mksnapshot: requires: - linux-ia32-release @@ -1265,16 +1412,12 @@ workflows: requires: - linux-ia32-release - linux-ia32-release-tests - - linux-ia32-ffmpeg - linux-ia32-verify-ffmpeg - linux-ia32-chromedriver - linux-arm-release: requires: - linux-checkout - - linux-arm-ffmpeg: - requires: - - linux-checkout - linux-arm-native-mksnapshot: requires: - linux-checkout @@ -1284,16 +1427,12 @@ workflows: - linux-arm-release-summary: requires: - linux-arm-release - - linux-arm-ffmpeg - linux-arm-chromedriver - linux-arm-native-mksnapshot - linux-arm64-release: requires: - linux-checkout - - linux-arm64-ffmpeg: - requires: - - linux-checkout - linux-arm64-native-mksnapshot: requires: - linux-checkout @@ -1303,10 +1442,65 @@ workflows: - linux-arm64-release-summary: requires: - linux-arm64-release - - linux-arm64-ffmpeg - linux-arm64-chromedriver - linux-arm64-native-mksnapshot + nightly-mac-release-test: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - master + - *chromium-upgrade-branches + jobs: + - mac-checkout + + - osx-release: + requires: + - mac-checkout + - osx-release-tests: + requires: + - osx-release + - osx-verify-ffmpeg: + requires: + - osx-release + - osx-verify-mksnapshot: + requires: + - osx-release + - osx-chromedriver: + requires: + - mac-checkout + - osx-release-summary: + requires: + - osx-release + - osx-release-tests + - osx-verify-ffmpeg + - osx-chromedriver + + - mas-release: + requires: + - mac-checkout + - mas-release-tests: + requires: + - mas-release + - mas-verify-ffmpeg: + requires: + - mas-release + - mas-verify-mksnapshot: + requires: + - mas-release + - mas-chromedriver: + requires: + - mac-checkout + - mas-release-summary: + requires: + - mas-release + - mas-release-tests + - mas-verify-ffmpeg + - mas-chromedriver + # Various slow and non-essential checks we run only nightly. # Sanitizer jobs should be added here. linux-checks-nightly: diff --git a/script/ci-release-build.js b/script/ci-release-build.js index e2cee5fb63c65..eae38308a3185 100644 --- a/script/ci-release-build.js +++ b/script/ci-release-build.js @@ -14,12 +14,9 @@ const circleCIJobs = [ 'linux-arm-publish', 'linux-arm64-publish', 'linux-ia32-publish', - 'linux-x64-publish' -] - -const vstsJobs = [ - 'electron-release-mas-x64', - 'electron-release-osx-x64' + 'linux-x64-publish', + 'mas-publish', + 'osx-publish' ] const vstsArmJobs = [ @@ -136,9 +133,8 @@ function buildCircleCI (targetBranch, options) { async function buildVSTS (targetBranch, options) { if (options.armTest) { assert(vstsArmJobs.includes(options.job), `Unknown VSTS CI arm test job name: ${options.job}. Valid values are: ${vstsArmJobs}.`) - } else if (options.job) { - assert(vstsJobs.includes(options.job), `Unknown VSTS CI job name: ${options.job}. Valid values are: ${vstsJobs}.`) } + console.log(`Triggering VSTS to run build on branch: ${targetBranch} with release flag.`) const environmentVariables = { ELECTRON_RELEASE: 1 @@ -165,12 +161,7 @@ async function buildVSTS (targetBranch, options) { const vstsResponse = await makeRequest(requestOpts, true).catch(err => { console.log('Error calling VSTS to get build definitions:', err) }) - let buildsToRun = [] - if (options.job) { - buildsToRun = vstsResponse.value.filter(build => build.name === options.job) - } else { - buildsToRun = vstsResponse.value.filter(build => vstsJobs.includes(build.name)) - } + const buildsToRun = vstsResponse.value.filter(build => build.name === options.job) buildsToRun.forEach((build) => callVSTSBuild(build, targetBranch, environmentVariables)) } diff --git a/script/update-external-binaries.py b/script/update-external-binaries.py index 66a4e1b0e332d..5332548c006c9 100755 --- a/script/update-external-binaries.py +++ b/script/update-external-binaries.py @@ -11,7 +11,6 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - def parse_args(): parser = argparse.ArgumentParser( description='Download binaries for Electron build') diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index e5f6cdf2f3489..ed2842b307465 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -529,9 +529,6 @@ describe('app module', () => { }) describe('app.get/setLoginItemSettings API', function () { - // allow up to three retries to account for flaky mas results - this.retries(3) - const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe') const processStartArgs = [ '--processStart', `"${path.basename(process.execPath)}"`, @@ -554,34 +551,26 @@ describe('app module', () => { it('sets and returns the app as a login item', done => { app.setLoginItemSettings({ openAtLogin: true }) - // Wait because login item settings are not applied immediately in MAS build - const delay = process.mas ? 250 : 0 - setTimeout(() => { - expect(app.getLoginItemSettings()).to.deep.equal({ - openAtLogin: true, - openAsHidden: false, - wasOpenedAtLogin: false, - wasOpenedAsHidden: false, - restoreState: false - }) - done() - }, delay) + expect(app.getLoginItemSettings()).to.deep.equal({ + openAtLogin: true, + openAsHidden: false, + wasOpenedAtLogin: false, + wasOpenedAsHidden: false, + restoreState: false + }) + done() }) it('adds a login item that loads in hidden mode', done => { app.setLoginItemSettings({ openAtLogin: true, openAsHidden: true }) - // Wait because login item settings are not applied immediately in MAS build - const delay = process.mas ? 250 : 0 - setTimeout(() => { - expect(app.getLoginItemSettings()).to.deep.equal({ - openAtLogin: true, - openAsHidden: process.platform === 'darwin' && !process.mas, // Only available on macOS - wasOpenedAtLogin: false, - wasOpenedAsHidden: false, - restoreState: false - }) - done() - }, delay) + expect(app.getLoginItemSettings()).to.deep.equal({ + openAtLogin: true, + openAsHidden: process.platform === 'darwin' && !process.mas, // Only available on macOS + wasOpenedAtLogin: false, + wasOpenedAsHidden: false, + restoreState: false + }) + done() }) it('correctly sets and unsets the LoginItem', function () { @@ -595,7 +584,7 @@ describe('app module', () => { }) it('correctly sets and unsets the LoginItem as hidden', function () { - if (process.platform !== 'darwin' || process.mas) this.skip() + if (process.platform !== 'darwin') this.skip() expect(app.getLoginItemSettings().openAtLogin).to.be.false() expect(app.getLoginItemSettings().openAsHidden).to.be.false() diff --git a/spec/version-bump-spec.js b/spec/version-bump-spec.js index c4d89ad9f5618..0b799043fd038 100644 --- a/spec/version-bump-spec.js +++ b/spec/version-bump-spec.js @@ -1,8 +1,15 @@ const { expect } = require('chai') +const { remote } = require('electron') const { nextVersion } = require('../script/bump-version') const utils = require('../script/lib/version-utils') -describe('bump-version utils', () => { +const isCi = remote.getGlobal('isCi') + +// 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 +const describeFn = (isCi && process.platform === 'darwin') ? describe.skip : describe + +describeFn('bump-version utils', () => { it('makes a version with a period delimeter', () => { const components = { major: 2, @@ -39,7 +46,7 @@ describe('bump-version utils', () => { }) }) -describe('bump-version script', () => { +describeFn('bump-version script', () => { const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g const betaPattern = /[0-9.]*(-beta[0-9.]*)/g diff --git a/vsts.yml b/vsts.yml deleted file mode 100644 index 736973f878043..0000000000000 --- a/vsts.yml +++ /dev/null @@ -1,399 +0,0 @@ -# The config expects the following environment variables to be set: -# - "Custom.UseArtifacts.BuildId" aka "CUSTOM_USEARTIFACTS_BUILDID" -# Set it to a build number, e.g. 15912, to download artifacts -# from that build and only run the tests, instead of building from scratch. -# - "ELECTRON_RELEASE" Set it to '1' upload binaries on success. -# - "GN_CONFIG" Full path to a build config, e.g. '//electron/build/args/testing.gn'. -# - "GN_EXTRA_ARGS" Additional gn args, e.g. 'is_mas_build=true'. -# - "NOTIFY_SLACK" Set it to '1' to enable Slack notifications. -# - "RUN_TESTS" Set it to '1' to run Electron's tests. -# - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket. -# Otherwise the release will be uploaded to the Github Releases. -# (The value is only checked if "ELECTRON_RELEASE" is defined.) -# -# The publishing scripts expect access tokens to be defined as env vars, -# but those are not covered here. -# -# VSTS docs on variables: -# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables - -jobs: -- job: build - displayName: Build - # Build Electron only if we are NOT going to use artifacts produced by a different build. - condition: eq(variables['Custom.UseArtifacts.BuildId'], '') - timeoutInMinutes: 120 - variables: - CI: true - steps: - - - bash: | - git clean -fdx - displayName: Clean unneeded git directories - timeoutInMinutes: 2 - - - task: CopyFiles@2 - displayName: 'Copy Files to: src/electron' - inputs: - TargetFolder: src/electron - timeoutInMinutes: 2 - - - bash: | - export PATH="$PATH:/Users/electron/depot_tools" - echo "##vso[task.setvariable variable=PATH]$PATH" - export GIT_CACHE_PATH="/Users/electron/libcc_cache" - if [ "$ELECTRON_RELEASE" == "1" ]; then - GCLIENT_EXTRA_ARGS='--custom-var=checkout_boto=True --custom-var=checkout_requests=True' - fi - - set -ex - gclient config \ - --name "src/electron" \ - --unmanaged \ - $GCLIENT_EXTRA_ARGS \ - "https://github.com/electron/electron" - gclient sync --with_branch_heads --with_tags - cd src - export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools - echo "##vso[task.setvariable variable=CHROMIUM_BUILDTOOLS_PATH]`pwd`/buildtools" - displayName: gclient sync - timeoutInMinutes: 25 # Usually takes about 10-15 minutes. - - - bash: | - cd src - export SCCACHE_BINARY="`pwd`/electron/external_binaries/sccache" - "$SCCACHE_BINARY" --start-server - echo "##vso[task.setvariable variable=SCCACHE_BINARY]$SCCACHE_BINARY" - "$SCCACHE_BINARY" -s - echo "GN gen for: $GN_CONFIG" - gn gen out/Default --args='import("'$GN_CONFIG'") cc_wrapper="'"$SCCACHE_BINARY"'"'" $GN_EXTRA_ARGS" - env: - AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY) - AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET) - displayName: GN gen with sccache - condition: and(succeeded(), ne(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 1 # Shouldn't take more than 10 seconds. - - - bash: | - cd src - echo "GN gen for: $GN_CONFIG" - gn gen out/Default --args='import("'$GN_CONFIG'")'" $GN_EXTRA_ARGS" - displayName: GN gen without sccache - condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 1 # Shouldn't take more than 10 seconds. - - - bash: | - cd src - ninja -C out/Default electron:electron_app - displayName: Ninja build app - timeoutInMinutes: 100 # Can take up to 80 minutes without compiler cache. - - - bash: | - cd src - ninja -C out/Default third_party/electron_node:headers - displayName: Build Node.js headers for testing - timeoutInMinutes: 1 # Usually takes less than 10 seconds. - - - bash: | - cd src - gn gen out/ffmpeg --args='import("//electron/build/args/ffmpeg.gn") cc_wrapper="'"$SCCACHE_PATH"'"'" $GN_EXTRA_ARGS" - ninja -C out/ffmpeg electron:electron_ffmpeg_zip - displayName: Non proprietary ffmpeg build - condition: and(succeeded(), or(eq(variables['RUN_TESTS'], '1'), eq(variables['ELECTRON_RELEASE'], '1'))) - timeoutInMinutes: 2 # Usually takes less than 30 seconds. - - - bash: | - cd src - # Build needed dump_syms executable - ninja -C out/Default third_party/breakpad:dump_syms - - # TODO(alexeykuzmin): Explicitly pass an out folder path to the scripts. - export ELECTRON_OUT_DIR=Default - - electron/script/dump-symbols.py -d "$PWD/out/Default/breakpad_symbols" - electron/script/zip-symbols.py - displayName: Collect symbols - condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 5 # Usually takes less than two. - - - bash: | - "$SCCACHE_BINARY" --stop-server - displayName: Check sccache stats after build - condition: and(succeeded(), ne(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 1 - - - bash: | - cd src - ninja -C out/Default electron:electron_dist_zip - displayName: Build dist zip - timeoutInMinutes: 2 # Usually takes less than 20 seconds. - - - bash: | - cd src - ninja -C out/Default electron:electron_chromedriver_zip - displayName: Build chromedriver and zip - timeoutInMinutes: 3 # Normally less than one minute. - - - bash: | - cd src - ninja -C out/Default electron:electron_mksnapshot_zip - displayName: Build mksnapshot and zip - timeoutInMinutes: 1 # Normally less than 10 seconds. - - - bash: | - cd src/electron - npm run create-typescript-definitions - displayName: Generate type declarations - condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 2 # Normally takes about 10-15 seconds. - - - bash: | - cd src/electron - - export ELECTRON_OUT_DIR=Default - export ELECTRON_S3_BUCKET="$(s3_bucket)" - export ELECTRON_S3_ACCESS_KEY="$(s3_access_key)" - export ELECTRON_S3_SECRET_KEY="$(s3_secret_key)" - export ELECTRON_GITHUB_TOKEN="$(github_token)" - - if [ "$UPLOAD_TO_S3" == "1" ]; then - echo 'Uploading Electron release distribution to s3' - script/upload.py --upload_to_s3 - else - echo 'Uploading Electron release distribution to Github releases' - script/upload.py - fi - displayName: Upload distribution - condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1')) - timeoutInMinutes: 5 # Normally takes about two minutes. - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (application zip) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/src/out/Default/dist.zip' - ArtifactName: Default - timeoutInMinutes: 2 # The file is relatively big, so it takes about 20 seconds. - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (Node.js headers) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/src/out/Default/gen/node_headers.tar.gz' - ArtifactName: Default - timeoutInMinutes: 1 - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (chromedriver.zip) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/src/out/Default/chromedriver.zip' - ArtifactName: Default - timeoutInMinutes: 1 - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (mksnapshot.zip) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/src/out/Default/mksnapshot.zip' - ArtifactName: Default - timeoutInMinutes: 1 - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (ffmpeg.zip) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/src/out/ffmpeg/ffmpeg.zip' - ArtifactName: Default - timeoutInMinutes: 1 - - - bash: | - echo $BUILD_SOURCEVERSION > revision - displayName: Save exact revision - timeoutInMinutes: 1 - - - task: PublishBuildArtifacts@1 - displayName: Publish Build Artifacts (revision) - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/revision' - ArtifactName: Default - timeoutInMinutes: 1 - - # Notify about success only if we are supposed to, and we don't have to run tests first. - - bash: | - export BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}" - export MESSAGE="Build succeeded for *<$BUILD_URL|$BUILD_DEFINITIONNAME>* nightly build from *$BUILD_SOURCEBRANCHNAME*." - curl -g -H "Content-Type: application/json" -X POST \ - -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"good\",\"title\": \"$BUILD_DEFINITIONNAME nightly build results\",\"title_link\": \"$BUILD_URL\"}]}" $(slack_webhook) - displayName: Post Slack Notification on success - condition: and(succeeded(), and(eq(variables['NOTIFY_SLACK'], '1'), ne(variables['RUN_TESTS'], '1'))) - timeoutInMinutes: 1 - - - bash: | - export BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}" - export MESSAGE="Build failed for *<$BUILD_URL|$BUILD_DEFINITIONNAME>* nightly build from *$BUILD_SOURCEBRANCHNAME*." - curl -g -H "Content-Type: application/json" -X POST \ - -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"#FC5C3C\",\"title\": \"$BUILD_DEFINITIONNAME nightly build results\",\"title_link\": \"$BUILD_URL\"}]}" $(slack_webhook) - displayName: 'Post Slack Notification on Failure' - condition: and(failed(), eq(variables['NOTIFY_SLACK'], '1')) - timeoutInMinutes: 1 - - - bash: | - rm -rf ..?* .[!.]* * - condition: always() - displayName: 'Cleanup directories' - -- job: run_tests - displayName: Run Tests - dependsOn: build - # Run this job only if we are supposed to run the tests, - # and we have an Electron built either in the previous job or in a different job, defined by a user. - condition: and(eq(variables['RUN_TESTS'], '1'), or(succeeded(), ne(variables['Custom.UseArtifacts.BuildId'], ''))) - pool: - vmImage: 'macOS-10.13' - timeoutInMinutes: 20 - variables: - CI: true - steps: - - - task: CopyFiles@2 - displayName: Copy Electron sources to "src/electron" - inputs: - TargetFolder: src/electron - timeoutInMinutes: 1 - - # Use Electron built in the current job, if a user didn't specify a build id. - - task: DownloadBuildArtifacts@0 - displayName: Download build artifacts from the current build - inputs: - buildType: 'current' - artifactName: Default - condition: and(succeeded(), eq(variables['Custom.UseArtifacts.BuildId'], '')) - timeoutInMinutes: 1 - - # Use Electron built in a different job. - - task: DownloadBuildArtifacts@0 - displayName: Download build artifacts from a build specified by user - inputs: - buildType: 'specific' - project: $(System.TeamProjectId) - pipeline: $(Build.DefinitionName) - buildVersionToDownload: 'specific' - buildId: $(Custom.UseArtifacts.BuildId) - artifactName: Default - condition: and(succeeded(), ne(variables['Custom.UseArtifacts.BuildId'], '')) - timeoutInMinutes: 1 - - - bash: | - TESTS_REVISION=$BUILD_SOURCEVERSION - SOURCES_REVISION=`cat ${SYSTEM_ARTIFACTSDIRECTORY}/Default/revision` - if [ $TESTS_REVISION != $SOURCES_REVISION ]; then - echo "$TESTS_REVISION != $SOURCES_REVISION" - exit 1 - fi - displayName: Check if revisions of build sources and test sources match - timeoutInMinutes: 1 - - - task: ExtractFiles@1 - displayName: Extract Electron app - inputs: - archiveFilePatterns: $(System.ArtifactsDirectory)/Default/dist.zip - destinationFolder: src/out/Default - timeoutInMinutes: 1 - - - task: ExtractFiles@1 - displayName: Extract ffmpeg - inputs: - archiveFilePatterns: $(System.ArtifactsDirectory)/Default/ffmpeg.zip - destinationFolder: src/out/ffmpeg - timeoutInMinutes: 1 - - - task: ExtractFiles@1 - displayName: Extract mksnapshot - inputs: - archiveFilePatterns: $(System.ArtifactsDirectory)/Default/mksnapshot.zip - destinationFolder: src/out/mksnapshot - timeoutInMinutes: 1 - - - task: CopyFiles@2 - displayName: 'Copy Files to: src/out/Default' - inputs: - SourceFolder: src/out/mksnapshot - TargetFolder: src/out/Default - OverWrite: true - timeoutInMinutes: 1 - - - task: ExtractFiles@1 - displayName: Extract Node.js headers - inputs: - archiveFilePatterns: $(System.ArtifactsDirectory)/Default/node_headers.tar.gz - destinationFolder: src/out/Default/gen - timeoutInMinutes: 1 - - - task: NodeTool@0 - displayName: Install Node.js 10.x - inputs: - versionSpec: '10.x' - timeoutInMinutes: 2 # Should take less than a minute. - - - bash: | - cd src/electron - npm install - displayName: Install Node.js modules - timeoutInMinutes: 4 # Should take about 30 seconds. - - - bash: | - cd src - python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg - displayName: Verify non proprietary ffmpeg - timeoutInMinutes: 5 - - - bash: | - cd src - python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default - displayName: Verify mksnapshot - timeoutInMinutes: 5 - - - bash: | - if pgrep Electron; then - killall Electron - fi - rm -rf ~/Library/Saved\ Application\ State/com.github.electron.savedState - rm -rf ~/Library/Application\ Support/Electron - displayName: Make sure Electron isn't running from previous tests - timeoutInMinutes: 1 - - - bash: | - export ELECTRON_OUT_DIR=Default - (cd src/electron && npm run test -- --ci) - displayName: Run Electron test suite - timeoutInMinutes: 10 - - - bash: | - cd src - if [ ! -s "$MOCHA_FILE" ]; then - exit 1 - fi - displayName: Check test results existence - timeoutInMinutes: 1 - - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFiles: '*.xml' - searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/' - condition: and(always(), eq(variables['MOCHA_FILE'], 'junit/test-results.xml')) - timeoutInMinutes: 1 - - - bash: | - export BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}" - export MESSAGE="Build failed for *<$BUILD_URL|$BUILD_DEFINITIONNAME>* nightly build from *$BUILD_SOURCEBRANCHNAME*." - curl -g -H "Content-Type: application/json" -X POST \ - -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"#FC5C3C\",\"title\": \"$BUILD_DEFINITIONNAME nightly build results\",\"title_link\": \"$BUILD_URL\"}]}" $(slack_webhook) - displayName: Post Slack Notification on failure - condition: and(failed(), eq(variables['NOTIFY_SLACK'], '1')) - timeoutInMinutes: 1 - - - bash: | - export BUILD_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${SYSTEM_TEAMPROJECT}/_build/results?buildId=${BUILD_BUILDID}" - export MESSAGE="Build succeeded for *<$BUILD_URL|$BUILD_DEFINITIONNAME>* nightly build from *$BUILD_SOURCEBRANCHNAME*." - curl -g -H "Content-Type: application/json" -X POST \ - -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"good\",\"title\": \"$BUILD_DEFINITIONNAME nightly build results\",\"title_link\": \"$BUILD_URL\"}]}" $(slack_webhook) - displayName: Post Slack Notification on success - condition: and(succeeded(), eq(variables['NOTIFY_SLACK'], '1')) - timeoutInMinutes: 1