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 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. steps:
  16. - name: Checkout server
  17. uses: actions/checkout@v3
  18. - name: Read package.json node and npm engines version
  19. uses: skjnldsv/read-package-engines-version-actions@v1.2
  20. id: versions
  21. with:
  22. fallbackNode: "^12"
  23. fallbackNpm: "^6"
  24. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  25. uses: actions/setup-node@v3
  26. with:
  27. cache: "npm"
  28. node-version: ${{ steps.versions.outputs.nodeVersion }}
  29. - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
  30. run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
  31. - name: Install dependencies & build app
  32. run: |
  33. npm ci
  34. TESTING=true npm run build --if-present
  35. - name: Save context
  36. uses: actions/cache@v3
  37. with:
  38. key: cypress-context-${{ github.run_id }}
  39. path: /home/runner/work/server
  40. cypress:
  41. runs-on: ubuntu-latest
  42. needs: init
  43. strategy:
  44. fail-fast: false
  45. matrix:
  46. # run multiple copies of the current job in parallel
  47. containers: ['component', 1, 2]
  48. name: runner ${{ matrix.containers }}
  49. steps:
  50. - name: Restore context
  51. uses: actions/cache@v3
  52. with:
  53. key: cypress-context-${{ github.run_id }}
  54. path: /home/runner/work/server
  55. - name: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} cypress tests
  56. uses: cypress-io/github-action@v5
  57. with:
  58. record: true
  59. parallel: true
  60. # cypress run type
  61. component: ${{ matrix.containers == 'component' }}
  62. group: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }}
  63. # cypress env
  64. ci-build-id: ${{ github.sha }}-${{ github.run_number }}
  65. tag: ${{ github.event_name }}t
  66. env:
  67. # Needs to be prefixed with CYPRESS_
  68. CYPRESS_BRANCH: ${{ env.BRANCH }}
  69. CYPRESS_GH: true
  70. # https://github.com/cypress-io/github-action/issues/124
  71. COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
  72. # Needed for some specific code workarounds
  73. TESTING: true
  74. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  75. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  76. summary:
  77. runs-on: ubuntu-latest
  78. needs: [init, cypress]
  79. if: always()
  80. name: cypress-summary
  81. steps:
  82. - name: Summary status
  83. run: if ${{ needs.init.result != 'success' || ( needs.cypress.result != 'success' && needs.cypress.result != 'skipped' ) }}; then exit 1; fi