Updated CI configs for nightly builds

Add timestamp to s3 uploads
This commit is contained in:
John Kleinschmidt 2018-05-22 13:50:44 -04:00
parent 93bee69266
commit 6dff60b899
3 changed files with 302 additions and 572 deletions

View file

@ -1,80 +1,134 @@
build-steps: &build-steps
steps:
- checkout
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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 [ "$ELECTRON_RELEASE" != "1" ] && [ "$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 [ "$ELECTRON_RELEASE" != "1" ] && [ "$RUN_TESTS" == "true" ]; then
echo 'Testing Electron debug build'
mkdir junit
script/test.py --ci
else
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Skipping testing on release build'
else
echo 'Skipping tests due to configuration'
fi
fi
- run:
name: Verify FFmpeg
command: |
if [ "$ELECTRON_RELEASE" != "1" ] && [ "$RUN_TESTS" == "true" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Skipping verify ffmpeg on release build'
else
echo 'Skipping tests due to configuration'
fi
fi
- run:
name: Generate Typescript Definitions
command: |
if [ "$CREATE_TYPESCRIPT_DEFS" == "true" ]; then
npm run create-typescript-definitions
fi
- persist_to_workspace:
root: out
paths:
- "*"
- store_test_results:
path: junit
- store_artifacts:
path: junit
- store_artifacts:
path: out/electron.d.ts
- store_artifacts:
path: out/electron-api.json
build-defaults: &build-defaults
docker:
- image: electronbuilds/electron:0.0.7
<<: *build-steps
version: 2 version: 2
jobs: jobs:
electron-linux-arm: electron-linux-arm:
docker: environment:
- image: electronbuilds/electron:0.0.7 TARGET_ARCH: arm
environment: <<: *build-defaults
TARGET_ARCH: arm
resource_class: 2xlarge resource_class: 2xlarge
steps:
- checkout
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Zip out directory
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
zip -r electron.zip out/D
fi
- persist_to_workspace:
root: /home/builduser
paths:
- project/out
- store_artifacts:
path: electron.zip
electron-linux-arm-test: electron-linux-arm-test:
machine: true machine: true
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace/project/out
- checkout - checkout
- run: - run:
name: Test in ARM docker container name: Test in ARM docker container
@ -94,80 +148,25 @@ jobs:
else else
echo "Skipping test for release build" echo "Skipping test for release build"
fi fi
electron-linux-arm64:
docker: electron-linux-arm-release-nightly:
- image: electronbuilds/electron:0.0.7 environment:
environment: TARGET_ARCH: arm
TARGET_ARCH: arm64 RUN_RELEASE_BUILD: true
<<: *build-defaults
resource_class: 2xlarge resource_class: 2xlarge
steps:
- checkout electron-linux-arm64:
- run: environment:
name: Check for release TARGET_ARCH: arm64
command: | <<: *build-defaults
if [ -n "${RUN_RELEASE_BUILD}" ]; then resource_class: 2xlarge
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Zip out directory
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
zip -r electron.zip out/D
fi
- persist_to_workspace:
root: /home/builduser
paths:
- project/out
- store_artifacts:
path: electron.zip
electron-linux-arm64-test: electron-linux-arm64-test:
machine: true machine: true
steps: steps:
- attach_workspace: - attach_workspace:
at: /tmp/workspace at: /tmp/workspace/project/out
- checkout - checkout
- run: - run:
name: Test in ARM64 docker container name: Test in ARM64 docker container
@ -187,444 +186,87 @@ jobs:
else else
echo "Skipping test for release build" echo "Skipping test for release build"
fi fi
electron-linux-arm64-release-nightly:
environment:
TARGET_ARCH: arm64
RUN_RELEASE_BUILD: true
<<: *build-defaults
resource_class: 2xlarge
electron-linux-ia32: electron-linux-ia32:
docker: environment:
- image: electronbuilds/electron:0.0.7 TARGET_ARCH: ia32
environment: DISPLAY: ':99.0'
TARGET_ARCH: ia32 RUN_TESTS: true
DISPLAY: ':99.0' RUN_HEADLESS_TESTS: true
ELECTRON_ENABLE_LOGGING: 'true' <<: *build-defaults
resource_class: xlarge resource_class: xlarge
steps:
- checkout electron-linux-ia32-release-nightly:
- run: environment:
name: Setup for headless testing TARGET_ARCH: ia32
command: sh -e /etc/init.d/xvfb start RUN_RELEASE_BUILD: true
- run: <<: *build-defaults
name: Check for release resource_class: xlarge
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Test
environment:
MOCHA_FILE: junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Testing Electron debug build'
out/D/electron --version
mkdir junit
script/test.py --ci --rebuild_native_modules
else
echo 'Skipping testing on release build'
fi
- run:
name: Verify FFmpeg
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
echo 'Skipping verify ffmpeg on release build'
fi
- store_test_results:
path: junit
- store_artifacts:
path: junit
electron-linux-mips64el: electron-linux-mips64el:
docker: environment:
- image: electronbuilds/electron:0.0.7 TARGET_ARCH: mips64el
environment: <<: *build-defaults
TARGET_ARCH: mips64el
resource_class: xlarge resource_class: xlarge
steps:
- checkout
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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
electron-linux-x64: electron-linux-x64:
docker: environment:
- image: electronbuilds/electron:0.0.7 TARGET_ARCH: x64
environment: DISPLAY: ':99.0'
TARGET_ARCH: x64 RUN_TESTS: true
DISPLAY: ':99.0' 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
<<: *build-defaults
resource_class: xlarge resource_class: xlarge
steps:
- checkout
- run:
name: Setup for headless testing
command: sh -e /etc/init.d/xvfb start
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Test
environment:
MOCHA_FILE: junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Testing Electron debug build'
mkdir junit
script/test.py --ci --rebuild_native_modules
else
echo 'Skipping testing on release build'
fi
- run:
name: Verify FFmpeg
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
echo 'Skipping verify ffmpeg on release build'
fi
- run:
name: Generate Typescript Definitions
command: npm run create-typescript-definitions
- store_test_results:
path: junit
- store_artifacts:
path: junit
- store_artifacts:
path: out/electron.d.ts
- store_artifacts:
path: out/electron-api.json
electron-osx-x64: electron-osx-x64:
environment: environment:
TARGET_ARCH: x64 TARGET_ARCH: x64
RUN_TESTS: true
macos: macos:
xcode: "9.0" xcode: "9.0"
resource_class: xlarge <<: *build-steps
steps:
- checkout electron-osx-x64-release-nightly:
- run: environment:
name: Reclaim disk space TARGET_ARCH: x64
command: | RUN_RELEASE_BUILD: true
df -h macos:
sudo rm -rf /Library/Developer/CoreSimulator xcode: "9.0"
df -h <<: *build-steps
sysctl -n hw.ncpu
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Test
environment:
MOCHA_FILE: junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Testing Electron debug build'
mkdir junit
script/test.py --ci --rebuild_native_modules
else
echo 'Skipping testing on release build'
fi
- run:
name: Verify FFmpeg
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
echo 'Skipping verify ffmpeg on release build'
fi
- run:
name: Generate Typescript Definitions
command: npm run create-typescript-definitions
- store_test_results:
path: junit
- store_artifacts:
path: junit
- store_artifacts:
path: out/electron.d.ts
- store_artifacts:
path: out/electron-api.json
electron-mas-x64: electron-mas-x64:
environment: environment:
TARGET_ARCH: x64 TARGET_ARCH: x64
MAS_BUILD: 1 MAS_BUILD: 1
RUN_TESTS: true
macos: macos:
xcode: "9.0" xcode: "9.0"
resource_class: xlarge <<: *build-steps
steps:
- checkout electron-mas-x64-release-nightly:
- run: environment:
name: Reclaim disk space TARGET_ARCH: x64
command: | MAS_BUILD: 1
df -h RUN_RELEASE_BUILD: true
sudo rm -rf /Library/Developer/CoreSimulator macos:
df -h xcode: "9.0"
sysctl -n hw.ncpu <<: *build-steps
- run:
name: Check for release
command: |
if [ -n "${RUN_RELEASE_BUILD}" ]; then
echo 'release build triggered from api'
echo 'export ELECTRON_RELEASE=1 TRIGGERED_BY_API=1' >> $BASH_ENV
fi
- run:
name: Bootstrap
command: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
- run: 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" ] && [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
script/upload.py
elif [ "$ELECTRON_RELEASE" == "1" ] && [ "$TRIGGERED_BY_API" == "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: Test
environment:
MOCHA_FILE: junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Testing Electron debug build'
mkdir junit
script/test.py --ci --rebuild_native_modules
else
echo 'Skipping testing on release build'
fi
- run:
name: Verify FFmpeg
command: |
if [ "$ELECTRON_RELEASE" != "1" ]; then
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
else
echo 'Skipping verify ffmpeg on release build'
fi
- run:
name: Generate Typescript Definitions
command: npm run create-typescript-definitions
- store_test_results:
path: junit
- store_artifacts:
path: junit
- store_artifacts:
path: out/electron.d.ts
- store_artifacts:
path: out/electron-api.json
workflows: workflows:
version: 2 version: 2
@ -652,3 +294,20 @@ workflows:
build-mas-x64: build-mas-x64:
jobs: jobs:
- electron-mas-x64 - electron-mas-x64
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

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import argparse import argparse
import datetime
import errno import errno
import hashlib import hashlib
import os import os
@ -34,6 +35,9 @@ PDB_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb')
def main(): def main():
args = parse_args() args = parse_args()
if args.upload_to_s3:
utcnow = datetime.datetime.utcnow()
args.upload_timestamp = utcnow.strftime('%Y-%m-%d_%H:%M:%S')
if not dist_newer_than_head(): if not dist_newer_than_head():
run_python_script('create-dist.py') run_python_script('create-dist.py')
@ -67,39 +71,37 @@ def main():
# Upload Electron with GitHub Releases API. # Upload Electron with GitHub Releases API.
upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME), upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME), args)
args.upload_to_s3)
if get_target_arch() != 'mips64el': if get_target_arch() != 'mips64el':
upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME), upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME), args)
args.upload_to_s3)
if PLATFORM == 'darwin': if PLATFORM == 'darwin':
upload_electron(github, release, os.path.join(DIST_DIR, upload_electron(github, release, os.path.join(DIST_DIR,
'electron-api.json'), args.upload_to_s3) 'electron-api.json'), args)
upload_electron(github, release, os.path.join(DIST_DIR, 'electron.d.ts'), upload_electron(github, release, os.path.join(DIST_DIR, 'electron.d.ts'),
args.upload_to_s3) args)
upload_electron(github, release, os.path.join(DIST_DIR, DSYM_NAME), upload_electron(github, release, os.path.join(DIST_DIR, DSYM_NAME),
args.upload_to_s3) args)
elif PLATFORM == 'win32': elif PLATFORM == 'win32':
upload_electron(github, release, os.path.join(DIST_DIR, PDB_NAME), upload_electron(github, release, os.path.join(DIST_DIR, PDB_NAME),
args.upload_to_s3) args)
# Upload free version of ffmpeg. # Upload free version of ffmpeg.
ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION) ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, ffmpeg), upload_electron(github, release, os.path.join(DIST_DIR, ffmpeg),
args.upload_to_s3) args)
chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION) chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, chromedriver), upload_electron(github, release, os.path.join(DIST_DIR, chromedriver),
args.upload_to_s3) args)
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION) mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot), upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
args.upload_to_s3) args)
if get_target_arch().startswith('arm'): if get_target_arch().startswith('arm'):
# Upload the x64 binary for arm/arm64 mksnapshot # Upload the x64 binary for arm/arm64 mksnapshot
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64') mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot), upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
args.upload_to_s3) args)
if PLATFORM == 'win32' and not tag_exists and not args.upload_to_s3: if PLATFORM == 'win32' and not tag_exists and not args.upload_to_s3:
# Upload PDBs to Windows symbol server. # Upload PDBs to Windows symbol server.
@ -209,12 +211,13 @@ def create_release_draft(github, tag):
return r return r
def upload_electron(github, release, file_path, upload_to_s3): def upload_electron(github, release, file_path, args):
# if upload_to_s3 is set, skip github upload. # if upload_to_s3 is set, skip github upload.
if upload_to_s3: if args.upload_to_s3:
bucket, access_key, secret_key = s3_config() bucket, access_key, secret_key = s3_config()
key_prefix = 'electron-artifacts/{0}'.format(release['tag_name']) key_prefix = 'electron-artifacts/{0}_{1}'.format(release['tag_name'],
args.upload_timestamp)
s3put(bucket, access_key, secret_key, os.path.dirname(file_path), s3put(bucket, access_key, secret_key, os.path.dirname(file_path),
key_prefix, [file_path]) key_prefix, [file_path])
upload_sha256_checksum(release['tag_name'], file_path, key_prefix) upload_sha256_checksum(release['tag_name'], file_path, key_prefix)

68
vsts.yml Normal file
View file

@ -0,0 +1,68 @@
resources:
- repo: self
steps:
- bash: |
if [ "$ELECTRON_RELEASE" == "1" ]; then
echo 'Bootstrapping Electron for release build'
script/bootstrap.py --target_arch=$TARGET_ARCH
else
echo 'Bootstrapping Electron for debug build'
script/bootstrap.py --target_arch=$TARGET_ARCH --dev
fi
name: Bootstrap
- bash: |
npm run lint
name: Lint
condition: and(succeeded(), ne(variables['ELECTRON_RELEASE'], '1'))
- bash: |
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
name: Build
- bash: |
echo 'Creating Electron release distribution'
script/create-dist.py
name: Create_distribution
condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
- bash: |
if [ "$TRIGGERED_BY_API" != "1" ]; then
echo 'Uploading Electron release distribution to github releases'
ELECTRON_S3_BUCKET="$(s3_bucket)" ELECTRON_S3_ACCESS_KEY="$(s3_access_key)" ELECTRON_S3_SECRET_KEY="$(s3_secret_key)" ELECTRON_GITHUB_TOKEN="$(github_token)" script/upload.py
else
echo 'Uploading Electron release distribution to s3'
ELECTRON_S3_BUCKET="$(s3_bucket)" ELECTRON_S3_ACCESS_KEY="$(s3_access_key)" ELECTRON_S3_SECRET_KEY="$(s3_secret_key)" ELECTRON_GITHUB_TOKEN="$(github_token)" script/upload.py --upload_to_s3
fi
name: Upload_distribution
condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
- bash: |
echo 'Testing Electron debug build'
mkdir junit
export MOCHA_FILE="junit/test-results.xml"
export MOCHA_REPORTER="mocha-junit-reporter"
script/test.py --ci
name: Test
condition: and(succeeded(), ne(variables['ELECTRON_RELEASE'], '1'))
- bash: |
echo 'Verifying ffmpeg on debug build'
script/verify-ffmpeg.py
name: Verify_FFmpeg
condition: and(succeeded(), ne(variables['ELECTRON_RELEASE'], '1'))
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: 'test-results.xml'
searchFolder: junit
condition: and(always(), ne(variables['ELECTRON_RELEASE'], '1'))
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3