|
1 | 1 | name: Unit Testing |
| 2 | + |
2 | 3 | on: |
3 | | - push: |
4 | | - pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - trunk |
| 7 | + paths: |
| 8 | + - '**.php' |
| 9 | + - 'composer.json' |
| 10 | + - 'composer.lock' |
| 11 | + - 'phpunit.xml.dist' |
| 12 | + - '.github/workflows/phpunit.yml' |
| 13 | + pull_request: |
| 14 | + paths: |
| 15 | + - '**.php' |
| 16 | + - 'composer.json' |
| 17 | + - 'composer.lock' |
| 18 | + - 'phpunit.xml.dist' |
| 19 | + - '.github/workflows/phpunit.yml' |
| 20 | + |
5 | 21 | jobs: |
6 | 22 | phpunit: |
7 | 23 | runs-on: ubuntu-latest |
8 | 24 | services: |
9 | | - mysql: |
10 | | - image: mariadb:10.4 |
11 | | - env: |
12 | | - MYSQL_ROOT_PASSWORD: root |
13 | | - ports: |
14 | | - - 3306:3306 |
15 | | - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 |
| 25 | + mysql: |
| 26 | + image: mariadb:10.4 |
| 27 | + env: |
| 28 | + MYSQL_ROOT_PASSWORD: root |
| 29 | + ports: |
| 30 | + - 3306:3306 |
| 31 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 |
16 | 32 | strategy: |
17 | 33 | matrix: |
18 | | - php-versions: ['7.2', '7.3', '7.4', '8.0'] |
| 34 | + php-versions: ['7.4', '8.0', '8.2', '8.3'] |
| 35 | + wp-version: ['latest'] |
| 36 | + include: |
| 37 | + - php-versions: '7.4' |
| 38 | + wp-version: '6.2' |
| 39 | + - php-versions: '8.3' |
| 40 | + wp-version: 'trunk' |
19 | 41 | steps: |
20 | 42 | - name: Checkout |
21 | | - uses: actions/checkout@v3 |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Install subversion |
| 46 | + run: sudo apt-get update && sudo apt-get install -y subversion |
| 47 | + |
22 | 48 | - name: Setup PHP |
23 | 49 | uses: shivammathur/setup-php@v2 |
24 | 50 | with: |
25 | 51 | php-version: ${{ matrix.php-versions }} |
26 | 52 | coverage: none |
27 | | - tools: composer, , phpunit-polyfills |
| 53 | + tools: composer, phpunit-polyfills |
28 | 54 | extensions: mysql |
29 | | - - name: Install Composer dependencies for PHP |
30 | | - uses: "ramsey/composer-install@v2" |
| 55 | + |
| 56 | + - name: Install Composer dependencies |
| 57 | + uses: ramsey/composer-install@v3 |
| 58 | + |
31 | 59 | - name: Setup Test Environment |
32 | | - run: composer setup-local-tests |
33 | | - - name: Unit Testing |
34 | | - run: composer phpunit |
| 60 | + run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp-version }} |
| 61 | + |
| 62 | + - name: Run PHPUnit |
| 63 | + run: ./vendor/bin/phpunit --colors=always |
35 | 64 | env: |
36 | 65 | PHP_VERSION: ${{ matrix.php-versions }} |
0 commit comments