tests: update worflows test to fix phpunit with php 8.*

This commit is contained in:
vnmedeiros 2024-03-13 10:39:42 -03:00
parent 64710523c7
commit 5cd404fd39
1 changed files with 11 additions and 18 deletions

View File

@ -1,3 +1,4 @@
# to run localy ./bin/act -j test
name: Tainacan tests name: Tainacan tests
on: on:
@ -23,7 +24,7 @@ jobs:
matrix: matrix:
# Notes regarding supported versions in WP: # Notes regarding supported versions in WP:
# The base matrix only contains the PHP versions which are supported on all supported WP versions. # The base matrix only contains the PHP versions which are supported on all supported WP versions.
php: ['7.3', '7.4', '8.3'] php: ['7.4', '8.3']
wp: ['latest', '5.9'] wp: ['latest', '5.9']
experimental: [false] experimental: [false]
@ -50,7 +51,7 @@ jobs:
# in combination with PHP < 7.4 is not properly/sufficiently supported # in combination with PHP < 7.4 is not properly/sufficiently supported
# within WP Core. # within WP Core.
# See: https://core.trac.wordpress.org/ticket/52496 # See: https://core.trac.wordpress.org/ticket/52496
image: mysql:${{ ( matrix.wp == 5.3 && '5.6' ) || ( (matrix.wp < 5.9 || matrix.php < 7.4) && '5.7' ) || '8.0' }} image: mysql:8.0
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ALLOW_EMPTY_PASSWORD: false
ports: ports:
@ -72,6 +73,9 @@ jobs:
- name: Check PHP Version - name: Check PHP Version
run: php -v run: php -v
- name: install tools deps
run: apt install mariadb-client -y
- name: Add bootstrap-config - name: Add bootstrap-config
run: | run: |
mv ./tests/bootstrap-config-sample.php ./tests/bootstrap-config.php mv ./tests/bootstrap-config-sample.php ./tests/bootstrap-config.php
@ -90,29 +94,18 @@ jobs:
- name: Determine supported PHPUnit version - name: Determine supported PHPUnit version
id: set_phpunit id: set_phpunit
run: | run: |
if [[ "${{ matrix.php }}" = "8.0" ]]; then if [[ "${{ matrix.php }}" > "8.0" ]]; then
wget https://phar.phpunit.de/phpunit-9.3.0.phar -P /tmp wget https://phar.phpunit.de/phpunit-9.6.16.phar -P /tmp
chmod +x /tmp/phpunit-9.3.0.phar chmod +x /tmp/phpunit-9.6.16.phar
mv /tmp/phpunit-9.3.0.phar /usr/local/bin/phpunit mv /tmp/phpunit-9.6.16.phar /usr/local/bin/phpunit
elif [[ "${{ matrix.php }}" > "6.0" ]]; then else
wget https://phar.phpunit.de/phpunit-6.5.7.phar -P /tmp wget https://phar.phpunit.de/phpunit-6.5.7.phar -P /tmp
chmod +x /tmp/phpunit-6.5.7.phar chmod +x /tmp/phpunit-6.5.7.phar
mv /tmp/phpunit-6.5.7.phar /usr/local/bin/phpunit mv /tmp/phpunit-6.5.7.phar /usr/local/bin/phpunit
else
wget https://phar.phpunit.de/phpunit-5.phar -P /tmp
chmod +x /tmp/phpunit-5.phar
mv /tmp/phpunit-5.phar /usr/local/bin/phpunit
fi fi
# Install dependencies and handle caching in one go. # Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies # @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies for PHP < 7.3
if: ${{ matrix.php < 7.3 }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs
dependency-versions: "lowest"
- name: Install Composer dependencies for PHP < 8.0 - name: Install Composer dependencies for PHP < 8.0
if: ${{ matrix.php >= 7.3 && matrix.php < 8.0 }} if: ${{ matrix.php >= 7.3 && matrix.php < 8.0 }}
uses: "ramsey/composer-install@v1" uses: "ramsey/composer-install@v1"