1
0

cypress.yml 4.5 KB

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