|
| 1 | +name: E2E tests |
| 2 | +on: [deployment_status] |
| 3 | + |
| 4 | +jobs: |
| 5 | + set_pending: |
| 6 | + name: Register pending E2E tests |
| 7 | + if: github.event.deployment_status.state == 'pending' |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v1 |
| 12 | + |
| 13 | + - name: Set status to "pending" |
| 14 | + uses: ./.github/actions/set-pr-status |
| 15 | + env: |
| 16 | + GITHUB_TOKEN: ${{ secrets.GITHUB }} |
| 17 | + with: |
| 18 | + context: e2e tests |
| 19 | + status: pending |
| 20 | + message: Waiting for deployment |
| 21 | + |
| 22 | + run_tests: |
| 23 | + name: Run E2E tests on deployment success |
| 24 | + if: github.event.deployment_status.state == 'success' |
| 25 | + runs-on: ubuntu-latest |
| 26 | + container: cypress/browsers:node13.6.0-chrome80-ff72 |
| 27 | + env: |
| 28 | + NPM_RC: ${{ secrets.NPM_RC }} |
| 29 | + TERM: xterm |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v1 |
| 33 | + |
| 34 | + - name: Set status to "running" |
| 35 | + uses: ./.github/actions/set-pr-status |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB }} |
| 38 | + with: |
| 39 | + context: e2e tests |
| 40 | + status: pending |
| 41 | + message: E2E tests are running |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: yarn |
| 45 | + |
| 46 | + - name: Run E2E tests |
| 47 | + run: yarn e2e --config baseUrl=${{ github.event.deployment_status.target_url }} |
| 48 | + |
| 49 | + - name: Set status to "success" |
| 50 | + if: success() |
| 51 | + uses: ./.github/actions/set-pr-status |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB }} |
| 54 | + with: |
| 55 | + context: e2e tests |
| 56 | + status: success |
| 57 | + message: All tests are passed |
| 58 | + |
| 59 | + - name: Set status to "failure" |
| 60 | + if: failure() |
| 61 | + uses: ./.github/actions/set-pr-status |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB }} |
| 64 | + with: |
| 65 | + context: e2e tests |
| 66 | + status: failure |
| 67 | + message: Some tests are failed |
0 commit comments