cypress.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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@v4
  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@v4
  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@v4
  61. - name: Download the build folders
  62. uses: actions/download-artifact@v4
  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: coverage=false
  80. env:
  81. CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  82. # Recommended: pass the GitHub token lets this action correctly
  83. # determine the unique run id necessary to re-run the checks
  84. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  85. # firefox-tests:
  86. # runs-on: ubuntu-latest
  87. # container:
  88. # image: cypress/browsers:node18.12.0-chrome103-ff107
  89. # options: --user 1001
  90. # needs: install
  91. # steps:
  92. # - name: Checkout
  93. # uses: actions/checkout@v4
  94. # - name: Download the build folders
  95. # uses: actions/download-artifact@v5
  96. # with:
  97. # name: storybook-static
  98. # path: storybook-static
  99. # - name: 'Cypress Tests - Firefox'
  100. # uses: cypress-io/github-action@v5
  101. # with:
  102. # # we have already installed all dependencies above
  103. # install: true
  104. # start: npx http-server -p 6006 storybook-static
  105. # wait-on: 'http://localhost:6006'
  106. # wait-on-timeout: 120
  107. # browser: firefox
  108. # record: true
  109. # parallel: true
  110. # group: 'Cypress - Firefox'
  111. # spec: cypress/e2e/*
  112. # env:
  113. # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
  114. # # Recommended: pass the GitHub token lets this action correctly
  115. # # determine the unique run id necessary to re-run the checks
  116. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}