appveyor.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. version: 1.0.{build}
  26. build_cloud: electron-16-core
  27. image: vs2019bt-16.16.11
  28. environment:
  29. GIT_CACHE_PATH: C:\Users\electron\libcc_cache
  30. ELECTRON_OUT_DIR: Default
  31. ELECTRON_ENABLE_STACK_DUMPING: 1
  32. ELECTRON_ALSO_LOG_TO_STDERR: 1
  33. MOCHA_REPORTER: mocha-multi-reporters
  34. MOCHA_MULTI_REPORTERS: mocha-appveyor-reporter, tap
  35. GOMA_FALLBACK_ON_AUTH_FAILURE: true
  36. notifications:
  37. - provider: Webhook
  38. url: https://electron-mission-control.herokuapp.com/rest/appveyor-hook
  39. method: POST
  40. headers:
  41. x-mission-control-secret:
  42. secure: 90BLVPcqhJPG7d24v0q/RRray6W3wDQ8uVQlQjOHaBWkw1i8FoA1lsjr2C/v1dVok+tS2Pi6KxDctPUkwIb4T27u4RhvmcPzQhVpfwVJAG9oNtq+yKN7vzHfg7k/pojEzVdJpQLzeJGcSrZu7VY39Q==
  43. on_build_success: false
  44. on_build_failure: true
  45. on_build_status_changed: false
  46. build_script:
  47. - ps: >-
  48. if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
  49. Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
  50. } else {
  51. node script/yarn.js install --frozen-lockfile
  52. $result = node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER --prBranch=$env:APPVEYOR_REPO_BRANCH
  53. Write-Output $result
  54. if ($result.ExitCode -eq 0) {
  55. Write-warning "Skipping build for doc only change"; Exit-AppveyorBuild
  56. }
  57. }
  58. - echo "Building $env:GN_CONFIG build"
  59. - git config --global core.longpaths true
  60. - cd ..
  61. - mkdir src
  62. - update_depot_tools.bat
  63. - ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
  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. - cd ..
  78. - ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
  79. - ps: >-
  80. if (Test-Path 'env:RAW_GOMA_AUTH') {
  81. $goma_login = python $env:LOCAL_GOMA_DIR\goma_auth.py info
  82. if ($goma_login -eq 'Login as Fermi Planck') {
  83. Write-warning "Goma authentication is correct";
  84. } else {
  85. Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
  86. $host.SetShouldExit(1)
  87. }
  88. }
  89. - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
  90. - ps: >-
  91. if ($env:GN_CONFIG -ne 'release') {
  92. $env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
  93. }
  94. - >-
  95. gclient config
  96. --name "src\electron"
  97. --unmanaged
  98. %GCLIENT_EXTRA_ARGS%
  99. "https://github.com/electron/electron"
  100. - ps: >-
  101. if ($env:GN_CONFIG -eq 'release') {
  102. $env:RUN_GCLIENT_SYNC="true"
  103. } else {
  104. cd src\electron
  105. node script\generate-deps-hash.js
  106. $depshash = Get-Content .\.depshash -Raw
  107. $zipfile = "Z:\$depshash.7z"
  108. cd ..\..
  109. if (Test-Path -Path $zipfile) {
  110. # file exists, unzip and then gclient sync
  111. 7z x -y $zipfile -mmt=30 -aoa
  112. if (-not (Test-Path -Path "src\buildtools")) {
  113. # the zip file must be corrupt - resync
  114. $env:RUN_GCLIENT_SYNC="true"
  115. if ($env:TARGET_ARCH -ne 'ia32') {
  116. # only save on x64/woa to avoid contention saving
  117. $env:SAVE_GCLIENT_SRC="true"
  118. }
  119. } else {
  120. # update angle
  121. cd src\third_party\angle
  122. git remote set-url origin https://chromium.googlesource.com/angle/angle.git
  123. git fetch
  124. cd ..\..\..
  125. }
  126. } else {
  127. # file does not exist, gclient sync, then zip
  128. $env:RUN_GCLIENT_SYNC="true"
  129. if ($env:TARGET_ARCH -ne 'ia32') {
  130. # only save on x64/woa to avoid contention saving
  131. $env:SAVE_GCLIENT_SRC="true"
  132. }
  133. }
  134. }
  135. - if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync )
  136. - ps: >-
  137. if ($env:SAVE_GCLIENT_SRC -eq 'true') {
  138. # archive current source for future use
  139. # only run on x64/woa to avoid contention saving
  140. $(7z a $zipfile src -xr!android_webview -xr!electron -xr'!*\.git' -xr!third_party\WebKit\LayoutTests! -xr!third_party\blink\web_tests -xr!third_party\blink\perf_tests -slp -t7z -mmt=30)
  141. if ($LASTEXITCODE -ne 0) {
  142. Write-warning "Could not save source to shared drive; continuing anyway"
  143. }
  144. # build time generation of file gen/angle/angle_commit.h depends on
  145. # third_party/angle/.git
  146. # https://chromium-review.googlesource.com/c/angle/angle/+/2074924
  147. $(7z a $zipfile src\third_party\angle\.git)
  148. if ($LASTEXITCODE -ne 0) {
  149. Write-warning "Failed to add third_party\angle\.git; continuing anyway"
  150. }
  151. # build time generation of file dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
  152. # https://dawn-review.googlesource.com/c/dawn/+/83901
  153. $(7z a $zipfile src\third_party\dawn\.git)
  154. if ($LASTEXITCODE -ne 0) {
  155. Write-warning "Failed to add third_party\dawn\.git; continuing anyway"
  156. }
  157. }
  158. - cd src
  159. - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
  160. - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
  161. - gn check out/Default //electron:electron_lib
  162. - gn check out/Default //electron:electron_app
  163. - gn check out/Default //electron/shell/common/api:mojo
  164. - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
  165. - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
  166. - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
  167. - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
  168. - ninja -C out/Default electron:electron_dist_zip
  169. - ninja -C out/Default shell_browser_ui_unittests
  170. - gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
  171. - ninja -C out/Default electron:electron_mksnapshot_zip
  172. - cd out\Default
  173. - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
  174. - cd ..\..
  175. - ninja -C out/Default electron:hunspell_dictionaries_zip
  176. - ninja -C out/Default electron:electron_chromedriver_zip
  177. - ninja -C out/Default third_party/electron_node:headers
  178. - python %LOCAL_GOMA_DIR%\goma_ctl.py stat
  179. - python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
  180. - 7z a node_headers.zip out\Default\gen\node_headers
  181. # Temporarily disable symbol generation on 32-bit Windows due to failures
  182. - ps: >-
  183. if ($env:GN_CONFIG -eq 'release' -And $env:TARGET_ARCH -ne 'ia32') {
  184. # Needed for msdia140.dll on 64-bit windows
  185. $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
  186. ninja -C out/Default electron:electron_symbols
  187. }
  188. - ps: >-
  189. if ($env:GN_CONFIG -eq 'release') {
  190. if ($env:TARGET_ARCH -ne 'ia32') {
  191. python electron\script\zip-symbols.py
  192. appveyor-retry appveyor PushArtifact out/Default/symbols.zip
  193. }
  194. } else {
  195. # It's useful to have pdb files when debugging testing builds that are
  196. # built on CI.
  197. 7z a pdb.zip out\Default\*.pdb
  198. }
  199. - python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
  200. test_script:
  201. # Workaround for https://github.com/appveyor/ci/issues/2420
  202. - set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
  203. - ps: >-
  204. if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
  205. $env:RUN_TESTS="true"
  206. }
  207. - ps: >-
  208. if ($env:RUN_TESTS -eq 'true') {
  209. New-Item .\out\Default\gen\node_headers\Release -Type directory
  210. Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
  211. } else {
  212. echo "Skipping tests for $env:GN_CONFIG build"
  213. }
  214. - cd electron
  215. # CalculateNativeWinOcclusion is disabled due to https://bugs.chromium.org/p/chromium/issues/detail?id=1139022
  216. - if "%RUN_TESTS%"=="true" ( echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
  217. - if "%RUN_TESTS%"=="true" ( echo Running remote test suite & node script/yarn test -- --trace-uncaught --runners=remote --runTestFilesSeperately --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
  218. - if "%RUN_TESTS%"=="true" ( echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log --disable-features=CalculateNativeWinOcclusion )
  219. - cd ..
  220. - 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 )
  221. - echo "About to verify mksnapshot"
  222. - if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
  223. - echo "Done verifying mksnapshot"
  224. - if "%RUN_TESTS%"=="true" ( echo Verifying chromedriver & python electron\script\verify-chromedriver.py --build-dir out\Default --source-root %cd% )
  225. - echo "Done verifying chromedriver"
  226. deploy_script:
  227. - cd electron
  228. - ps: >-
  229. if (Test-Path Env:\ELECTRON_RELEASE) {
  230. if (Test-Path Env:\UPLOAD_TO_S3) {
  231. Write-Output "Uploading Electron release distribution to s3"
  232. & python script\release\uploaders\upload.py --verbose --upload_to_s3
  233. } else {
  234. Write-Output "Uploading Electron release distribution to github releases"
  235. & python script\release\uploaders\upload.py --verbose
  236. }
  237. } elseif (Test-Path Env:\TEST_WOA) {
  238. node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
  239. }
  240. on_finish:
  241. # Uncomment this lines to enable RDP
  242. #- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  243. - cd ..
  244. - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
  245. - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
  246. - if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
  247. - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
  248. - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
  249. - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
  250. - if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
  251. - if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
  252. - if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
  253. - ps: >-
  254. if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
  255. appveyor-retry appveyor PushArtifact pdb.zip
  256. }
  257. - if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )