appveyor-woa.yml 18 KB

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