-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup GitHub Actions for Testing/Linting Plugin (#582)
* Lint plugin * Run unit tests via docker/github actions * Use -T in docker-compose * Use docker command instead of docker compose * Remove interactive tty * List files in dir * Simplify docker from * Fix wp-cli * Use wp cli from run step * Run unit test on windows * Test docker unit tests with macos * Remove volume from docker compose * inspect container * Add working-directory to inspect step * Use entrypoint/cmd * Sleep for 30 secs * Link db * Try simplifying testing env * Use more verbose phpunit command * Check current dir * Composer install * Clean up test action * Set sleep to 15 seconds * Fix CircleCI test * Update documentation * Update action names
- Loading branch information
1 parent
4a7f147
commit 9a42ed7
Showing
11 changed files
with
128 additions
and
43 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
4 changes: 2 additions & 2 deletions
4
.github/workflows/eslint.yml → .github/workflows/lint-packages.yml
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,18 @@ | ||
name: Lint Plugin | ||
on: pull_request | ||
jobs: | ||
lint_plugin: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.3' | ||
- name: Install Dependencies | ||
working-directory: plugins/wpe-headless | ||
run: composer install | ||
- name: Run Lint | ||
working-directory: plugins/wpe-headless | ||
run: composer lint |
4 changes: 2 additions & 2 deletions
4
.github/workflows/test.yml → .github/workflows/test-packages.yml
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,19 @@ | ||
name: Test Plugin | ||
on: pull_request | ||
jobs: | ||
test_plugin: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Create Docker Containers | ||
working-directory: ./plugins/wpe-headless | ||
run: docker-compose up -d | ||
- name: Sleep 15 seconds | ||
run: sleep 15 | ||
- name: Setup testing framework | ||
working-directory: ./plugins/wpe-headless | ||
run: docker exec $(docker-compose ps -q wordpress) init-testing-environment.sh | ||
- name: Run unit tests | ||
working-directory: ./plugins/wpe-headless | ||
run: docker exec -w /var/www/html/wp-content/plugins/wpe-headless $(docker-compose ps -q wordpress) composer test |
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
12 changes: 12 additions & 0 deletions
12
plugins/wpe-headless/.docker/scripts/init-testing-environment.sh
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,12 @@ | ||
#!/bin/bash | ||
|
||
cd /var/www/html/wp-content/plugins/$WP_PLUGIN_FOLDER | ||
|
||
# Setup WordPress test core files and database | ||
bash -c "./bin/install-wp-tests.sh $WP_TESTS_DB_NAME $WORDPRESS_DB_USER $WORDPRESS_DB_PASSWORD $WORDPRESS_DB_HOST latest" | ||
|
||
# Install composer deps | ||
composer install | ||
|
||
# Back to the root WP folder | ||
cd /var/www/html/ |
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