node-tests.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. name: Node tests
  2. on:
  3. pull_request:
  4. schedule:
  5. - cron: "5 2 * * *"
  6. concurrency:
  7. group: node-tests-${{ github.head_ref || github.run_id }}
  8. cancel-in-progress: true
  9. jobs:
  10. changes:
  11. runs-on: ubuntu-latest-low
  12. outputs:
  13. src: ${{ steps.changes.outputs.src}}
  14. steps:
  15. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  16. id: changes
  17. continue-on-error: true
  18. with:
  19. filters: |
  20. src:
  21. - '.github/workflows/**'
  22. - '**/__tests__/**'
  23. - '**/__mocks__/**'
  24. - '**/src/**'
  25. - '**/appinfo/info.xml'
  26. - 'package.json'
  27. - 'package-lock.json'
  28. - 'tsconfig.json'
  29. - '**.js'
  30. - '**.ts'
  31. - '**.vue'
  32. - '**.handlebars'
  33. versions:
  34. runs-on: ubuntu-latest
  35. needs: changes
  36. if: ${{ github.repository_owner != 'nextcloud-gmbh' && needs.changes.outputs.src != 'false' }}
  37. outputs:
  38. nodeVersion: ${{ steps.versions.outputs.nodeVersion }}
  39. npmVersion: ${{ steps.versions.outputs.npmVersion }}
  40. steps:
  41. - name: Checkout
  42. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  43. - name: Read package.json node and npm engines version
  44. uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1
  45. id: versions
  46. with:
  47. fallbackNode: '^20'
  48. fallbackNpm: '^9'
  49. test:
  50. runs-on: ubuntu-latest
  51. needs: [versions, changes]
  52. if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }}
  53. env:
  54. CYPRESS_INSTALL_BINARY: 0
  55. PUPPETEER_SKIP_DOWNLOAD: true
  56. steps:
  57. - name: Checkout
  58. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  59. - name: Set up node ${{ needs.versions.outputs.nodeVersion }}
  60. uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
  61. with:
  62. node-version: ${{ needs.versions.outputs.nodeVersion }}
  63. - name: Set up npm ${{ needs.versions.outputs.npmVersion }}
  64. run: npm i -g npm@"${{ needs.versions.outputs.npmVersion }}"
  65. - name: Install dependencies
  66. run: npm ci
  67. - name: Show cypress version
  68. run: npm run cypress:version
  69. - name: Test and process coverage
  70. run: npm run test:coverage
  71. - name: Collect coverage
  72. uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
  73. with:
  74. files: ./coverage/lcov.info
  75. jsunit:
  76. runs-on: ubuntu-latest
  77. needs: [versions, changes]
  78. if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }}
  79. env:
  80. CYPRESS_INSTALL_BINARY: 0
  81. steps:
  82. - name: Checkout
  83. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  84. - name: Set up node ${{ needs.versions.outputs.nodeVersion }}
  85. uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
  86. with:
  87. node-version: ${{ needs.versions.outputs.nodeVersion }}
  88. - name: Set up npm ${{ needs.versions.outputs.npmVersion }}
  89. run: npm i -g npm@"${{ needs.versions.outputs.npmVersion }}"
  90. - name: Install dependencies
  91. run: npm ci
  92. - name: Show cypress version
  93. run: npm run cypress:version
  94. - name: Test
  95. run: npm run test:jsunit
  96. handlebars:
  97. runs-on: ubuntu-latest
  98. needs: [versions, changes]
  99. if: ${{ needs.versions.result != 'failure' && needs.changes.outputs.src != 'false' }}
  100. env:
  101. CYPRESS_INSTALL_BINARY: 0
  102. PUPPETEER_SKIP_DOWNLOAD: true
  103. steps:
  104. - name: Checkout
  105. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  106. - name: Set up node ${{ needs.versions.outputs.nodeVersion }}
  107. uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
  108. with:
  109. node-version: ${{ needs.versions.outputs.nodeVersion }}
  110. - name: Set up npm ${{ needs.versions.outputs.npmVersion }}
  111. run: npm i -g npm@"${{ needs.versions.outputs.npmVersion }}"
  112. - name: Install dependencies
  113. run: npm ci
  114. - name: Show cypress version
  115. run: npm run cypress:version
  116. - name: Run compile
  117. run: ./build/compile-handlebars-templates.sh
  118. summary:
  119. permissions:
  120. contents: none
  121. runs-on: ubuntu-latest-low
  122. needs: [changes, test, jsunit, handlebars]
  123. if: always()
  124. name: node-test-summary
  125. steps:
  126. - name: Summary status
  127. run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' && needs.jsunit.result != 'success' && needs.handlebars.result != 'success' }}; then exit 1; fi