|
1 | 1 | name: GraphiQL End-to-End Tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - develop |
| 11 | + - master |
| 12 | + paths: |
| 13 | + - '**.js' |
| 14 | + - '.github/workflows/*.yml' |
| 15 | + - '!docs/**' |
| 16 | + |
| 17 | +# Cancel previous workflow run groups that have not completed. |
| 18 | +concurrency: |
| 19 | + # Group workflow runs by workflow name, along with the head branch ref of the pull request |
| 20 | + # or otherwise the branch or tag ref. |
| 21 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} |
| 22 | + cancel-in-progress: true |
5 | 23 |
|
6 | 24 | jobs: |
7 | | - admin: |
8 | | - name: GraphiQL E2E Tests |
9 | | - runs-on: ubuntu-latest |
10 | | - if: ${{ github.repository == 'wp-graphql/wp-graphql' || github.event_name == 'pull_request' }} |
11 | | - strategy: |
12 | | - fail-fast: false |
13 | | - matrix: |
14 | | - node: ['16.13.0'] |
15 | | - |
16 | | - steps: |
17 | | - - name: Cancel previous runs of this workflow (pull requests only) |
18 | | - if: ${{ github.event_name == 'pull_request' }} |
19 | | - |
20 | | - with: |
21 | | - access_token: ${{ github.token }} |
22 | | - |
23 | | - - name: Checkout |
24 | | - uses: actions/checkout@v3 |
25 | | - |
26 | | - - name: Use desired version of NodeJS |
27 | | - uses: actions/setup-node@v3 |
28 | | - with: |
29 | | - node-version: ${{ matrix.node }} |
30 | | - cache: npm |
31 | | - |
32 | | - - name: Setup PHP w/ Composer & WP-CLI |
33 | | - uses: shivammathur/setup-php@v2 |
34 | | - with: |
35 | | - php-version: 7.3 |
36 | | - extensions: mbstring, intl, bcmath, exif, gd, mysqli, opcache, zip, pdo_mysql |
37 | | - coverage: none |
38 | | - tools: composer, wp-cli |
39 | | - |
40 | | - - name: Install Composer Dependencies |
41 | | - run: | |
42 | | - composer install --no-dev |
43 | | -
|
44 | | - - name: Install NPM Dependencies and Build the GraphiQL App |
45 | | - id: install-and-build |
46 | | - run: | |
47 | | - npm ci && npm run build |
48 | | -
|
49 | | - - name: Install WordPress |
50 | | - run: | |
51 | | - npm run wp-env start |
52 | | - - name: Running the tests |
53 | | - run: | |
54 | | - npm run test-e2e |
| 25 | + e2e-tests: |
| 26 | + name: E2E tests on Node ${{ matrix.node-version }} |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout code |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Setup Node.js |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: 18 |
| 37 | + |
| 38 | + - name: Setup PHP |
| 39 | + uses: shivammathur/setup-php@v2 |
| 40 | + with: |
| 41 | + php-version: 8.2 |
| 42 | + extensions: mbstring, intl |
| 43 | + tools: composer |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + uses: ramsey/composer-install@v3 |
| 47 | + with: |
| 48 | + composer-options: "--no-progress" |
| 49 | + |
| 50 | + - name: Install JavaScript dependencies |
| 51 | + run: npm ci |
| 52 | + |
| 53 | + - name: Build Assets |
| 54 | + run: npm run build |
| 55 | + |
| 56 | + - name: Install Playwright dependencies |
| 57 | + run: | |
| 58 | + npx playwright install chromium firefox webkit --with-deps |
| 59 | +
|
| 60 | + - name: Start WordPress Environment |
| 61 | + run: npm run wp-env -- start |
| 62 | + |
| 63 | + - name: Run E2E tests |
| 64 | + run: npm run test:e2e |
| 65 | + |
| 66 | + - name: Stop WordPress Environment |
| 67 | + run: npm run wp-env -- stop |
0 commit comments