|
| 1 | +name: End-to-end Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + # The end to end test suite was introduced in WordPress 5.3. |
| 8 | + - '5.[3-9]' |
| 9 | + - '[6-9].[0-9]' |
| 10 | + tags: |
| 11 | + - '5.[3-9]*' |
| 12 | + - '[6-9].[0-9]*' |
| 13 | + pull_request: |
| 14 | + |
| 15 | +env: |
| 16 | + LOCAL_DIR: build |
| 17 | + |
| 18 | +jobs: |
| 19 | + # Runs the end-to-end test suite. |
| 20 | + # |
| 21 | + # Performs the following steps: |
| 22 | + # - Cancels all previous workflow runs for pull requests that have not completed. |
| 23 | + # - Set environment variables. |
| 24 | + # - Checks out the repository. |
| 25 | + # - Logs debug information about the runner container. |
| 26 | + # - Installs NodeJS 14. |
| 27 | + # - Sets up caching for NPM. |
| 28 | + # _ Installs NPM dependencies using install-changed to hash the `package.json` file. |
| 29 | + # - Builds WordPress to run from the `build` directory. |
| 30 | + # - Starts the WordPress Docker container. |
| 31 | + # - Logs general debug information. |
| 32 | + # - Logs the running Docker containers. |
| 33 | + # - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container). |
| 34 | + # - Install WordPress within the Docker container. |
| 35 | + # - Run the E2E tests. |
| 36 | + # - todo: Configure Slack notifications for failing tests. |
| 37 | + e2e-tests: |
| 38 | + name: E2E Tests |
| 39 | + runs-on: ubuntu-latest |
| 40 | + if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Cancel previous runs of this workflow (pull requests only) |
| 44 | + if: ${{ github.event_name == 'pull_request' }} |
| 45 | + uses: styfle/cancel-workflow-action@0.5.0 |
| 46 | + with: |
| 47 | + access_token: ${{ github.token }} |
| 48 | + |
| 49 | + - name: Configure environment variables |
| 50 | + run: | |
| 51 | + echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV |
| 52 | + echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV |
| 53 | +
|
| 54 | + - name: Checkout repository |
| 55 | + uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - name: Log debug information |
| 58 | + run: | |
| 59 | + npm --version |
| 60 | + node --version |
| 61 | + curl --version |
| 62 | + git --version |
| 63 | + svn --version |
| 64 | + php --version |
| 65 | + php -i |
| 66 | + locale -a |
| 67 | +
|
| 68 | + - name: Install NodeJS |
| 69 | + uses: actions/setup-node@v1 |
| 70 | + with: |
| 71 | + node-version: 14 |
| 72 | + |
| 73 | + - name: Cache NodeJS modules |
| 74 | + uses: actions/cache@v2 |
| 75 | + env: |
| 76 | + cache-name: cache-node-modules |
| 77 | + with: |
| 78 | + # npm cache files are stored in `~/.npm` on Linux/macOS |
| 79 | + path: ~/.npm |
| 80 | + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} |
| 81 | + restore-keys: | |
| 82 | + ${{ runner.os }}-npm- |
| 83 | +
|
| 84 | + - name: Install Dependencies |
| 85 | + run: npx install-changed --install-command="npm ci" |
| 86 | + |
| 87 | + - name: Build WordPress |
| 88 | + run: npm run build |
| 89 | + |
| 90 | + - name: Start Docker environment |
| 91 | + run: | |
| 92 | + npm run env:start |
| 93 | +
|
| 94 | + - name: General debug information |
| 95 | + run: | |
| 96 | + npm --version |
| 97 | + node --version |
| 98 | + curl --version |
| 99 | + git --version |
| 100 | + svn --version |
| 101 | +
|
| 102 | + - name: Log running Docker containers |
| 103 | + run: docker ps -a |
| 104 | + |
| 105 | + - name: Docker debug information |
| 106 | + run: | |
| 107 | + docker -v |
| 108 | + docker-compose -v |
| 109 | + docker-compose run --rm mysql mysql --version |
| 110 | + docker-compose run --rm php php --version |
| 111 | + docker-compose run --rm php php -m |
| 112 | + docker-compose run --rm php php -i |
| 113 | + docker-compose run --rm php locale -a |
| 114 | +
|
| 115 | + - name: Install WordPress |
| 116 | + run: npm run env:install |
| 117 | + |
| 118 | + - name: Run E2E tests |
| 119 | + run: npm run test:e2e |
0 commit comments