appveyor-woa.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. # NOTE IF CHANGING THIS FILE, ALSO APPLY THE CHANGE TO appveyor.yml
  2. # IF APPLICABLE!!!!
  3. #
  4. #
  5. # The config expects the following environment variables to be set:
  6. # - "GN_CONFIG" Build type. One of {'testing', 'release'}.
  7. # - "GN_EXTRA_ARGS" Additional gn arguments for a build config,
  8. # e.g. 'target_cpu="x86"' to build for a 32bit platform.
  9. # https://gn.googlesource.com/gn/+/main/docs/reference.md#var_target_cpu
  10. # Don't forget to set up "NPM_CONFIG_ARCH" and "TARGET_ARCH" accordingly
  11. # if you pass a custom value for 'target_cpu'.
  12. # - "ELECTRON_RELEASE" Set it to '1' upload binaries on success.
  13. # - "NPM_CONFIG_ARCH" E.g. 'x86'. Is used to build native Node.js modules.
  14. # Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "TARGET_ARCH" value.
  15. # - "TARGET_ARCH" Choose from {'ia32', 'x64', 'arm', 'arm64'}.
  16. # Is used in some publishing scripts, but does NOT affect the Electron binary.
  17. # Must match 'target_cpu' passed to "GN_EXTRA_ARGS" and "NPM_CONFIG_ARCH" value.
  18. # - "UPLOAD_TO_STORAGE" Set it to '1' upload a release to the Azure bucket.
  19. # Otherwise the release will be uploaded to the GitHub Releases.
  20. # (The value is only checked if "ELECTRON_RELEASE" is defined.)
  21. #
  22. # The publishing scripts expect access tokens to be defined as env vars,
  23. # but those are not covered here.
  24. #
  25. # AppVeyor docs on variables:
  26. # https://www.appveyor.com/docs/environment-variables/
  27. # https://www.appveyor.com/docs/build-configuration/#secure-variables
  28. # https://www.appveyor.com/docs/build-configuration/#custom-environment-variables
  29. version: 1.0.{build}
  30. build_cloud: electronhq-16-core
  31. image: e-118.0.5949.0
  32. environment:
  33. GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
  34. ELECTRON_OUT_DIR: Default
  35. ELECTRON_ENABLE_STACK_DUMPING: 1
  36. ELECTRON_ALSO_LOG_TO_STDERR: 1
  37. MOCHA_REPORTER: mocha-multi-reporters
  38. MOCHA_MULTI_REPORTERS: "@marshallofsound/mocha-appveyor-reporter, tap"
  39. GOMA_FALLBACK_ON_AUTH_FAILURE: true
  40. DEPOT_TOOLS_WIN_TOOLCHAIN: 1
  41. DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
  42. GYP_MSVS_HASH_27370823e7: 28622d16b1
  43. PYTHONIOENCODING: UTF-8
  44. matrix:
  45. - job_name: Build Arm on X64 Windows
  46. - job_name: Test On Windows On Arm Hardware
  47. job_depends_on: Build Arm on X64 Windows
  48. APPVEYOR_BUILD_WORKER_IMAGE: base-woa
  49. APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
  50. clone_script:
  51. - ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
  52. - ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
  53. - ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
  54. clone_folder: C:\projects\src\electron
  55. skip_branch_with_pr: true
  56. # the first failed job cancels other jobs and fails entire build
  57. matrix:
  58. fast_finish: true
  59. for:
  60. - matrix:
  61. only:
  62. - job_name: Build Arm on X64 Windows
  63. build_script:
  64. - ps: |
  65. node script/yarn.js install --frozen-lockfile
  66. node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
  67. $env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
  68. if ($LASTEXITCODE -eq 0) {
  69. Write-warning "Skipping build for doc-only change"
  70. $env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
  71. Exit-AppveyorBuild
  72. } else {
  73. $global:LASTEXITCODE = 0
  74. }
  75. - cd ..
  76. - ps: Write-Host "Building $env:GN_CONFIG build"
  77. - git config --global core.longpaths true
  78. - ps: >-
  79. if (Test-Path -Path "$pwd\depot_tools") {
  80. Remove-Item -Recurse -Force $pwd\depot_tools
  81. }
  82. - ps: >-
  83. if (Test-Path -Path "$pwd\build-tools") {
  84. Remove-Item -Recurse -Force $pwd\build-tools
  85. }
  86. - git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  87. - ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
  88. - depot_tools\bootstrap\win_tools.bat
  89. - ps: $env:PATH="$pwd\depot_tools;$env:PATH"
  90. - ps: >-
  91. if (Test-Path -Path "$pwd\src\electron") {
  92. Remove-Item -Recurse -Force $pwd\src\electron
  93. }
  94. - ps: >-
  95. if (Test-Path 'env:RAW_GOMA_AUTH') {
  96. $env:GOMA_OAUTH2_CONFIG_FILE = "$pwd\.goma_oauth2_config"
  97. $env:RAW_GOMA_AUTH | Set-Content $env:GOMA_OAUTH2_CONFIG_FILE
  98. }
  99. - git clone https://github.com/electron/build-tools.git
  100. - cd build-tools
  101. - npm install
  102. - mkdir third_party
  103. - ps: >-
  104. node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
  105. - ps: $env:GN_GOMA_FILE = node -e "console.log(require('./src/utils/goma.js').gnFilePath)"
  106. - ps: $env:LOCAL_GOMA_DIR = node -e "console.log(require('./src/utils/goma.js').dir)"
  107. - cd ..\..
  108. - ps: .\src\electron\script\start-goma.ps1 -gomaDir $env:LOCAL_GOMA_DIR
  109. - ps: >-
  110. if (Test-Path 'env:RAW_GOMA_AUTH') {
  111. $goma_login = python3 $env:LOCAL_GOMA_DIR\goma_auth.py info
  112. if ($goma_login -eq 'Login as Fermi Planck') {
  113. Write-warning "Goma authentication is correct";
  114. } else {
  115. Write-warning "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token.";
  116. $host.SetShouldExit(1)
  117. }
  118. }
  119. - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
  120. - ps: >-
  121. if ($env:GN_CONFIG -ne 'release') {
  122. $env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
  123. }
  124. - gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
  125. # Patches are applied in the image bake. Check depshash to see if patches have changed.
  126. - ps: $env:RUN_GCLIENT_SYNC="false"
  127. - ps: $depshash_baked = Get-Content .\src\.depshash -Raw
  128. - ps: cd src\electron
  129. - ps: node script\generate-deps-hash.js
  130. - ps: $depshash = Get-Content .\.depshash -Raw
  131. - ps: cd ..\..
  132. - ps: >-
  133. if ($depshash_baked -ne $depshash) {
  134. $env:RUN_GCLIENT_SYNC="true"
  135. }
  136. - if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
  137. - cd src
  138. - ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
  139. - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
  140. - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") import(\"%GN_GOMA_FILE%\") %GN_EXTRA_ARGS% "
  141. - gn check out/Default //electron:electron_lib
  142. - gn check out/Default //electron:electron_app
  143. - gn check out/Default //electron/shell/common/api:mojo
  144. - if DEFINED GN_GOMA_FILE (ninja -j 300 -C out/Default electron:electron_app) else (ninja -C out/Default electron:electron_app)
  145. - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
  146. - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
  147. - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
  148. - ninja -C out/Default electron:electron_dist_zip
  149. - ninja -C out/Default shell_browser_ui_unittests
  150. - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
  151. # Remove unused args from mksnapshot_args
  152. - ps: >-
  153. Get-Content out/Default/default_mksnapshot_args | Where-Object { -not $_.Contains('--turbo-profiling-input') -And -not $_.Contains('builtins-pgo') } | Set-Content out/Default/mksnapshot_args
  154. - ninja -C out/Default electron:electron_mksnapshot_zip
  155. - cd out\Default
  156. - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
  157. - cd ..\..
  158. - ninja -C out/Default electron:hunspell_dictionaries_zip
  159. - ninja -C out/Default electron:electron_chromedriver_zip
  160. - ninja -C out/Default electron:node_headers
  161. - python3 %LOCAL_GOMA_DIR%\goma_ctl.py stat
  162. - ps: >-
  163. Get-CimInstance -Namespace root\cimv2 -Class Win32_product | Select vendor, description, @{l='install_location';e='InstallLocation'}, @{l='install_date';e='InstallDate'}, @{l='install_date_2';e='InstallDate2'}, caption, version, name, @{l='sku_number';e='SKUNumber'} | ConvertTo-Json | Out-File -Encoding utf8 -FilePath .\installed_software.json
  164. - python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
  165. - 7z a node_headers.zip out\Default\gen\node_headers
  166. - ps: >-
  167. if ($env:GN_CONFIG -eq 'release') {
  168. # Needed for msdia140.dll on 64-bit windows
  169. $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
  170. ninja -C out/Default electron:electron_symbols
  171. }
  172. - ps: >-
  173. if ($env:GN_CONFIG -eq 'release') {
  174. python3 electron\script\zip-symbols.py
  175. appveyor-retry appveyor PushArtifact out/Default/symbols.zip
  176. } else {
  177. # It's useful to have pdb files when debugging testing builds that are
  178. # built on CI.
  179. 7z a pdb.zip out\Default\*.pdb
  180. }
  181. - python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
  182. - ps: |
  183. cd C:\projects\src
  184. $missing_artifacts = $false
  185. if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
  186. Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
  187. } else {
  188. $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
  189. foreach($artifact_name in $artifacts_to_validate) {
  190. if ($artifact_name -eq 'ffmpeg.zip') {
  191. $artifact_file = "out\ffmpeg\ffmpeg.zip"
  192. } elseif (
  193. $artifact_name -eq 'node_headers.zip') {
  194. $artifact_file = $artifact_name
  195. } else {
  196. $artifact_file = "out\Default\$artifact_name"
  197. }
  198. if (-not(Test-Path $artifact_file)) {
  199. Write-warning "$artifact_name is missing and cannot be added to artifacts"
  200. $missing_artifacts = $true
  201. }
  202. }
  203. }
  204. if ($missing_artifacts) {
  205. throw "Build failed due to missing artifacts"
  206. }
  207. deploy_script:
  208. - cd electron
  209. - ps: >-
  210. if (Test-Path Env:\ELECTRON_RELEASE) {
  211. if (Test-Path Env:\UPLOAD_TO_STORAGE) {
  212. Write-Output "Uploading Electron release distribution to azure"
  213. & python3 script\release\uploaders\upload.py --verbose --upload_to_storage
  214. } else {
  215. Write-Output "Uploading Electron release distribution to github releases"
  216. & python3 script\release\uploaders\upload.py --verbose
  217. }
  218. }
  219. on_finish:
  220. # Uncomment this lines to enable RDP
  221. # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  222. - cd C:\projects\src
  223. - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
  224. - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
  225. - if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
  226. - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
  227. - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
  228. - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
  229. - if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
  230. - if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
  231. - if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
  232. - ps: >-
  233. if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
  234. appveyor-retry appveyor PushArtifact pdb.zip
  235. }
  236. - matrix:
  237. only:
  238. - job_name: Test On Windows On Arm Hardware
  239. environment:
  240. IGNORE_YARN_INSTALL_ERROR: 1
  241. ELECTRON_TEST_RESULTS_DIR: junit
  242. MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
  243. MOCHA_REPORTER: mocha-multi-reporters
  244. ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
  245. build_script:
  246. - ps: |
  247. node script/yarn.js install --frozen-lockfile
  248. node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
  249. if ($LASTEXITCODE -eq 0) {
  250. Write-warning "Skipping build for doc only change"
  251. Exit-AppveyorBuild
  252. } else {
  253. $global:LASTEXITCODE = 0
  254. }
  255. - cd ..
  256. - mkdir out\Default
  257. - cd ..
  258. - ps: |
  259. # Download build artifacts
  260. $apiUrl = 'https://ci.appveyor.com/api'
  261. $build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
  262. $artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib')
  263. foreach ($job in $build_info.build.jobs) {
  264. if ($job.name -eq "Build Arm on X64 Windows") {
  265. $jobId = $job.jobId
  266. foreach($artifact_name in $artifacts_to_download) {
  267. if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
  268. $outfile = "src\out\Default\$artifact_name"
  269. } else {
  270. $outfile = $artifact_name
  271. }
  272. Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
  273. }
  274. # Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
  275. # Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
  276. # 7z x -y -osrc pdb.zip
  277. }
  278. }
  279. - ps: |
  280. $out_default_zips = @('dist.zip')
  281. foreach($zip_name in $out_default_zips) {
  282. 7z x -y -osrc\out\Default $zip_name
  283. }
  284. - ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
  285. - ps: 7z x -y -osrc node_headers.zip
  286. test_script:
  287. # Workaround for https://github.com/appveyor/ci/issues/2420
  288. - set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
  289. - ps: |
  290. cd src
  291. New-Item .\out\Default\gen\node_headers\Release -Type directory
  292. Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
  293. - set npm_config_nodedir=%cd%\out\Default\gen\node_headers
  294. - set npm_config_arch=arm64
  295. - cd electron
  296. # Explicitly set npm_config_arch because the .env doesn't persist
  297. - ps: >-
  298. if ($env:TARGET_ARCH -eq 'ia32') {
  299. $env:npm_config_arch = "ia32"
  300. }
  301. - echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
  302. - cd ..
  303. - echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
  304. on_finish:
  305. # Uncomment these lines to enable RDP
  306. # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  307. - if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )