Browse Source

ci: fix the upload distribution step on VSTS (#15015)

* ci: fix the upload distribution step on VSTS

* ci: fix get_electron_exec()

* ci: define "CI" env variable
Alexey Kuzmin 6 years ago
parent
commit
7866575385
5 changed files with 32 additions and 18 deletions
  1. 2 2
      script/dump-symbols.py
  2. 10 5
      script/lib/util.py
  3. 3 3
      script/upload.py
  4. 2 2
      tools/win/generate_breakpad_symbols.py
  5. 15 6
      vsts.yml

+ 2 - 2
script/dump-symbols.py

@@ -6,7 +6,7 @@ import sys
 
 from lib.config import PLATFORM, enable_verbose_mode, is_verbose_mode
 from lib.util import get_electron_branding, execute, rm_rf, get_out_dir, \
-                     GN_SRC_DIR
+                     SRC_DIR
 
 ELECTRON_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 SOURCE_ROOT = os.path.abspath(os.path.dirname(ELECTRON_ROOT))
@@ -51,7 +51,7 @@ def main():
       args += ['-v']
     #Make sure msdia140.dll is in the path (needed for dump_syms.exe)
     env = os.environ.copy()
-    msdia140_dll_path =  os.path.join(GN_SRC_DIR, 'third_party', 'llvm-build',
+    msdia140_dll_path =  os.path.join(SRC_DIR, 'third_party', 'llvm-build',
                                       'Release+Asserts', 'bin')
     env['PATH'] = os.path.pathsep.join(
         [env.get('PATH', '')] + [msdia140_dll_path])

+ 10 - 5
script/lib/util.py

@@ -21,7 +21,7 @@ import zipfile
 from lib.config import is_verbose_mode, PLATFORM
 from lib.env_util import get_vs_env
 
-GN_SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
+SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
 BOTO_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'vendor',
                                         'boto'))
 
@@ -301,7 +301,7 @@ def get_out_dir():
   override = os.environ.get('ELECTRON_OUT_DIR')
   if override is not None:
     out_dir = override
-  return os.path.join(GN_SRC_DIR, 'out', out_dir)
+  return os.path.join(SRC_DIR, 'out', out_dir)
 
 # NOTE: This path is not created by gn, it is used as a scratch zone by our
 #       upload scripts
@@ -309,9 +309,14 @@ def get_dist_dir():
   return os.path.join(get_out_dir(), 'gen', 'electron_dist')
 
 def get_electron_exec():
+  out_dir = get_out_dir()
+
   if sys.platform == 'darwin':
-    return 'out/{0}/Electron.app/Contents/MacOS/Electron'.format(get_out_dir())
+    return '{0}/Electron.app/Contents/MacOS/Electron'.format(out_dir)
   elif sys.platform == 'win32':
-    return 'out/{0}/electron.exe'.format(get_out_dir())
+    return '{0}/electron.exe'.format(out_dir)
   elif sys.platform == 'linux':
-    return 'out/{0}/electron'.format(get_out_dir())
+    return '{0}/electron'.format(out_dir)
+
+  raise Exception(
+      "get_electron_exec: unexpected platform '{0}'".format(sys.platform))

+ 3 - 3
script/upload.py

@@ -16,7 +16,7 @@ from lib.config import PLATFORM, get_target_arch,  get_env_var, s3_config, \
                        get_zip_name
 from lib.util import get_electron_branding, execute, get_electron_version, \
                      parse_version, scoped_cwd, s3put, get_electron_exec, \
-                     get_out_dir, GN_SRC_DIR
+                     get_out_dir, SRC_DIR
 
 
 ELECTRON_REPO = 'electron/electron'
@@ -84,7 +84,7 @@ def main():
   # Upload free version of ffmpeg.
   ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
   ffmpeg_zip = os.path.join(OUT_DIR, ffmpeg)
-  ffmpeg_build_path = os.path.join(GN_SRC_DIR, 'out', 'ffmpeg', 'ffmpeg.zip')
+  ffmpeg_build_path = os.path.join(SRC_DIR, 'out', 'ffmpeg', 'ffmpeg.zip')
   shutil.copy2(ffmpeg_build_path, ffmpeg_zip)
   upload_electron(release, ffmpeg_zip, args)
 
@@ -97,7 +97,7 @@ def main():
   mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)
   if get_target_arch().startswith('arm'):
     # Upload the native mksnapshot as mksnapshot.zip
-    shutil.copy2(os.path.join(GN_SRC_DIR, 'out', 'native_mksnapshot',
+    shutil.copy2(os.path.join(SRC_DIR, 'out', 'native_mksnapshot',
                               'mksnapshot.zip'), mksnapshot_zip)
     upload_electron(release, mksnapshot_zip, args)
     # Upload the x64 binary for arm/arm64 mksnapshot

+ 2 - 2
tools/win/generate_breakpad_symbols.py

@@ -16,7 +16,7 @@ import subprocess
 import sys
 import threading
 
-GN_SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
+SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
 
 # Duplicated as this script lives in tools not script
 def get_out_dir():
@@ -24,7 +24,7 @@ def get_out_dir():
   override = os.environ.get('ELECTRON_OUT_DIR')
   if override is not None:
     out_dir = override
-  return os.path.join(GN_SRC_DIR, 'out', out_dir)
+  return os.path.join(SRC_DIR, 'out', out_dir)
 
 
 CONCURRENT_TASKS=4

+ 15 - 6
vsts.yml

@@ -2,6 +2,8 @@ jobs:
 - job: Build_Electron_via_GN
   displayName: Build Electron via GN
   timeoutInMinutes: 120
+  variables:
+    CI: true
   steps:
 
   - task: CopyFiles@2
@@ -133,14 +135,21 @@ jobs:
 
   - bash: |
       cd src/electron
-      if [ "$UPLOAD_TO_S3" != "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
+
+      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'
-        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
+        script/upload.py --upload_to_s3
+      else
+        echo 'Uploading Electron release distribution to Github releases'
+        script/upload.py
       fi
-    name: Upload_distribution
+    displayName: Upload distribution
     condition: and(succeeded(), eq(variables['ELECTRON_RELEASE'], '1'))
 
   - task: PublishTestResults@2