-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,281 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ jobs: | |
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up WordPress and WordPress Test Library | ||
id: set1 | ||
uses: ./ | ||
with: | ||
version: latest | ||
|
@@ -47,3 +46,48 @@ jobs: | |
test -e /tmp/wordpress | ||
test -e /tmp/wordpress-tests-lib | ||
test -f /tmp/wordpress-tests-lib/wp-tests-config.php | ||
integration: | ||
name: Integration testing | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mariadb:latest | ||
ports: | ||
- '3306:3306' | ||
env: | ||
MYSQL_ROOT_PASSWORD: wordpress | ||
MARIADB_INITDB_SKIP_TZINFO: 1 | ||
MYSQL_USER: wordpress | ||
MYSQL_PASSWORD: wordpress | ||
MYSQL_DATABASE: wordpress_test | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
coverage: none | ||
php-version: "8.0" | ||
|
||
- name: Install PHP Dependencies | ||
uses: ramsey/[email protected] | ||
with: | ||
working-directory: wptest | ||
|
||
- name: Set up WordPress and WordPress Test Library | ||
uses: ./ | ||
with: | ||
version: latest | ||
|
||
- name: Verify MariaDB connection | ||
run: | | ||
while ! mysqladmin ping -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} --silent; do | ||
sleep 1 | ||
done | ||
timeout-minutes: 1 | ||
|
||
- name: Run tests | ||
run: vendor/bin/phpunit | ||
working-directory: wptest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,70 @@ This action sets up WordPress and WordPress Test Library. WordPress plugins can | |
* `version`: WordPress version to use. Can be `trunk` or `nightly` for the latest nightly build, `latest` for the latest available WordPress release, an explicit version number (like `6.0`) to install the specific WordPress version, or a partial version (`5.9.x`) to install the latest available patch for the specific WordPress release. The default value is `latest`. | ||
* `cache`: whether to use cached WordPress and WordPress Test Library. The default value is `true`. Nightly releases are never cached; | ||
* `dir`: target directory for WordPress and WordPress Test Library; the default value is `/tmp`. **Warning:** the system will delete `wordpress`, `wordpress-test-library`, and `wordpress.zip` from that directory if they exist. | ||
* `db_user`: database user for WordPress, `root` by default; | ||
* `db_password`: database password for WordPress, empty by default; | ||
* `db_user`: database user for WordPress, `wordpress` by default; | ||
* `db_password`: database password for WordPress, `wordpress` by default; | ||
* `db_name`: database name for WordPress, `wordpress_test` by default. **Warning:** WordPress Test Library may delete all tables from that database; | ||
* `db_host`: database host (`localhost` by default) for WordPress. | ||
* `db_host`: database host (`127.0.0.1` by default) for WordPress. | ||
|
||
## Outputs | ||
|
||
* `wp_version`: the actual WordPress version. | ||
|
||
## Environment Variables | ||
|
||
Upon success, the action sets the `WP_TESTS_DIR` environment variable; its value is the absolute path to the WordPress Test library | ||
|
||
## Example usage | ||
|
||
TBD. | ||
```yaml | ||
name: CI | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
testing: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mariadb:latest | ||
ports: | ||
- '3306:3306' | ||
env: | ||
MYSQL_ROOT_PASSWORD: wordpress | ||
MARIADB_INITDB_SKIP_TZINFO: 1 | ||
MYSQL_USER: wordpress | ||
MYSQL_PASSWORD: wordpress | ||
MYSQL_DATABASE: wordpress_test | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
coverage: none | ||
php-version: "8.0" | ||
|
||
- name: Install PHP Dependencies | ||
uses: ramsey/[email protected] | ||
|
||
- name: Set up WordPress and WordPress Test Library | ||
uses: sjinks/setup-wordpress-test-library | ||
with: | ||
version: latest | ||
|
||
- name: Verify MariaDB connection | ||
run: | | ||
while ! mysqladmin ping -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} --silent; do | ||
sleep 1 | ||
done | ||
timeout-minutes: 1 | ||
|
||
- name: Run tests | ||
run: vendor/bin/phpunit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
/.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5", | ||
"yoast/phpunit-polyfills": "^1.0" | ||
} | ||
} |
Oops, something went wrong.