|
59 | 59 | id: check_files |
60 | 60 | run: echo "files_exists=$([ -f composer.json ] && [ -f behat.yml ] && echo true || echo false)" >> "$GITHUB_OUTPUT" |
61 | 61 |
|
| 62 | + # Downloading and starting the database server is the slowest part of the |
| 63 | + # setup, and nothing needs it until the test database is prepared, so it |
| 64 | + # runs in the background alongside the PHP and Composer setup below. The |
| 65 | + # action only downloads its own binaries, so it cannot contend with apt. |
| 66 | + - name: Setup MySQL Server |
| 67 | + id: setup-mysql |
| 68 | + if: ${{ inputs.dbtype != 'sqlite' }} |
| 69 | + background: true |
| 70 | + uses: shogo82148/actions-setup-mysql@334a29f22d90428932f75b11e0d5fcc00bb6b4f4 # v1 |
| 71 | + with: |
| 72 | + mysql-version: '8.0' # Standard MySQL version for these tests |
| 73 | + auto-start: true |
| 74 | + root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} |
| 75 | + user: ${{ env.WP_CLI_TEST_DBUSER}} |
| 76 | + password: ${{ env.WP_CLI_TEST_DBPASS}} |
| 77 | + my-cnf: | |
| 78 | + default_authentication_plugin=mysql_native_password |
| 79 | +
|
62 | 80 | # Ghostscript ships with the GitHub hosted images, so the `apt-get update` |
63 | 81 | # this used to run unconditionally cost every job ~25s for a package that |
64 | 82 | # was already there. Keep the install as a fallback in case a future image |
@@ -103,18 +121,10 @@ jobs: |
103 | 121 | run: | |
104 | 122 | sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml |
105 | 123 |
|
106 | | - - name: Setup MySQL Server |
107 | | - id: setup-mysql |
108 | | - if: ${{ inputs.dbtype != 'sqlite' }} |
109 | | - uses: shogo82148/actions-setup-mysql@334a29f22d90428932f75b11e0d5fcc00bb6b4f4 # v1 |
110 | | - with: |
111 | | - mysql-version: '8.0' # Standard MySQL version for these tests |
112 | | - auto-start: true |
113 | | - root-password: ${{ env.WP_CLI_TEST_DBROOTPASS }} |
114 | | - user: ${{ env.WP_CLI_TEST_DBUSER}} |
115 | | - password: ${{ env.WP_CLI_TEST_DBPASS}} |
116 | | - my-cnf: | |
117 | | - default_authentication_plugin=mysql_native_password |
| 124 | + # Waits for the database server started in the background above. `wait-all` |
| 125 | + # rather than `wait: setup-mysql`, as the step is skipped for SQLite legs. |
| 126 | + - name: Wait for the MySQL server |
| 127 | + wait-all: |
118 | 128 |
|
119 | 129 | - name: Prepare test database |
120 | 130 | if: steps.check_files.outputs.files_exists == 'true' && inputs.dbtype != 'sqlite' |
|
0 commit comments