cypress.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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:node18.12.0-chrome103-ff107
  26. if: ${{ github.repository_owner == 'DouyinFE' }}
  27. steps:
  28. - name: Checkout
  29. uses: actions/checkout@v3
  30. - name: Install global packages
  31. run: npm i -g lerna@^6 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@v3
  39. with:
  40. name: storybook-static
  41. if-no-files-found: error
  42. path: storybook
  43. - name: Reclaim cache directory
  44. run: chown -R 1001:1001 /github/home/.cache && echo "pwn dat cache"
  45. - name: Cypress install
  46. uses: cypress-io/github-action@v5
  47. with:
  48. # Disable running of tests within install job
  49. runTests: false
  50. chrome-tests:
  51. runs-on: ubuntu-latest
  52. container:
  53. image: cypress/browsers:node18.12.0-chrome103-ff107
  54. options: --user 1001
  55. needs: install
  56. steps:
  57. - name: Checkout
  58. uses: actions/checkout@v3
  59. - name: Download the build folders
  60. uses: actions/download-artifact@v3
  61. with:
  62. name: storybook-static
  63. path: storybook
  64. - name: 'Cypress Tests - Chrome'
  65. uses: cypress-io/github-action@v5
  66. with:
  67. # we have already installed all dependencies above
  68. install: true
  69. start: npx http-server -p 6006 storybook
  70. wait-on: 'http://localhost:6006'
  71. wait-on-timeout: 120
  72. browser: chrome
  73. record: true
  74. parallel: true
  75. group: 'Cypress - Chrome'
  76. spec: cypress/e2e/*
  77. env:
  78. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  79. # Recommended: pass the GitHub token lets this action correctly
  80. # determine the unique run id necessary to re-run the checks
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. # firefox-tests:
  83. # runs-on: ubuntu-latest
  84. # container:
  85. # image: cypress/browsers:node18.12.0-chrome103-ff107
  86. # options: --user 1001
  87. # needs: install
  88. # steps:
  89. # - name: Checkout
  90. # uses: actions/checkout@v3
  91. # - name: Download the build folders
  92. # uses: actions/download-artifact@v5
  93. # with:
  94. # name: storybook-static
  95. # path: storybook-static
  96. # - name: 'Cypress Tests - Firefox'
  97. # uses: cypress-io/github-action@v5
  98. # with:
  99. # # we have already installed all dependencies above
  100. # install: true
  101. # start: npx http-server -p 6006 storybook-static
  102. # wait-on: 'http://localhost:6006'
  103. # wait-on-timeout: 120
  104. # browser: firefox
  105. # record: true
  106. # parallel: true
  107. # group: 'Cypress - Firefox'
  108. # spec: cypress/e2e/*
  109. # env:
  110. # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  111. # # Recommended: pass the GitHub token lets this action correctly
  112. # # determine the unique run id necessary to re-run the checks
  113. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}