pipeline-segment-node-nan-test.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. name: Pipeline Segment - Node/Nan Test
  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. test-runs-on:
  14. type: string
  15. description: 'What host to run the tests on'
  16. required: true
  17. test-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-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref }}
  29. cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
  30. env:
  31. ELECTRON_OUT_DIR: Default
  32. ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
  33. jobs:
  34. node-tests:
  35. name: Run Node.js Tests
  36. runs-on: electron-arc-linux-amd64-8core
  37. timeout-minutes: 20
  38. env:
  39. TARGET_ARCH: ${{ inputs.target-arch }}
  40. BUILD_TYPE: linux
  41. container: ${{ fromJSON(inputs.test-container) }}
  42. steps:
  43. - name: Checkout Electron
  44. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
  45. with:
  46. path: src/electron
  47. fetch-depth: 0
  48. - name: Install Build Tools
  49. uses: ./src/electron/.github/actions/install-build-tools
  50. - name: Init Build Tools
  51. run: |
  52. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
  53. - name: Install Dependencies
  54. run: |
  55. cd src/electron
  56. node script/yarn install --frozen-lockfile
  57. - name: Get Depot Tools
  58. timeout-minutes: 5
  59. run: |
  60. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  61. sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  62. # Ensure depot_tools does not update.
  63. test -d depot_tools && cd depot_tools
  64. git apply --3way ../src/electron/.github/workflows/config/gclient.diff
  65. touch .disable_auto_update
  66. - name: Add Depot Tools to PATH
  67. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  68. - name: Download Generated Artifacts
  69. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  70. with:
  71. name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  72. path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  73. - name: Download Src Artifacts
  74. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  75. with:
  76. name: src_artifacts_linux_${{ env.TARGET_ARCH }}
  77. path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
  78. - name: Restore Generated Artifacts
  79. run: ./src/electron/script/actions/restore-artifacts.sh
  80. - name: Unzip Dist
  81. run: |
  82. cd src/out/Default
  83. unzip -:o dist.zip
  84. - name: Setup Linux for Headless Testing
  85. run: sh -e /etc/init.d/xvfb start
  86. - name: Run Node.js Tests
  87. run: |
  88. cd src
  89. node electron/script/node-spec-runner.js --default --jUnitDir=junit
  90. - name: Wait for active SSH sessions
  91. if: always() && !cancelled()
  92. run: |
  93. while [ -f /var/.ssh-lock ]
  94. do
  95. sleep 60
  96. done
  97. nan-tests:
  98. name: Run Nan Tests
  99. runs-on: electron-arc-linux-amd64-4core
  100. timeout-minutes: 20
  101. env:
  102. TARGET_ARCH: ${{ inputs.target-arch }}
  103. BUILD_TYPE: linux
  104. container: ${{ fromJSON(inputs.test-container) }}
  105. steps:
  106. - name: Checkout Electron
  107. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
  108. with:
  109. path: src/electron
  110. fetch-depth: 0
  111. - name: Install Build Tools
  112. uses: ./src/electron/.github/actions/install-build-tools
  113. - name: Init Build Tools
  114. run: |
  115. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
  116. - name: Install Dependencies
  117. run: |
  118. cd src/electron
  119. node script/yarn install --frozen-lockfile
  120. - name: Get Depot Tools
  121. timeout-minutes: 5
  122. run: |
  123. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  124. sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  125. # Ensure depot_tools does not update.
  126. test -d depot_tools && cd depot_tools
  127. git apply --3way ../src/electron/.github/workflows/config/gclient.diff
  128. touch .disable_auto_update
  129. - name: Add Depot Tools to PATH
  130. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  131. - name: Download Generated Artifacts
  132. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  133. with:
  134. name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  135. path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  136. - name: Download Src Artifacts
  137. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  138. with:
  139. name: src_artifacts_linux_${{ env.TARGET_ARCH }}
  140. path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
  141. - name: Restore Generated Artifacts
  142. run: ./src/electron/script/actions/restore-artifacts.sh
  143. - name: Unzip Dist
  144. run: |
  145. cd src/out/Default
  146. unzip -:o dist.zip
  147. - name: Setup Linux for Headless Testing
  148. run: sh -e /etc/init.d/xvfb start
  149. - name: Run Nan Tests
  150. run: |
  151. cd src
  152. node electron/script/nan-spec-runner.js
  153. - name: Wait for active SSH sessions
  154. if: always() && !cancelled()
  155. run: |
  156. while [ -f /var/.ssh-lock ]
  157. do
  158. sleep 60
  159. done