75 lines
1.8 KiB
YAML
75 lines
1.8 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
|
|
mongo:
|
|
image: mongo:6
|
|
ports:
|
|
- 27017:27017
|
|
options: >-
|
|
--health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })' || exit 1"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 30
|
|
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, mongodb
|
|
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
|
|
MONGO_HOST: 127.0.0.1
|
|
MONGO_PORT: 27017
|
|
run: |
|
|
vendor/bin/phpunit --colors=always
|