appveyor.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # The config expects the following environment variables to be set:
  2. # - "GN_CONFIG" Build type. One of {'debug', '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. version: 1.0.{build}
  26. build_cloud: libcc-20
  27. image: libcc-20-vs2017-15.7.4
  28. environment:
  29. GIT_CACHE_PATH: C:\Users\electron\libcc_cache
  30. DISABLE_CRASH_REPORTER_TESTS: true
  31. ELECTRON_OUT_DIR: Default
  32. build_script:
  33. - ps: >-
  34. if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
  35. Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild
  36. }
  37. - echo "Building $env:GN_CONFIG build"
  38. - git config --global core.longpaths true
  39. - cd ..
  40. - md src
  41. - ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
  42. - ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
  43. - ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
  44. - ps: >-
  45. if ($env:GN_CONFIG -eq 'release') {
  46. $env:GCLIENT_EXTRA_ARGS="--custom-var=checkout_boto=True --custom-var=checkout_requests=True"
  47. }
  48. - >-
  49. gclient config
  50. --name "src\electron"
  51. --unmanaged
  52. %GCLIENT_EXTRA_ARGS%
  53. "https://github.com/electron/electron"
  54. - gclient sync --with_branch_heads --with_tags
  55. - cd src
  56. - ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
  57. - gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"
  58. - ninja -C out/Default electron:electron_app
  59. - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
  60. - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
  61. - ninja -C out/Default electron:electron_dist_zip
  62. - ninja -C out/Default electron:electron_mksnapshot_zip
  63. - ninja -C out/Default electron:electron_chromedriver_zip
  64. - ninja -C out/Default third_party/electron_node:headers
  65. - appveyor PushArtifact out/Default/dist.zip
  66. - appveyor PushArtifact out/Default/chromedriver.zip
  67. - appveyor PushArtifact out/ffmpeg/ffmpeg.zip
  68. - ps: >-
  69. if ($env:GN_CONFIG -eq 'release') {
  70. ninja -C out/Default third_party/breakpad:dump_syms
  71. }
  72. - if "%GN_CONFIG%"=="release" ( python electron\script\dump-symbols.py -d %cd%\out\Default\breakpad_symbols -v)
  73. - ps: >-
  74. if ($env:GN_CONFIG -eq 'release') {
  75. python electron\script\zip-symbols.py
  76. appveyor PushArtifact out/Default/symbols.zip
  77. }
  78. test_script:
  79. - ps: >-
  80. if ((-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
  81. $env:RUN_TESTS="true"
  82. }
  83. - 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 )
  84. - if "%RUN_TESTS%"=="true" ( echo Verifying mksnapshot & python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd% )
  85. - ps: >-
  86. if ($env:RUN_TESTS -eq 'true') {
  87. New-Item .\out\Default\gen\node_headers\Release -Type directory
  88. Copy-Item -path .\out\Default\electron.lib -destination .\out\Default\gen\node_headers\Release\node.lib
  89. } else {
  90. echo "Skipping tests for $env:GN_CONFIG build"
  91. }
  92. - cd electron
  93. - if "%RUN_TESTS%"=="true" ( echo Running test suite & npm run test -- --ci )
  94. - cd ..
  95. deploy_script:
  96. - cd electron
  97. - ps: >-
  98. if (Test-Path Env:\ELECTRON_RELEASE) {
  99. if (Test-Path Env:\UPLOAD_TO_S3) {
  100. Write-Output "Uploading Electron release distribution to s3"
  101. & python script\upload.py --upload_to_s3
  102. } else {
  103. Write-Output "Uploading Electron release distribution to github releases"
  104. & python script\upload.py
  105. }
  106. }