appveyor.yml 11 KB

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