polls/.github/workflows/phpunit.yml

144 строки
4.0 KiB
YAML

name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
APP_NAME: polls
DB_PORT: 4444
SERVER_PATH: server
DB_USER: root
DB_PASSWORD: rootpassword
DB_NAME: nextcloud
jobs:
sqlite:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
server-versions: ['master']
name: SQLite
steps:
- uses: actions/checkout@v2
with:
path: src
- name: Setup server
uses: ./src/.github/actions/setup-server
with:
server-version: ${{ matrix.server-versions }}
php-version: ${{ matrix.php-versions }}
server-path: ${{ env.SERVER_PATH }}
db-engine: sqlite
db-port: ${{ env.DB_PORT}}
db-password: ${{ env.DB_PASSWORD }}
db-username: ${{ env.DB_USER }}
db-name: ${{ env.DB_NAME }}
- name: PHPUnit
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
- name: PHPUnit integration
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml
mysql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['8.0']
server-versions: ['stable24', 'stable23']
name: MySQL
services:
mysql:
image: mariadb:10.5
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- uses: actions/checkout@v2
with:
path: src
- name: Prepare server
uses: ./src/.github/actions/setup-server
with:
server-version: ${{ matrix.server-versions }}
php-version: ${{ matrix.php-versions }}
server-path: ${{ env.SERVER_PATH }}
db-engine: 'mysql'
db-port: ${{ env.DB_PORT }}
db-password: ${{ env.DB_PASSWORD }}
db-username: ${{ env.DB_USER }}
db-name: ${{ env.DB_NAME }}
- name: PHPUnit
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
- name: PHPUnit integration
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml
pgsql:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4']
server-versions: ['stable23', 'stable22']
name: PostgreSQL
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- uses: actions/checkout@v2
with:
path: src
- name: Prepare server
uses: ./src/.github/actions/setup-server
with:
server-version: ${{ matrix.server-versions }}
php-version: ${{ matrix.php-versions }}
server-path: ${{ env.SERVER_PATH }}
db-engine: 'pgsql'
db-port: ${{ env.DB_PORT}}
db-password: ${{ env.DB_PASSWORD }}
db-username: ${{ env.DB_USER }}
db-name: ${{ env.DB_NAME }}
- name: PHPUnit
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
- name: PHPUnit integration
working-directory: ${{ env.SERVER_PATH }}/apps/${{ env.APP_NAME }}
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml