diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 52327dbc7e..717a3398a7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -3,13 +3,11 @@ name: Pull Request on: pull_request jobs: - verify: + install: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to retrieve git history - uses: actions/setup-node@v2 with: node-version: 14.x @@ -20,14 +18,14 @@ jobs: - name: Cache Cypress id: cypress-cache - uses: actions/cache/@v1 + uses: actions/cache/@v2 with: path: .cache/cypress key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} - name: Cache node modules id: yarn-cache - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: node_modules key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} @@ -40,7 +38,27 @@ jobs: env: CYPRESS_CACHE_FOLDER: .cache/cypress - # Keep steps separate for Github Actions annotation matching: https://github.com/actions/setup-node/blob/83c9f7a7df54d6b57455f7c57ac414f2ae5fb8de/src/setup-node.ts#L26-L33 + check: + runs-on: ubuntu-latest + needs: 'install' + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14.x + + - uses: actions/cache/@v2 + with: + path: .cache/cypress + key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} + + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} + + # Keep steps separate for Github Actions annotation matching: https://github.com/actions/setup-node/blob/83c9f7a7df54d6b57455f7c57ac414f2ae5fb8de/src/setup-node.ts#L26-L33 - name: Lint run: yarn lint @@ -53,11 +71,63 @@ jobs: - name: Unit tests run: yarn test + build: + runs-on: ubuntu-latest + needs: 'install' + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14.x + + - uses: actions/cache/@v2 + with: + path: .cache/cypress + key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} + + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} + - name: Build Storybook run: yarn build-storybook --quiet - - name: Start Server - run: npx http-server docs -p 9001 & npx wait-on http://localhost:9001 + - name: Cache Build + id: build-cache + uses: actions/cache/@v2 + with: + path: docs + key: ${{ runner.os }}-build-${{ github.sha }} + + visual-test: + runs-on: ubuntu-latest + needs: 'build' + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to retrieve git history + - uses: actions/setup-node@v2 + with: + node-version: 14.x + + - uses: actions/cache/@v2 + with: + path: .cache/cypress + key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} + + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} + + - name: Restore Build + uses: actions/cache/@v2 + with: + path: docs + key: ${{ runner.os }}-build-${{ github.sha }} - uses: chromaui/action@v1 with: @@ -67,11 +137,53 @@ jobs: exitOnceUploaded: true exitZeroOnChanges: true + integration-test: + runs-on: ubuntu-latest + needs: 'build' + strategy: + fail-fast: false + matrix: + containers: [1, 2, 3, 4] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to retrieve git history + - uses: actions/setup-node@v2 + with: + node-version: 14.x + + - uses: actions/cache/@v2 + with: + path: .cache/cypress + key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }} + + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }} + + - name: Restore Build + uses: actions/cache/@v2 + with: + path: docs + key: ${{ runner.os }}-build-${{ github.sha }} + + - name: Start Server + run: npx http-server docs -p 9001 & npx wait-on http://localhost:9001 + - name: Integration tests - run: yarn cypress run --record + run: yarn cypress run --record --parallel env: # Github Actions doesn't support encryption on forks # If these keys become compromised, we will rotate and disable these features # on forked PRs until a suitable workaround is found CYPRESS_RECORD_KEY: 3a9347b6-36ab-4a36-823d-709f4078b148 CYPRESS_CACHE_FOLDER: .cache/cypress + + verify: + runs-on: ubuntu-latest + needs: ['check', 'integration-test'] + steps: + - name: Done + run: echo "Done" diff --git a/cypress.json b/cypress.json index a94dfe744b..de55d5e1ef 100644 --- a/cypress.json +++ b/cypress.json @@ -2,5 +2,8 @@ "projectId": "odida5", "baseUrl": "http://localhost:9001", "supportFile": "cypress/support/index.ts", - "watchForFileChanges": false + "watchForFileChanges": false, + "retries": { + "runMode": 2 + } }