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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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@692973e3d937129bcbf40652eb9f2f61becf3332
  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: Install Build Tools
  65. uses: ./src/electron/.github/actions/install-build-tools
  66. - name: Enable windows toolchain
  67. if: ${{ inputs.target-platform == 'win' }}
  68. run: |
  69. echo "ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN=1" >> $GITHUB_ENV
  70. - name: Generate DEPS Hash
  71. run: |
  72. node src/electron/script/generate-deps-hash.js
  73. DEPSHASH=v1-src-cache-$(cat src/electron/.depshash)
  74. echo "DEPSHASH=$DEPSHASH" >> $GITHUB_ENV
  75. echo "CACHE_PATH=$DEPSHASH.tar" >> $GITHUB_ENV
  76. - name: Restore src cache via AZCopy
  77. if: ${{ inputs.target-platform == 'macos' }}
  78. uses: ./src/electron/.github/actions/restore-cache-azcopy
  79. - name: Restore src cache via AKS
  80. if: ${{ inputs.target-platform == 'linux' || inputs.target-platform == 'win' }}
  81. uses: ./src/electron/.github/actions/restore-cache-aks
  82. - name: Run Electron Only Hooks
  83. run: |
  84. echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]" > tmpgclient
  85. if [ "${{ inputs.target-platform }}" = "win" ]; then
  86. echo "solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False,'install_sysroot':False,'checkout_win':True},'managed':False}]" > tmpgclient
  87. echo "target_os=['win']" >> tmpgclient
  88. fi
  89. e d gclient runhooks --gclientfile=tmpgclient
  90. # Fix VS Toolchain
  91. if [ "${{ inputs.target-platform }}" = "win" ]; then
  92. rm -rf src/third_party/depot_tools/win_toolchain/vs_files
  93. e d python3 src/build/vs_toolchain.py update --force
  94. fi
  95. - name: Regenerate DEPS Hash
  96. run: |
  97. (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js
  98. echo "DEPSHASH=$(cat src/electron/.depshash)" >> $GITHUB_ENV
  99. - name: Add CHROMIUM_BUILDTOOLS_PATH to env
  100. run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV
  101. - name: Checkout Electron
  102. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
  103. with:
  104. path: src/electron
  105. fetch-depth: 0
  106. ref: ${{ github.event.pull_request.head.sha }}
  107. - name: Install Dependencies
  108. uses: ./src/electron/.github/actions/install-dependencies
  109. - name: Default GN gen
  110. run: |
  111. cd src/electron
  112. git pack-refs
  113. - name: Run GN Check for ${{ inputs.target-archs }}
  114. run: |
  115. for target_cpu in ${{ inputs.target-archs }}
  116. do
  117. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu $target_cpu
  118. cd src
  119. export GN_EXTRA_ARGS="target_cpu=\"$target_cpu\""
  120. if [ "${{ inputs.target-platform }}" = "linux" ]; then
  121. if [ "$target_cpu" = "arm" ]; then
  122. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS build_tflite_with_xnnpack=false"
  123. elif [ "$target_cpu" = "arm64" ]; then
  124. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS fatal_linker_warnings=false enable_linux_installer=false"
  125. fi
  126. fi
  127. if [ "${{ inputs.target-platform }}" = "win" ]; then
  128. export GN_EXTRA_ARGS="$GN_EXTRA_ARGS use_v8_context_snapshot=true target_os=\"win\""
  129. fi
  130. e build --only-gen
  131. e d gn check out/Default //electron:electron_lib
  132. e d gn check out/Default //electron:electron_app
  133. e d gn check out/Default //electron/shell/common/api:mojo
  134. # Check the hunspell filenames
  135. node electron/script/gen-hunspell-filenames.js --check
  136. node electron/script/gen-libc++-filenames.js --check
  137. cd ..
  138. done
  139. - name: Wait for active SSH sessions
  140. if: always() && !cancelled()
  141. shell: bash
  142. run: |
  143. while [ -f /var/.ssh-lock ]
  144. do
  145. sleep 60
  146. done