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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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@11bd71901bbe5b1630ceea73d27597364c9af683
  50. with:
  51. path: src/electron
  52. fetch-depth: 0
  53. - name: Cleanup disk space on macOS
  54. if: ${{ inputs.target-platform == 'macos' }}
  55. shell: bash
  56. run: |
  57. sudo mkdir -p $TMPDIR/del-target
  58. tmpify() {
  59. if [ -d "$1" ]; then
  60. sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
  61. fi
  62. }
  63. tmpify /Library/Developer/CoreSimulator
  64. tmpify ~/Library/Developer/CoreSimulator
  65. sudo rm -rf $TMPDIR/del-target
  66. - name: Check disk space after freeing up space
  67. if: ${{ inputs.target-platform == 'macos' }}
  68. run: df -h
  69. - name: Install Build Tools
  70. uses: ./src/electron/.github/actions/install-build-tools
  71. - name: Init Build Tools
  72. run: |
  73. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
  74. - name: Get Depot Tools
  75. timeout-minutes: 5
  76. run: |
  77. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  78. SEDOPTION="-i"
  79. if [ "`uname`" = "Darwin" ]; then
  80. SEDOPTION="-i ''"
  81. fi
  82. # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
  83. sed $SEDOPTION '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  84. # Ensure depot_tools does not update.
  85. test -d depot_tools && cd depot_tools
  86. if [ "`uname`" = "Linux" ]; then
  87. git apply --3way ../src/electron/.github/workflows/config/gclient.diff
  88. fi
  89. touch .disable_auto_update
  90. - name: Add Depot Tools to PATH
  91. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  92. - name: Set GN_EXTRA_ARGS for Linux
  93. if: ${{ inputs.target-platform == 'linux' }}
  94. run: |
  95. if [ "${{ inputs.target-arch }}" = "arm" ]; then
  96. GN_EXTRA_ARGS='build_tflite_with_xnnpack=false'
  97. elif [ "${{ inputs.target-arch }}" = "arm64" ]; then
  98. GN_EXTRA_ARGS='fatal_linker_warnings=false enable_linux_installer=false'
  99. fi
  100. echo "GN_EXTRA_ARGS=$GN_EXTRA_ARGS" >> $GITHUB_ENV
  101. - name: Generate DEPS Hash
  102. run: |
  103. node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  104. DEPSHASH=v1-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
  105. echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
  106. echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
  107. - name: Restore src cache via AZCopy
  108. if: ${{ inputs.target-platform == 'macos' }}
  109. uses: ./src/electron/.github/actions/restore-cache-azcopy
  110. - name: Restore src cache via AKS
  111. if: ${{ inputs.target-platform == 'linux' }}
  112. uses: ./src/electron/.github/actions/restore-cache-aks
  113. - name: Run Electron Only Hooks
  114. run: |
  115. gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
  116. - name: Regenerate DEPS Hash
  117. run: |
  118. (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  119. echo "DEPSHASH=$(shasum src/electron/.depshash | cut -f1 -d' ')" >> $GITHUB_ENV
  120. - name: Add CHROMIUM_BUILDTOOLS_PATH to env
  121. run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
  122. - name: Checkout Electron
  123. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  124. with:
  125. path: src/electron
  126. fetch-depth: 0
  127. - name: Install Dependencies
  128. run: |
  129. cd src/electron
  130. node script/yarn install --frozen-lockfile
  131. - name: Default GN gen
  132. run: |
  133. cd src/electron
  134. git pack-refs
  135. cd ..
  136. e build --only-gen
  137. - name: Run GN Check
  138. run: |
  139. cd src
  140. gn check out/Default //electron:electron_lib
  141. gn check out/Default //electron:electron_app
  142. gn check out/Default //electron/shell/common:mojo
  143. gn check out/Default //electron/shell/common:plugin
  144. # Check the hunspell filenames
  145. node electron/script/gen-hunspell-filenames.js --check
  146. node electron/script/gen-libc++-filenames.js --check
  147. - name: Wait for active SSH sessions
  148. if: always() && !cancelled()
  149. run: |
  150. while [ -f /var/.ssh-lock ]
  151. do
  152. sleep 60
  153. done