Skip to content

Merge pull request #13 from porthorian/dependabot/github_actions/acti… #50

Merge pull request #13 from porthorian/dependabot/github_actions/acti…

Merge pull request #13 from porthorian/dependabot/github_actions/acti… #50

Workflow file for this run

name: PHP Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v6
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: PHP Versions
run: ls /etc/php && ls /usr/bin | grep php
tests:
runs-on: ubuntu-latest
needs: build
services:
mysql:
image: mysql:latest
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: test_password
MYSQL_DATABASE: test
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v6
id: composer-cache
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Verify MySQL connection
env:
PORT: ${{ job.services.mysql.ports['3306'] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: PHP Lint
run: composer lint
- name: Run 8.1 Test Suite
run: php8.1 vendor/bin/phpunit --no-coverage
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- name: Run 8.0 Test Suite
run: php8.0 vendor/bin/phpunit --no-coverage
env:
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports['3306'] }}