pipeline-segment-electron-gn-check.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. name: Pipeline Segment - Electron GN Check
  2. on:
  3. workflow_call:
  4. inputs:
  5. target-platform:
  6. type: string
  7. description: 'Platform to run on, can be macos or linux'
  8. required: true
  9. target-arch:
  10. type: string
  11. description: 'Arch to build for, can be x64, arm64 or arm'
  12. required: true
  13. check-runs-on:
  14. type: string
  15. description: 'What host to run the tests on'
  16. required: true
  17. check-container:
  18. type: string
  19. description: 'JSON container information for aks runs-on'
  20. required: false
  21. default: '{"image":null}'
  22. gn-build-type:
  23. description: 'The gn build type - testing or release'
  24. required: true
  25. type: string
  26. default: testing
  27. is-asan:
  28. description: 'Building the Address Sanitizer (ASan) Linux build'
  29. required: false
  30. type: boolean
  31. default: false
  32. concurrency:
  33. group: electron-gn-check-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
  34. cancel-in-progress: true
  35. env:
  36. ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
  37. GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' }}
  38. ELECTRON_OUT_DIR: Default
  39. TARGET_ARCH: ${{ inputs.target-arch }}
  40. jobs:
  41. gn-check:
  42. # TODO(codebytere): Change this to medium VM
  43. runs-on: ${{ inputs.check-runs-on }}
  44. container: ${{ fromJSON(inputs.check-container) }}
  45. env:
  46. TARGET_ARCH: ${{ inputs.target-arch }}
  47. steps:
  48. - name: Checkout Electron
  49. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
  50. with:
  51. path: src/electron
  52. fetch-depth: 0
  53. - name: Install Build Tools
  54. uses: ./src/electron/.github/actions/install-build-tools
  55. - name: Init Build Tools
  56. run: |
  57. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }} --only-sdk
  58. - name: Get Depot Tools
  59. timeout-minutes: 5
  60. run: |
  61. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  62. SEDOPTION="-i"
  63. if [ "`uname`" = "Darwin" ]; then
  64. SEDOPTION="-i ''"
  65. fi
  66. # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
  67. sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  68. # Ensure depot_tools does not update.
  69. test -d depot_tools && cd depot_tools
  70. if [ "`uname`" = "Linux" ]; then
  71. git apply --3way ../src/electron/.github/workflows/config/gclient.diff
  72. fi
  73. touch .disable_auto_update
  74. - name: Add Depot Tools to PATH
  75. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  76. - name: Set GN_EXTRA_ARGS for Linux
  77. if: ${{ inputs.target-platform == 'linux' }}
  78. run: |
  79. if [ "${{ inputs.target-arch }}" = "arm" ]; then
  80. GN_EXTRA_ARGS='build_tflite_with_xnnpack=false'
  81. elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
  82. GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
  83. fi
  84. echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
  85. - name: Generate DEPS Hash
  86. run: |
  87. node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  88. DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
  89. echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
  90. echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
  91. - name: Restore src cache via AZCopy
  92. if: ${{ inputs.target-platform == 'macos' }}
  93. uses: ./src/electron/.github/actions/restore-cache-azcopy
  94. - name: Restore src cache via AKS
  95. if: ${{ inputs.target-platform == 'linux' }}
  96. uses: ./src/electron/.github/actions/restore-cache-aks
  97. - name: Run Electron Only Hooks
  98. run: |
  99. gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
  100. - name: Regenerate DEPS Hash
  101. run: |
  102. (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  103. echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
  104. - name: Add CHROMIUM_BUILDTOOLS_PATH to env
  105. run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
  106. - name: Checkout Electron
  107. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
  108. with:
  109. path: src/electron
  110. fetch-depth: 0
  111. - name: Default GN gen
  112. run: |
  113. cd src/electron
  114. git pack-refs
  115. cd ..
  116. e build --only-gen
  117. - name: Run GN Check
  118. run: |
  119. cd src
  120. gn check out/Default //electron:electron_lib
  121. gn check out/Default //electron:electron_app
  122. gn check out/Default //electron/shell/common/api:mojo
  123. # Check the hunspell filenames
  124. node electron/script/gen-hunspell-filenames.js --check
  125. node electron/script/gen-libc++-filenames.js --check
  126. - name: Wait for active SSH sessions
  127. if: always() && !cancelled()
  128. run: |
  129. while [ -f /var/.ssh-lock ]
  130. do
  131. sleep 60
  132. done