name: 'test:cypress' on: pull_request: branches: [main, release, milestone**, test-cypress] paths: - 'cypress/**' - 'packages/**' - '!packages/**/__test__/**' - '!packages/**/*.test.[tj]sx?' - '!packages/**/*.md' push: branches: [main, release, milestone**, test-cypress] paths: - 'cypress/**' - 'packages/**' - '!packages/**/__test__/**' - '!packages/**/*.test.[tj]sx?' - '!packages/**/*.md' - '.github/**/cypress.yml' jobs: install: runs-on: ubuntu-latest container: # https://github.com/cypress-io/cypress-docker-images/tree/master/browsers image: cypress/browsers:node18.12.0-chrome103-ff107 if: ${{ github.repository_owner == 'DouyinFE' }} steps: - name: Checkout uses: actions/checkout@v3 - name: Install global packages run: npm i -g lerna@^6 yarn - name: Build storybook run: | yarn bootstrap yarn build:lib yarn build-storybook - name: Save build folder uses: actions/upload-artifact@v3 with: name: storybook-static if-no-files-found: error path: storybook - name: Reclaim cache directory run: chown -R 1001:1001 /github/home/.cache && echo "pwn dat cache" - name: Cypress install uses: cypress-io/github-action@v5 with: # Disable running of tests within install job runTests: false chrome-tests: runs-on: ubuntu-latest container: image: cypress/browsers:node18.12.0-chrome103-ff107 options: --user 1001 needs: install steps: - name: Checkout uses: actions/checkout@v3 - name: Download the build folders uses: actions/download-artifact@v3 with: name: storybook-static path: storybook - name: 'Cypress Tests - Chrome' uses: cypress-io/github-action@v5 with: # we have already installed all dependencies above install: true start: npx http-server -p 6006 storybook wait-on: 'http://localhost:6006' wait-on-timeout: 120 browser: chrome record: true parallel: true group: 'Cypress - Chrome' spec: cypress/e2e/* env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} # Recommended: pass the GitHub token lets this action correctly # determine the unique run id necessary to re-run the checks GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # firefox-tests: # runs-on: ubuntu-latest # container: # image: cypress/browsers:node18.12.0-chrome103-ff107 # options: --user 1001 # needs: install # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: Download the build folders # uses: actions/download-artifact@v5 # with: # name: storybook-static # path: storybook-static # - name: 'Cypress Tests - Firefox' # uses: cypress-io/github-action@v5 # with: # # we have already installed all dependencies above # install: true # start: npx http-server -p 6006 storybook-static # wait-on: 'http://localhost:6006' # wait-on-timeout: 120 # browser: firefox # record: true # parallel: true # group: 'Cypress - Firefox' # spec: cypress/e2e/* # env: # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} # # Recommended: pass the GitHub token lets this action correctly # # determine the unique run id necessary to re-run the checks # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}