|
| 1 | +name: Performance Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - trunk |
| 7 | + - 'feature/**' |
| 8 | + - '3.[7-9]' |
| 9 | + - '[4-9].[0-9]' |
| 10 | + tags: |
| 11 | + - '[0-9]+.[0-9]' |
| 12 | + - '[0-9]+.[0-9].[0-9]+' |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - trunk |
| 16 | + - 'feature/**' |
| 17 | + - '3.[7-9]' |
| 18 | + - '[4-9].[0-9]' |
| 19 | + |
| 20 | +jobs: |
| 21 | + # Runs the performance test suite. |
| 22 | + # |
| 23 | + # Performs the following steps: |
| 24 | + # - Sets environment variables. |
| 25 | + # - Checks out the repository. |
| 26 | + # - Sets up Node.js. |
| 27 | + # - Installs npm dependencies. |
| 28 | + # - Logs Docker debug information (about the Docker installation within the runner). |
| 29 | + # - Builds WordPress to run from the `build` directory. |
| 30 | + # - Starts the WordPress Docker container. |
| 31 | + # - Logs the running Docker containers. |
| 32 | + # - Install WordPress within the Docker container. |
| 33 | + # - Run the Performance tests. |
| 34 | + # - Ensures version-controlled files are not modified or deleted. |
| 35 | + performance: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + if: ${{ github.repository == '10up/wordpress-develop' || github.event_name == 'push' }} |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Configure environment variables |
| 41 | + run: | |
| 42 | + echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV |
| 43 | + echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV |
| 44 | +
|
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| 47 | + |
| 48 | + - name: Set up Node.js |
| 49 | + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 |
| 50 | + with: |
| 51 | + node-version-file: '.nvmrc' |
| 52 | + cache: npm |
| 53 | + |
| 54 | + - name: Install npm dependencies |
| 55 | + run: npm ci |
| 56 | + |
| 57 | + - name: Docker debug information |
| 58 | + run: | |
| 59 | + docker -v |
| 60 | + docker-compose -v |
| 61 | +
|
| 62 | + - name: Build WordPress |
| 63 | + run: npm run build |
| 64 | + |
| 65 | + - name: Start Docker environment |
| 66 | + run: npm run env:start |
| 67 | + |
| 68 | + - name: WordPress Docker container debug information |
| 69 | + run: | |
| 70 | + docker-compose run --rm mysql mysql --version |
| 71 | + docker-compose run --rm php php --version |
| 72 | + docker-compose run --rm php php -m |
| 73 | + docker-compose run --rm php php -i |
| 74 | + docker-compose run --rm php locale -a |
| 75 | +
|
| 76 | + - name: Install WordPress |
| 77 | + run: npm run env:install |
| 78 | + |
| 79 | + - name: Run Performance tests |
| 80 | + run: npm run test:performance |
| 81 | + |
| 82 | + - name: Ensure version-controlled files are not modified or deleted |
| 83 | + run: git diff --exit-code |
0 commit comments