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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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, win 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_protected == true && github.run_id || github.ref }}
  29. cancel-in-progress: ${{ github.ref_protected != true }}
  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@11bd71901bbe5b1630ceea73d27597364c9af683
  45. with:
  46. path: src/electron
  47. fetch-depth: 0
  48. ref: ${{ github.event.pull_request.head.sha }}
  49. - name: Install Build Tools
  50. uses: ./src/electron/.github/actions/install-build-tools
  51. - name: Init Build Tools
  52. run: |
  53. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }} --import ${{ inputs.gn-build-type }} --target-cpu ${{ inputs.target-arch }}
  54. - name: Install Dependencies
  55. uses: ./src/electron/.github/actions/install-dependencies
  56. - name: Get Depot Tools
  57. timeout-minutes: 5
  58. run: |
  59. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  60. # Ensure depot_tools does not update.
  61. test -d depot_tools && cd depot_tools
  62. touch .disable_auto_update
  63. - name: Add Depot Tools to PATH
  64. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  65. - name: Download Generated Artifacts
  66. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  67. with:
  68. name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  69. path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  70. - name: Download Src Artifacts
  71. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  72. with:
  73. name: src_artifacts_linux_${{ env.TARGET_ARCH }}
  74. path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
  75. - name: Restore Generated Artifacts
  76. run: ./src/electron/script/actions/restore-artifacts.sh
  77. - name: Unzip Dist
  78. run: |
  79. cd src/out/Default
  80. unzip -:o dist.zip
  81. - name: Setup Linux for Headless Testing
  82. run: sh -e /etc/init.d/xvfb start
  83. - name: Run Node.js Tests
  84. run: |
  85. cd src
  86. node electron/script/node-spec-runner.js --default --jUnitDir=junit
  87. - name: Wait for active SSH sessions
  88. if: always() && !cancelled()
  89. shell: bash
  90. run: |
  91. while [ -f /var/.ssh-lock ]
  92. do
  93. sleep 60
  94. done
  95. nan-tests:
  96. name: Run Nan Tests
  97. runs-on: electron-arc-linux-amd64-4core
  98. timeout-minutes: 20
  99. env:
  100. TARGET_ARCH: ${{ inputs.target-arch }}
  101. BUILD_TYPE: linux
  102. container: ${{ fromJSON(inputs.test-container) }}
  103. steps:
  104. - name: Checkout Electron
  105. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  106. with:
  107. path: src/electron
  108. fetch-depth: 0
  109. ref: ${{ github.event.pull_request.head.sha }}
  110. - name: Install Build Tools
  111. uses: ./src/electron/.github/actions/install-build-tools
  112. - name: Init Build Tools
  113. run: |
  114. e init -f --root=$(pwd) --out=Default ${{ inputs.gn-build-type }}
  115. - name: Install Dependencies
  116. uses: ./src/electron/.github/actions/install-dependencies
  117. - name: Get Depot Tools
  118. timeout-minutes: 5
  119. run: |
  120. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  121. # Ensure depot_tools does not update.
  122. test -d depot_tools && cd depot_tools
  123. touch .disable_auto_update
  124. - name: Add Depot Tools to PATH
  125. run: echo "$(pwd)/depot_tools" >> $GITHUB_PATH
  126. - name: Download Generated Artifacts
  127. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  128. with:
  129. name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  130. path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }}
  131. - name: Download Src Artifacts
  132. uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
  133. with:
  134. name: src_artifacts_linux_${{ env.TARGET_ARCH }}
  135. path: ./src_artifacts_linux_${{ env.TARGET_ARCH }}
  136. - name: Restore Generated Artifacts
  137. run: ./src/electron/script/actions/restore-artifacts.sh
  138. - name: Unzip Dist
  139. run: |
  140. cd src/out/Default
  141. unzip -:o dist.zip
  142. - name: Setup Linux for Headless Testing
  143. run: sh -e /etc/init.d/xvfb start
  144. - name: Run Nan Tests
  145. run: |
  146. cd src
  147. node electron/script/nan-spec-runner.js
  148. - name: Wait for active SSH sessions
  149. shell: bash
  150. if: always() && !cancelled()
  151. run: |
  152. while [ -f /var/.ssh-lock ]
  153. do
  154. sleep 60
  155. done