appveyor.yml 10 KB

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