appveyor-woa.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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-129.0.6638.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. DEPOT_TOOLS_WIN_TOOLCHAIN: 1
  40. DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL: "https://dev-cdn.electronjs.org/windows-toolchains/_"
  41. GYP_MSVS_HASH_7393122652: 3ba76c5c20
  42. PYTHONIOENCODING: UTF-8
  43. matrix:
  44. - job_name: Build Arm on X64 Windows
  45. - job_name: Test On Windows On Arm Hardware
  46. job_depends_on: Build Arm on X64 Windows
  47. APPVEYOR_BUILD_WORKER_IMAGE: base-woa
  48. APPVEYOR_BUILD_WORKER_CLOUD: electronhq-woa
  49. clone_script:
  50. - ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
  51. - ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
  52. - ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/head; git checkout -qf FETCH_HEAD}
  53. clone_folder: C:\projects\src\electron
  54. skip_branch_with_pr: true
  55. # the first failed job cancels other jobs and fails entire build
  56. matrix:
  57. fast_finish: true
  58. for:
  59. - matrix:
  60. only:
  61. - job_name: Build Arm on X64 Windows
  62. build_script:
  63. - ps: |
  64. node script/yarn.js install --frozen-lockfile
  65. node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
  66. $env:SHOULD_SKIP_ARTIFACT_VALIDATION = "false"
  67. if ($LASTEXITCODE -eq 0) {
  68. Write-warning "Skipping build for doc-only change"
  69. $env:SHOULD_SKIP_ARTIFACT_VALIDATION = "true"
  70. Exit-AppveyorBuild
  71. } else {
  72. $global:LASTEXITCODE = 0
  73. }
  74. - cd ..
  75. - ps: Write-Host "Building $env:GN_CONFIG build"
  76. - git config --global core.longpaths true
  77. - ps: >-
  78. if (Test-Path -Path "$pwd\depot_tools") {
  79. Remove-Item -Recurse -Force $pwd\depot_tools
  80. }
  81. - ps: >-
  82. if (Test-Path -Path "$pwd\build-tools") {
  83. Remove-Item -Recurse -Force $pwd\build-tools
  84. }
  85. - git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  86. - ps: New-Item -Name depot_tools\.disable_auto_update -ItemType File
  87. - depot_tools\bootstrap\win_tools.bat
  88. - ps: $env:PATH="$pwd\depot_tools;$env:PATH"
  89. - ps: >-
  90. if (Test-Path -Path "$pwd\src\electron") {
  91. Remove-Item -Recurse -Force $pwd\src\electron
  92. }
  93. - git clone https://github.com/electron/build-tools.git
  94. - cd build-tools
  95. - npx yarn --ignore-engines
  96. - mkdir third_party
  97. - ps: >-
  98. node -e "require('./src/utils/reclient.js').downloadAndPrepare({})"
  99. - ps: $env:RECLIENT_HELPER = node -p "require('./src/utils/reclient.js').helperPath({})"
  100. - ps: >-
  101. & $env:RECLIENT_HELPER login
  102. - ps: >-
  103. $env:RBE_service = node -e "console.log(require('./src/utils/reclient.js').serviceAddress)"
  104. - ps: >-
  105. $env:RBE_experimental_credentials_helper = $env:RECLIENT_HELPER
  106. - ps: >-
  107. $env:RBE_experimental_credentials_helper_args = "print"
  108. - cd ..\..
  109. - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
  110. - ps: >-
  111. if ($env:GN_CONFIG -ne 'release') {
  112. $env:NINJA_STATUS="[%r processes, %f/%t @ %o/s : %es] "
  113. }
  114. - gclient config --name "src\electron" --unmanaged %GCLIENT_EXTRA_ARGS% "https://github.com/electron/electron"
  115. # Patches are applied in the image bake. Check depshash to see if patches have changed.
  116. - ps: $env:RUN_GCLIENT_SYNC="false"
  117. - ps: $depshash_baked = Get-Content .\src\.depshash -Raw
  118. - ps: cd src\electron
  119. - ps: node script\generate-deps-hash.js
  120. - ps: $depshash = Get-Content .\.depshash -Raw
  121. - ps: cd ..\..
  122. - ps: >-
  123. if ($depshash_baked -ne $depshash) {
  124. $env:RUN_GCLIENT_SYNC="true"
  125. }
  126. - if "%RUN_GCLIENT_SYNC%"=="true" ( gclient sync --with_branch_heads --with_tags ) else ( gclient runhooks )
  127. - cd src
  128. - ps: $env:PATH="$pwd\third_party\ninja;$env:PATH"
  129. - set BUILD_CONFIG_PATH=//electron/build/args/%GN_CONFIG%.gn
  130. - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") use_remoteexec=true %GN_EXTRA_ARGS% "
  131. - gn check out/Default //electron:electron_lib
  132. - gn check out/Default //electron:electron_app
  133. - gn check out/Default //electron/shell/common/api:mojo
  134. - if DEFINED ELECTRON_RBE_JWT (autoninja -j 300 -C out/Default electron:electron_app) else (autoninja -C out/Default electron:electron_app)
  135. - if "%GN_CONFIG%"=="testing" ( python C:\depot_tools\post_build_ninja_summary.py -C out\Default )
  136. - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true %GN_EXTRA_ARGS%"
  137. - autoninja -C out/ffmpeg electron:electron_ffmpeg_zip
  138. - autoninja -C out/Default electron:electron_dist_zip
  139. - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
  140. # Remove unused args from mksnapshot_args
  141. - ps: >-
  142. 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
  143. - autoninja -C out/Default electron:electron_mksnapshot_zip
  144. - cd out\Default
  145. - 7z a mksnapshot.zip mksnapshot_args gen\v8\embedded.S
  146. - cd ..\..
  147. - autoninja -C out/Default electron:hunspell_dictionaries_zip
  148. - autoninja -C out/Default electron:electron_chromedriver_zip
  149. - autoninja -C out/Default electron:node_headers
  150. - ps: >-
  151. 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
  152. - python3 electron/build/profile_toolchain.py --output-json=out/Default/windows_toolchain_profile.json
  153. - 7z a node_headers.zip out\Default\gen\node_headers
  154. - 7z a nan.zip third_party\nan
  155. - ps: >-
  156. if ($env:GN_CONFIG -eq 'release') {
  157. # Needed for msdia140.dll on 64-bit windows
  158. $env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
  159. autoninja -C out/Default electron:electron_symbols
  160. }
  161. - ps: >-
  162. if ($env:GN_CONFIG -eq 'release') {
  163. python3 electron\script\zip-symbols.py
  164. appveyor-retry appveyor PushArtifact out/Default/symbols.zip
  165. } else {
  166. # It's useful to have pdb files when debugging testing builds that are
  167. # built on CI.
  168. 7z a pdb.zip out\Default\*.pdb
  169. }
  170. - ps: |
  171. $manifest_file = "electron/script/zip_manifests/dist_zip.win.$env:TARGET_ARCH.manifest"
  172. python3 electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip $manifest_file
  173. if ($LASTEXITCODE -ne 0) {
  174. throw "Zip contains files not listed in the manifest $manifest_file"
  175. }
  176. - ps: |
  177. cd C:\projects\src
  178. $missing_artifacts = $false
  179. if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
  180. Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
  181. } else {
  182. $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip','nan.zip'
  183. foreach($artifact_name in $artifacts_to_validate) {
  184. if ($artifact_name -eq 'ffmpeg.zip') {
  185. $artifact_file = "out\ffmpeg\ffmpeg.zip"
  186. } elseif (
  187. $artifact_name -eq 'node_headers.zip') {
  188. $artifact_file = $artifact_name
  189. } elseif (
  190. $artifact_name -eq 'nan.zip') {
  191. $artifact_file = $artifact_name
  192. } else {
  193. $artifact_file = "out\Default\$artifact_name"
  194. }
  195. if (-not(Test-Path $artifact_file)) {
  196. Write-warning "$artifact_name is missing and cannot be added to artifacts"
  197. $missing_artifacts = $true
  198. }
  199. }
  200. }
  201. if ($missing_artifacts) {
  202. throw "Build failed due to missing artifacts"
  203. }
  204. deploy_script:
  205. - cd electron
  206. - ps: >-
  207. if (Test-Path Env:\ELECTRON_RELEASE) {
  208. if (Test-Path Env:\UPLOAD_TO_STORAGE) {
  209. Write-Output "Uploading Electron release distribution to azure"
  210. & python3 script\release\uploaders\upload.py --verbose --upload_to_storage
  211. } else {
  212. Write-Output "Uploading Electron release distribution to github releases"
  213. & python3 script\release\uploaders\upload.py --verbose
  214. }
  215. }
  216. on_finish:
  217. # Uncomment this lines to enable RDP
  218. # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  219. - cd C:\projects\src
  220. - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
  221. - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
  222. - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
  223. - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
  224. - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
  225. - if exist nan.zip (appveyor-retry appveyor PushArtifact nan.zip)
  226. - if exist out\Default\mksnapshot.zip (appveyor-retry appveyor PushArtifact out\Default\mksnapshot.zip)
  227. - if exist out\Default\hunspell_dictionaries.zip (appveyor-retry appveyor PushArtifact out\Default\hunspell_dictionaries.zip)
  228. - if exist out\Default\electron.lib (appveyor-retry appveyor PushArtifact out\Default\electron.lib)
  229. - ps: >-
  230. if ((Test-Path "pdb.zip") -And ($env:GN_CONFIG -ne 'release')) {
  231. appveyor-retry appveyor PushArtifact pdb.zip
  232. }
  233. - matrix:
  234. only:
  235. - job_name: Test On Windows On Arm Hardware
  236. environment:
  237. IGNORE_YARN_INSTALL_ERROR: 1
  238. ELECTRON_TEST_RESULTS_DIR: junit
  239. MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
  240. MOCHA_REPORTER: mocha-multi-reporters
  241. ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
  242. build_script:
  243. - ps: |
  244. node script/yarn.js install --frozen-lockfile
  245. node script/doc-only-change.js --prNumber=$env:APPVEYOR_PULL_REQUEST_NUMBER
  246. if ($LASTEXITCODE -eq 0) {
  247. Write-warning "Skipping build for doc only change"
  248. Exit-AppveyorBuild
  249. } else {
  250. $global:LASTEXITCODE = 0
  251. }
  252. - cd ..
  253. - mkdir out\Default
  254. - cd ..
  255. - ps: |
  256. # Download build artifacts
  257. $apiUrl = 'https://ci.appveyor.com/api'
  258. $build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
  259. $artifacts_to_download = @('dist.zip','ffmpeg.zip','node_headers.zip','electron.lib', 'nan.zip')
  260. foreach ($job in $build_info.build.jobs) {
  261. if ($job.name -eq "Build Arm on X64 Windows") {
  262. $jobId = $job.jobId
  263. foreach($artifact_name in $artifacts_to_download) {
  264. if ($artifact_name -eq 'electron.lib') {
  265. $outfile = "src\out\Default\$artifact_name"
  266. } else {
  267. $outfile = $artifact_name
  268. }
  269. Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifact_name" -OutFile $outfile
  270. }
  271. # Uncomment the following lines to download the pdb.zip to show real stacktraces when crashes happen during testing
  272. Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/pdb.zip" -OutFile pdb.zip
  273. 7z x -y -osrc pdb.zip
  274. }
  275. }
  276. - ps: |
  277. $out_default_zips = @('dist.zip')
  278. foreach($zip_name in $out_default_zips) {
  279. 7z x -y -osrc\out\Default $zip_name
  280. }
  281. - ps: 7z x -y -osrc\out\ffmpeg ffmpeg.zip
  282. - ps: 7z x -y -osrc node_headers.zip
  283. - ps: 7z x -y -osrc nan.zip
  284. test_script:
  285. # Workaround for https://github.com/appveyor/ci/issues/2420
  286. - set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
  287. - ps: |
  288. cd src
  289. New-Item .\out\Default\gen\node_headers\Release -Type directory
  290. Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
  291. - set npm_config_nodedir=%cd%\out\Default\gen\node_headers
  292. - set npm_config_arch=arm64
  293. - cd electron
  294. # Explicitly set npm_config_arch because the .env doesn't persist
  295. - ps: >-
  296. if ($env:TARGET_ARCH -eq 'ia32') {
  297. $env:npm_config_arch = "ia32"
  298. }
  299. - echo Running main test suite & node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion
  300. - cd ..
  301. - echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
  302. on_finish:
  303. # Uncomment these lines to enable RDP
  304. # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
  305. - if exist electron\electron.log ( appveyor-retry appveyor PushArtifact electron\electron.log )