Skip to content

Commit 7866575

Browse files
alexeykuzminckerr
authored andcommitted
ci: fix the upload distribution step on VSTS (electron#15015)
* ci: fix the upload distribution step on VSTS * ci: fix get_electron_exec() * ci: define "CI" env variable
1 parent 5416051 commit 7866575

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

script/dump-symbols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from lib.config import PLATFORM, enable_verbose_mode, is_verbose_mode
88
from lib.util import get_electron_branding, execute, rm_rf, get_out_dir, \
9-
GN_SRC_DIR
9+
SRC_DIR
1010

1111
ELECTRON_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
1212
SOURCE_ROOT = os.path.abspath(os.path.dirname(ELECTRON_ROOT))
@@ -51,7 +51,7 @@ def main():
5151
args += ['-v']
5252
#Make sure msdia140.dll is in the path (needed for dump_syms.exe)
5353
env = os.environ.copy()
54-
msdia140_dll_path = os.path.join(GN_SRC_DIR, 'third_party', 'llvm-build',
54+
msdia140_dll_path = os.path.join(SRC_DIR, 'third_party', 'llvm-build',
5555
'Release+Asserts', 'bin')
5656
env['PATH'] = os.path.pathsep.join(
5757
[env.get('PATH', '')] + [msdia140_dll_path])

script/lib/util.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from lib.config import is_verbose_mode, PLATFORM
2222
from lib.env_util import get_vs_env
2323

24-
GN_SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
24+
SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
2525
BOTO_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'vendor',
2626
'boto'))
2727

@@ -301,17 +301,22 @@ def get_out_dir():
301301
override = os.environ.get('ELECTRON_OUT_DIR')
302302
if override is not None:
303303
out_dir = override
304-
return os.path.join(GN_SRC_DIR, 'out', out_dir)
304+
return os.path.join(SRC_DIR, 'out', out_dir)
305305

306306
# NOTE: This path is not created by gn, it is used as a scratch zone by our
307307
# upload scripts
308308
def get_dist_dir():
309309
return os.path.join(get_out_dir(), 'gen', 'electron_dist')
310310

311311
def get_electron_exec():
312+
out_dir = get_out_dir()
313+
312314
if sys.platform == 'darwin':
313-
return 'out/{0}/Electron.app/Contents/MacOS/Electron'.format(get_out_dir())
315+
return '{0}/Electron.app/Contents/MacOS/Electron'.format(out_dir)
314316
elif sys.platform == 'win32':
315-
return 'out/{0}/electron.exe'.format(get_out_dir())
317+
return '{0}/electron.exe'.format(out_dir)
316318
elif sys.platform == 'linux':
317-
return 'out/{0}/electron'.format(get_out_dir())
319+
return '{0}/electron'.format(out_dir)
320+
321+
raise Exception(
322+
"get_electron_exec: unexpected platform '{0}'".format(sys.platform))

script/upload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
get_zip_name
1717
from lib.util import get_electron_branding, execute, get_electron_version, \
1818
parse_version, scoped_cwd, s3put, get_electron_exec, \
19-
get_out_dir, GN_SRC_DIR
19+
get_out_dir, SRC_DIR
2020

2121

2222
ELECTRON_REPO = 'electron/electron'
@@ -84,7 +84,7 @@ def main():
8484
# Upload free version of ffmpeg.
8585
ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
8686
ffmpeg_zip = os.path.join(OUT_DIR, ffmpeg)
87-
ffmpeg_build_path = os.path.join(GN_SRC_DIR, 'out', 'ffmpeg', 'ffmpeg.zip')
87+
ffmpeg_build_path = os.path.join(SRC_DIR, 'out', 'ffmpeg', 'ffmpeg.zip')
8888
shutil.copy2(ffmpeg_build_path, ffmpeg_zip)
8989
upload_electron(release, ffmpeg_zip, args)
9090

@@ -97,7 +97,7 @@ def main():
9797
mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)
9898
if get_target_arch().startswith('arm'):
9999
# Upload the native mksnapshot as mksnapshot.zip
100-
shutil.copy2(os.path.join(GN_SRC_DIR, 'out', 'native_mksnapshot',
100+
shutil.copy2(os.path.join(SRC_DIR, 'out', 'native_mksnapshot',
101101
'mksnapshot.zip'), mksnapshot_zip)
102102
upload_electron(release, mksnapshot_zip, args)
103103
# Upload the x64 binary for arm/arm64 mksnapshot

tools/win/generate_breakpad_symbols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import sys
1717
import threading
1818

19-
GN_SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
19+
SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
2020

2121
# Duplicated as this script lives in tools not script
2222
def get_out_dir():
2323
out_dir = 'Debug'
2424
override = os.environ.get('ELECTRON_OUT_DIR')
2525
if override is not None:
2626
out_dir = override
27-
return os.path.join(GN_SRC_DIR, 'out', out_dir)
27+
return os.path.join(SRC_DIR, 'out', out_dir)
2828

2929

3030
CONCURRENT_TASKS=4

vsts.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ jobs:
22
- job: Build_Electron_via_GN
33
displayName: Build Electron via GN
44
timeoutInMinutes: 120
5+
variables:
6+
CI: true
57
steps:
68

79
- task: CopyFiles@2
@@ -133,14 +135,21 @@ jobs:
133135
134136
- bash: |
135137
cd src/electron
136-
if [ "$UPLOAD_TO_S3" != "1" ]; then
137-
echo 'Uploading Electron release distribution to github releases'
138-
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
139-
else
138+
139+
export ELECTRON_OUT_DIR=Default
140+
export ELECTRON_S3_BUCKET="$(s3_bucket)"
141+
export ELECTRON_S3_ACCESS_KEY="$(s3_access_key)"
142+
export ELECTRON_S3_SECRET_KEY="$(s3_secret_key)"
143+
export ELECTRON_GITHUB_TOKEN="$(github_token)"
144+
145+
if [ "$UPLOAD_TO_S3" == "1" ]; then
140146
echo 'Uploading Electron release distribution to s3'
141-
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
147+
script/upload.py --upload_to_s3
148+
else
149+
echo 'Uploading Electron release distribution to Github releases'
150+
script/upload.py
142151
fi
143-
name: Upload_distribution
152+
displayName: Upload distribution
144153
condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
145154
146155
- task: PublishTestResults@2

0 commit comments

Comments
 (0)