Pairity/.github/workflows/ci.yml
2025-12-10 07:01:07 -06:00

64 lines
1.5 KiB
YAML

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2', '8.3' ]
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: pairity
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -proot"
--health-interval 10s
--health-timeout 5s
--health-retries 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo, pdo_mysql, pdo_sqlite
coverage: none
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist
- name: Prepare MySQL
run: |
sudo apt-get update
# wait for mysql to be healthy
for i in {1..30}; do
if mysqladmin ping -h 127.0.0.1 -proot --silent; then
break
fi
sleep 2
done
mysql -h 127.0.0.1 -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS pairity;'
- name: Run tests
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: 3306
MYSQL_DB: pairity
MYSQL_USER: root
MYSQL_PASS: root
run: |
vendor/bin/phpunit --colors=always