appveyor.yml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # The config expects the following environment variables to be set:
  2. # - "GN_CONFIG" Build type. One of {'testing', 'release'}.
  3. # - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
  4. # e.g. 'target_cpu="x86"' to build for a 32bit platform.
  5. # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_cpu
  6. # Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordningly
  7. # if you pass a custom value for 'target_cpu'.
  8. # - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
  9. # - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
  10. # Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
  11. # - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64', 'mips64el'}.
  12. # Is used in some publishing scripts, but does NOT affect the Electron binary.
  13. # Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
  14. # - "UPLOAD_TO_S3" Set it to '1' upload a release to the S3 bucket.
  15. # Otherwise the release will be uploaded to the Github Releases.
  16. # (The value is only checked if "ELECTRON_RELEASE" is defined.)
  17. #
  18. # The publishing scripts expect access tokens to be defined as env vars,
  19. # but those are not covered here.
  20. #
  21. # AppVeyor docs on variables:
  22. # https://www.appveyor.com/docs/environment-variables/
  23. # https://www.appveyor.com/docs/build-configuration/#secure-variables
  24. # https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
  25. # Uncomment these lines to enable RDP
  26. on_finish:
  27. - ps: >-
  28. if ($env:TARGET_ARCH -eq 'x64') {
  29. echo "SETTING BAKE IMAGE"
  30. $env:APPVEYOR_RDP_PASSWORD = "electron"
  31. $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  32. }
  33. version: 1.0.{build}
  34. build_cloud: electron-16-core2
  35. image: electron-test-bake-image
  36. environment:
  37. GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
  38. ELECTRON_OUT_DIR: Default
  39. ELECTRON_ENABLE_STACK_DUMPING: 1
  40. MOCHA_REPORTER: mocha-multi-reporters
  41. MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
  42. GOMA_FALLBACK_ON_AUTH_FAILURE: true
  43. DEPOT_TOOLS_WIN_TOOLCHAIN: 0
  44. PYTHONIOENCODING: UTF-8
  45. build_script:
  46. - echo "Building $env:GN_CONFIG build"
  47. - git config --global core.longpaths true
  48. - cd ..
  49. # - ps: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  50. - ps: $env:PATH="$pwd\depot_tools;$env:PATH"
  51. - ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
  52. - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
  53. - ps: >-
  54. if ($env:GN_CONFIG -ne 'release') {
  55. $env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
  56. }
  57. - >-
  58. gclient config
  59. --name "src\electron"
  60. --unmanaged
  61. %GCLIENT_EXTRA_ARGS%
  62. "https://github.com/electron/electron"
  63. - gclient sync --with_branch_heads --with_tags
  64. - ps: >-
  65. if (Test-Path 'env:RAW_GOMA_AUTH') {
  66. $env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
  67. $env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
  68. }
  69. - git clone https://github.com/electron/build-tools.git
  70. - cd build-tools
  71. - npm install
  72. - mkdir third_party
  73. - ps: >-
  74. node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
  75. - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
  76. - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
  77. - ps: node -e "console.log(require('./src/utils/goma.js').ensure())"
  78. - cd ..\src
  79. - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
  80. - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
  81. - gn check out/Default //electron:electron_lib
  82. - gn check out/Default //electron:electron_app
  83. - gn check out/Default //electron/shell/common/api:mojo
  84. - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
  85. - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
  86. - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
  87. - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
  88. - ninja -C out/Default electron:electron_dist_zip
  89. - ninja -C out/Default shell_browser_ui_unittests
  90. - gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
  91. - ninja -C out/Default electron:electron_mksnapshot_zip
  92. - cd out\Default
  93. - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
  94. - cd ..\..
  95. - ninja -C out/Default electron:hunspell_dictionaries_zip
  96. - ninja -C out/Default electron:electron_chromedriver_zip
  97. - ninja -C out/Default third_party/electron_node:headers
  98. - python %LOCAL_GOMA_DIR%\goma_ctl.py stat
  99. - python electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
  100. - appveyor PushArtifact out/Default/windows_toolchain_profile.json
  101. - appveyor PushArtifact out/Default/dist.zip
  102. - appveyor PushArtifact out/Default/shell_browser_ui_unittests.exe
  103. - appveyor PushArtifact out/Default/chromedriver.zip
  104. - appveyor PushArtifact out/ffmpeg/ffmpeg.zip
  105. - 7z a node_headers.zip out\Default\gen\node_headers
  106. - appveyor PushArtifact node_headers.zip
  107. - appveyor PushArtifact out/Default/mksnapshot.zip
  108. - appveyor PushArtifact out/Default/hunspell_dictionaries.zip
  109. - appveyor PushArtifact out/Default/electron.lib
  110. - ps: >-
  111. if ($env:GN_CONFIG -eq 'release') {
  112. # Needed for msdia140.dll on 64-bit windows
  113. $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
  114. ninja -C out/Default electron:electron_symbols
  115. }
  116. - ps: >-
  117. if ($env:GN_CONFIG -eq 'release') {
  118. python electron\script\zip-symbols.py
  119. appveyor-retry appveyor PushArtifact out/Default/symbols.zip
  120. } else {
  121. # It's useful to have pdb files when debugging testing builds that are
  122. # built on CI.
  123. 7z a pdb.zip out\Default\*.pdb
  124. appveyor-retry appveyor PushArtifact pdb.zip
  125. }
  126. - python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
  127. test_script:
  128. # Workaround for https://github.com/appveyor/ci/issues/2420
  129. - set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
  130. - ps: >-
  131. if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
  132. $env:RUN_TESTS="true"
  133. }
  134. - ps: >-
  135. if ($env:RUN_TESTS -eq 'true') {
  136. New-Item .\out\Default\gen\node_headers\Release -Type directory
  137. Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
  138. } else {
  139. Write-Host "Skipping tests for $env:GN_CONFIG build"
  140. }
  141. - cd electron
  142. # CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
  143. - if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --trace-uncaught --enable-logging --disable-features=CalculateNativeWinOcclusion )
  144. - cd ..
  145. - if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
  146. - echo "About to verify mksnapshot"
  147. - if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
  148. - echo "Done verifying mksnapshot"
  149. - if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
  150. - echo "Done verifying chromedriver"
  151. deploy_script:
  152. - cd electron
  153. - ps: >-
  154. if (Test-Path Env:\ELECTRON_RELEASE) {
  155. if (Test-Path Env:\UPLOAD_TO_S3) {
  156. Write-Output "Uploading Electron release distribution to s3"
  157. & python script\release\uploaders\upload.py --verbose --upload_to_s3
  158. } else {
  159. Write-Output "Uploading Electron release distribution to github releases"
  160. & python script\release\uploaders\upload.py --verbose
  161. }
  162. } elseif (Test-Path Env:\TEST_WOA) {
  163. node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
  164. }