Gh actions test #3
Workflow file for this run
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
name: PHPUnit Tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [ opened, synchronize ] | |
jobs: | |
phpunit: | |
name: PHPUnit ${{ matrix.php }} | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: | |
- 3306/tcp | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
# Set health checks to wait until mysql has started | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ '8.3' ] | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: 'none' | |
tools: composer | |
# Workaround since ramsey/composer-install doesn't support vendor-dir option for composer | |
- name: Move composer.json and composer.lock to src/plugin/ | |
run: cp composer.json src/plugin/ && cp composer.lock src/plugin/ | |
- name: Install dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
working-directory: "src/plugin" | |
composer-options: "--no-progress --no-ansi --no-interaction" | |
- name: Install WordPress test setup | |
run: bash tests/bin/install-wp-tests.sh wordpress_test root password 127.0.0.1:${{ job.services.mysql.ports[3306] }} latest | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Run tests | |
env: | |
WP_TESTS_DIR: /tmp/wordpress-tests-lib/ | |
working-directory: "./" | |
run: src/plugin/vendor/bin/phpunit |