2.4.36 - release #60
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: [push, pull_request] | |
jobs: | |
phpunit: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] | |
services: | |
mysql: | |
image: mysql:latest | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: test_database | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping --silent" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set Artifact Name | |
run: echo "ARTIFACT_NAME=my-artifact-${{ matrix.php-version }}-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV | |
- name: Start MySQL Service | |
run: sudo /etc/init.d/mysql start | |
- name: Create MySQL Database | |
run: | | |
echo "Creating MySQL database..." | |
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE IF NOT EXISTS test_database;' || exit 1 | |
# Check if the database is created | |
mysql -h 127.0.0.1 -u root -proot -e 'USE test_database;' || exit 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: pdo_mysql, xdebug, pcov, uopz | |
coverage: none | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-interaction | |
- name: Output Composer Suggests | |
run: composer suggests --all | |
- name: Install Suggested Packages | |
run: | | |
suggested=$(composer suggests --all) | |
if [ ! -z "$suggested" ]; then | |
echo "$suggested" | grep -oP '(?<=suggests installing )[^ ]+' | xargs -I {} composer require {} | |
else | |
echo "No suggested packages to install." | |
fi | |
- name: Debug MySQL Connection | |
run: | | |
echo "Attempting MySQL connection..." | |
mysql -h 127.0.0.1 -u root -proot -e 'SELECT 1' || exit 1 | |
- name: Run PHPUnit | |
run: vendor/bin/phpunit --configuration phpunit.xml | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: build/ |