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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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, win or linux'
  8. required: true
  9. target-archs:
  10. type: string
  11. description: 'Archs to check for, can be x64, x86, arm64 or arm space separated'
  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. concurrency:
  28. group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }}
  29. cancel-in-progress: true
  30. env:
  31. ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
  32. GCLIENT_EXTRA_ARGS: ${{ inputs.target-platform == 'macos' && '--custom-var=checkout_mac=True --custom-var=host_os=mac' || (inputs.target-platform == 'linux' && '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' || '--custom-var=checkout_win=True') }}
  33. ELECTRON_OUT_DIR: Default
  34. jobs:
  35. gn-check:
  36. defaults:
  37. run:
  38. shell: bash
  39. runs-on: ${{ inputs.check-runs-on }}
  40. container: ${{ fromJSON(inputs.check-container) }}
  41. steps:
  42. - name: Checkout Electron
  43. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  44. with:
  45. path: src/electron
  46. fetch-depth: 0
  47. ref: ${{ github.event.pull_request.head.sha }}
  48. - name: Cleanup disk space on macOS
  49. if: ${{ inputs.target-platform == 'macos' }}
  50. shell: bash
  51. run: |
  52. sudo mkdir -p $TMPDIR/del-target
  53. tmpify() {
  54. if [ -d "$1" ]; then
  55. sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
  56. fi
  57. }
  58. tmpify /Library/Developer/CoreSimulator
  59. tmpify ~/Library/Developer/CoreSimulator
  60. sudo rm -rf $TMPDIR/del-target
  61. - name: Check disk space after freeing up space
  62. if: ${{ inputs.target-platform == 'macos' }}
  63. run: df -h
  64. - name: Set Chromium Git Cookie
  65. uses: ./src/electron/.github/actions/set-chromium-cookie
  66. - name: Install Build Tools
  67. uses: ./src/electron/.github/actions/install-build-tools
  68. - name: Enable windows toolchain
  69. if: ${{ inputs.target-platform == 'win' }}
  70. run: |
  71. echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
  72. - name: Generate DEPS Hash
  73. run: |
  74. node src/electron/script/generate-deps-hash.js
  75. DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
  76. echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
  77. echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
  78. - name: Restore src cache via AZCopy
  79. if: ${{ inputs.target-platform == 'macos' }}
  80. uses: ./src/electron/.github/actions/restore-cache-azcopy
  81. with:
  82. target-platform: ${{ inputs.target-platform }}
  83. - name: Restore src cache via AKS
  84. if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
  85. uses: ./src/electron/.github/actions/restore-cache-aks
  86. with:
  87. target-platform: ${{ inputs.target-platform }}
  88. - name: Run Electron Only Hooks
  89. run: |
  90. echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
  91. if [ "${{ inputs.target-platform }}" = "win" ]; then
  92. echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
  93. echo "target_os=['win']" >> tmpgclient
  94. fi
  95. e d gclient runhooks --gclientfile=tmpgclient
  96. # Fix VS Toolchain
  97. if [ "${{ inputs.target-platform }}" = "win" ]; then
  98. rm -rf src/third_party/depot_tools/win_toolchain/vs_files
  99. e d python3 src/build/vs_toolchain.py update --force
  100. fi
  101. - name: Regenerate DEPS Hash
  102. run: |
  103. (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
  104. echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
  105. - name: Add CHROMIUM_BUILDTOOLS_PATH to env
  106. run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
  107. - name: Checkout Electron
  108. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  109. with:
  110. path: src/electron
  111. fetch-depth: 0
  112. ref: ${{ github.event.pull_request.head.sha }}
  113. - name: Install Dependencies
  114. uses: ./src/electron/.github/actions/install-dependencies
  115. - name: Default GN gen
  116. run: |
  117. cd src/electron
  118. git pack-refs
  119. - name: Run GN Check for ${{ inputs.target-archs }}
  120. run: |
  121. for target_cpu in ${{ inputs.target-archs }}
  122. do
  123. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
  124. cd src
  125. export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
  126. if [ "${{ inputs.target-platform }}" = "linux" ]; then
  127. if [ "$target_cpu" = "arm" ]; then
  128. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
  129. elif [ "$target_cpu" = "arm64" ]; then
  130. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
  131. fi
  132. fi
  133. if [ "${{ inputs.target-platform }}" = "win" ]; then
  134. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
  135. fi
  136. e build --only-gen
  137. e d gn check out/Default //electron:electron_lib
  138. e d gn check out/Default //electron:electron_app
  139. e d gn check out/Default //electron/shell/common:mojo
  140. e d gn check out/Default //electron/shell/common:plugin
  141. # Check the hunspell filenames
  142. node electron/script/gen-hunspell-filenames.js --check
  143. node electron/script/gen-libc++-filenames.js --check
  144. cd ..
  145. done
  146. - name: Wait for active SSH sessions
  147. if: always() && !cancelled()
  148. shell: bash
  149. run: |
  150. while [ -f /var/.ssh-lock ]
  151. do
  152. sleep 60
  153. done