cypress.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. name: 'test:cypress'
  2. on:
  3. pull_request:
  4. branches: [ main, release, milestone**, test-cypress ]
  5. paths:
  6. - 'cypress/**'
  7. - 'packages/**'
  8. - '!packages/**/__test__/**'
  9. - '!packages/**/*.test.[tj]sx?'
  10. - '!packages/**/*.md'
  11. push:
  12. branches: [ main, release, milestone**, test-cypress ]
  13. paths:
  14. - 'cypress/**'
  15. - 'packages/**'
  16. - '!packages/**/__test__/**'
  17. - '!packages/**/*.test.[tj]sx?'
  18. - '!packages/**/*.md'
  19. - '.github/**/cypress.yml'
  20. jobs:
  21. install:
  22. runs-on: ubuntu-latest
  23. container:
  24. # https://github.com/cypress-io/cypress-docker-images/tree/master/browsers
  25. image: cypress/browsers:node14.17.6-chrome100-ff98
  26. if: ${{ github.repository_owner == 'DouyinFE' }}
  27. steps:
  28. - name: Checkout
  29. uses: actions/checkout@v2
  30. - name: Install global packages
  31. run: npm i -g lerna yarn
  32. - name: Build storybook
  33. run: |
  34. yarn bootstrap
  35. yarn build:lib
  36. yarn build-storybook
  37. - name: Save build folder
  38. uses: actions/upload-artifact@v2
  39. with:
  40. name: storybook-static
  41. if-no-files-found: error
  42. path: storybook-static
  43. - name: Cypress install
  44. uses: cypress-io/github-action@v2
  45. with:
  46. # Disable running of tests within install job
  47. runTests: false
  48. chrome-tests:
  49. runs-on: ubuntu-latest
  50. container:
  51. image: cypress/browsers:node14.17.6-chrome100-ff98
  52. needs: install
  53. strategy:
  54. fail-fast: false
  55. matrix:
  56. # run copies of the current job in parallel
  57. containers: [1, 2, 3, 4, 5]
  58. steps:
  59. - name: Checkout
  60. uses: actions/checkout@v2
  61. - name: Download the build folders
  62. uses: actions/download-artifact@v2
  63. with:
  64. name: storybook-static
  65. path: storybook-static
  66. - name: 'Cypress Tests - Chrome'
  67. uses: cypress-io/github-action@v2
  68. with:
  69. # we have already installed all dependencies above
  70. install: true
  71. start: npx http-server -p 6006 storybook-static
  72. wait-on: 'http://localhost:6006'
  73. wait-on-timeout: 120
  74. browser: chrome
  75. record: true
  76. parallel: true
  77. group: 'Cypress - Chrome'
  78. spec: cypress/integration/*
  79. env:
  80. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  81. # Recommended: pass the GitHub token lets this action correctly
  82. # determine the unique run id necessary to re-run the checks
  83. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  84. firefox-tests:
  85. runs-on: ubuntu-latest
  86. container:
  87. image: cypress/browsers:node14.17.6-chrome100-ff98
  88. options: --user 1001
  89. needs: install
  90. strategy:
  91. fail-fast: false
  92. matrix:
  93. # run copies of the current job in parallel
  94. containers: [1, 2, 3, 4, 5]
  95. steps:
  96. - name: Checkout
  97. uses: actions/checkout@v2
  98. - name: Download the build folders
  99. uses: actions/download-artifact@v2
  100. with:
  101. name: storybook-static
  102. path: storybook-static
  103. - name: 'Cypress Tests - Firefox'
  104. uses: cypress-io/github-action@v2
  105. with:
  106. # we have already installed all dependencies above
  107. install: true
  108. start: npx http-server -p 6006 storybook-static
  109. wait-on: 'http://localhost:6006'
  110. wait-on-timeout: 120
  111. browser: firefox
  112. record: true
  113. parallel: true
  114. group: 'Cypress - Firefox'
  115. spec: cypress/integration/*
  116. env:
  117. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  118. # Recommended: pass the GitHub token lets this action correctly
  119. # determine the unique run id necessary to re-run the checks
  120. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}