You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cypress.yml 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. name: Cypress
  2. on:
  3. pull_request:
  4. push:
  5. branches:
  6. - master
  7. - stable*
  8. env:
  9. APP_NAME: viewer
  10. BRANCH: ${{ github.ref }}
  11. TESTING: true
  12. jobs:
  13. init:
  14. runs-on: ubuntu-latest
  15. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  16. steps:
  17. - name: Checkout server
  18. uses: actions/checkout@v3
  19. - name: Read package.json node and npm engines version
  20. uses: skjnldsv/read-package-engines-version-actions@v1.2
  21. id: versions
  22. with:
  23. fallbackNode: "^12"
  24. fallbackNpm: "^6"
  25. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  26. uses: actions/setup-node@v3
  27. with:
  28. cache: "npm"
  29. node-version: ${{ steps.versions.outputs.nodeVersion }}
  30. - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
  31. run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
  32. - name: Install dependencies & build app
  33. run: |
  34. npm ci
  35. TESTING=true npm run build --if-present
  36. - name: Save context
  37. uses: actions/cache@v3
  38. with:
  39. key: cypress-context-${{ github.run_id }}
  40. path: /home/runner/work/server
  41. cypress:
  42. runs-on: ubuntu-latest
  43. needs: init
  44. strategy:
  45. fail-fast: false
  46. matrix:
  47. # run multiple copies of the current job in parallel
  48. containers: ["component", 1, 2]
  49. name: runner ${{ matrix.containers }}
  50. steps:
  51. - name: Restore context
  52. uses: actions/cache@v3
  53. with:
  54. key: cypress-context-${{ github.run_id }}
  55. path: /home/runner/work/server
  56. - name: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} cypress tests
  57. uses: cypress-io/github-action@v5
  58. with:
  59. record: true
  60. parallel: true
  61. # cypress run type
  62. component: ${{ matrix.containers == 'component' }}
  63. group: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }}
  64. # cypress env
  65. ci-build-id: ${{ github.sha }}-${{ github.run_number }}
  66. tag: ${{ github.event_name }}t
  67. env:
  68. # Needs to be prefixed with CYPRESS_
  69. CYPRESS_BRANCH: ${{ env.BRANCH }}
  70. CYPRESS_GH: true
  71. # https://github.com/cypress-io/github-action/issues/124
  72. COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
  73. # Needed for some specific code workarounds
  74. TESTING: true
  75. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  76. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  77. - name: Extract NC logs
  78. if: failure() && matrix.containers != 'component'
  79. run: docker logs nextcloud-cypress-tests-server > nextcloud.log
  80. - name: Upload NC logs
  81. uses: actions/upload-artifact@v3
  82. if: failure() && matrix.containers != 'component'
  83. with:
  84. name: nc_logs_${{ matrix.containers }}
  85. path: nextcloud.log
  86. - name: Create data dir archive
  87. if: failure() && matrix.containers != 'component'
  88. run: docker exec nextcloud-cypress-tests-server tar -cvjf - data > data.tar
  89. - name: Upload data dir archive
  90. uses: actions/upload-artifact@v3
  91. if: failure() && matrix.containers != 'component'
  92. with:
  93. name: nc_data_${{ matrix.containers }}
  94. path: data.tar
  95. summary:
  96. runs-on: ubuntu-latest
  97. needs: [init, cypress]
  98. if: always()
  99. name: cypress-summary
  100. steps:
  101. - name: Summary status
  102. run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi