|
| 1 | +name: Run e2e (canary demo) |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, labeled, unlabeled, synchronize] |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - 'demos/canary/**/*.{js,jsx,ts,tsx}' |
| 10 | + - 'cypress/integration/canary/**/*.{ts,js}' |
| 11 | + - 'src/**/*.{ts,js}' |
| 12 | +jobs: |
| 13 | + cypress: |
| 14 | + name: Cypress |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + containers: [1, 2, 3, 4] |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Generate Github token |
| 25 | + uses: navikt/github-app-token-generator@v1 |
| 26 | + id: get-token |
| 27 | + with: |
| 28 | + private-key: ${{ secrets.TOKENS_PRIVATE_KEY }} |
| 29 | + app-id: ${{ secrets.TOKENS_APP_ID }} |
| 30 | + |
| 31 | + - name: Checkout @netlify/wait-for-deploy-action |
| 32 | + uses: actions/checkout@v2 |
| 33 | + with: |
| 34 | + repository: netlify/wait-for-deploy-action |
| 35 | + token: ${{ steps.get-token.outputs.token }} |
| 36 | + path: ./.github/actions/wait-for-netlify-deploy |
| 37 | + |
| 38 | + - name: Wait for Netlify Deploy |
| 39 | + id: deploy |
| 40 | + uses: ./.github/actions/wait-for-netlify-deploy |
| 41 | + with: |
| 42 | + site-name: netlify-plugin-nextjs-demo |
| 43 | + timeout: 300 |
| 44 | + |
| 45 | + - name: Deploy successful |
| 46 | + if: ${{ steps.deploy.outputs.origin-url }} |
| 47 | + run: echo ${{ steps.deploy.outputs.origin-url }} |
| 48 | + |
| 49 | + - name: Node |
| 50 | + uses: actions/setup-node@v2 |
| 51 | + with: |
| 52 | + node-version: '16' |
| 53 | + |
| 54 | + - run: npm install |
| 55 | + |
| 56 | + - name: Cypress run |
| 57 | + if: ${{ steps.deploy.outputs.origin-url }} |
| 58 | + id: cypress |
| 59 | + uses: cypress-io/github-action@v2 |
| 60 | + with: |
| 61 | + browser: chrome |
| 62 | + headless: true |
| 63 | + record: true |
| 64 | + parallel: true |
| 65 | + config-file: cypress/config/canary.json |
| 66 | + group: 'Next Plugin - Demo Canary' |
| 67 | + spec: cypress/integration/canary/* |
| 68 | + env: |
| 69 | + DEBUG: '@cypress/github-action' |
| 70 | + CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }} |
| 71 | + CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }} |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + CYPRESS_RECORD_KEY: ${{ secrets.CANARY_CYPRESS_RECORD_KEY }} |
0 commit comments