Skip to content

PHPUnit

PHPUnit #132

Workflow file for this run

name: PHPUnit
on:
push:
branches:
- master
tags:
- "*.*.*"
pull_request:
branches:
- master
schedule:
- cron: "0 9 * * 1"
jobs:
Build:
runs-on: 'ubuntu-latest'
container: 'byjg/php:${{ matrix.php-version }}-cli'
strategy:
matrix:
php-version:
- "8.3"
- "8.2"
- "8.1"
services:
mysql:
image: bitnami/mysql:8.0.20
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=20s
--health-retries=10
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
# sqlserver:
# image: mcr.microsoft.com/mssql/server
# env:
# ACCEPT_EULA: Y
# SA_PASSWORD: Pa55word
# ports:
# - "1433:1433"
# options: >-
# --health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P Pa55word -Q 'SELECT 1'"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
env:
MYSQL_TEST_HOST: mysql
PSQL_TEST_HOST: postgres
MSSQL_TEST_HOST: sqlserver
steps:
- uses: actions/checkout@v4
# - name: Spin up databases
# run: |
# apk add --no-cache python3 python3-dev py3-pip build-base libffi-dev
# pip3 install --upgrade pip
# pip3 install docker-compose
# apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community docker
# docker-compose up -d postgres mysql
- run: composer install
- run: ./vendor/bin/phpunit
- run: ./vendor/bin/phpunit tests/SqliteDatabase*
- run: ./vendor/bin/phpunit tests/MysqlDatabase*
- run: ./vendor/bin/phpunit tests/PostgresDatabase*
# - run: ./vendor/bin/phpunit tests/SqlServerSqlsrv*
# - run: ./vendor/bin/phpunit tests/SqlServerDblib*
Documentation:
if: github.ref == 'refs/heads/master'
needs: Build
uses: byjg/byjg.github.io/.github/workflows/add-doc.yaml@master
with:
folder: php
project: ${{ github.event.repository.name }}
secrets: inherit