2021-04-17 19:10:40 +00:00
|
|
|
name: run tests
|
2020-06-28 22:17:36 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-04-17 19:10:40 +00:00
|
|
|
branches-ignore:
|
|
|
|
- master
|
|
|
|
- "release/**"
|
2020-06-28 22:17:36 +00:00
|
|
|
pull_request:
|
|
|
|
jobs:
|
2021-04-17 19:10:40 +00:00
|
|
|
tests:
|
2020-06-28 22:17:36 +00:00
|
|
|
runs-on: ubuntu-latest
|
2020-11-15 04:46:37 +00:00
|
|
|
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
2020-06-28 22:17:36 +00:00
|
|
|
services:
|
2021-04-17 19:10:40 +00:00
|
|
|
mariadb:
|
|
|
|
image: mariadb:10.2
|
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
|
|
MYSQL_DATABASE: panel_test
|
|
|
|
ports:
|
|
|
|
- 3306
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
2020-06-28 22:17:36 +00:00
|
|
|
mysql:
|
2021-04-17 19:10:40 +00:00
|
|
|
image: mysql:8
|
2020-06-28 22:17:36 +00:00
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
|
|
MYSQL_DATABASE: panel_test
|
|
|
|
ports:
|
|
|
|
- 3306
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
strategy:
|
2021-01-23 20:09:16 +00:00
|
|
|
fail-fast: false
|
2020-06-28 22:17:36 +00:00
|
|
|
matrix:
|
2021-04-17 19:10:40 +00:00
|
|
|
php: [ 7.4, 8.0 ]
|
|
|
|
database: [ mysql, mariadb ]
|
2021-04-17 19:12:04 +00:00
|
|
|
name: "php-${{ matrix.php }} (engine: ${{ matrix.database }})"
|
2020-06-28 22:17:36 +00:00
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-06-28 22:22:39 +00:00
|
|
|
- name: get cache directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: cache dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2020-06-28 22:40:02 +00:00
|
|
|
path: |
|
|
|
|
~/.php_cs.cache
|
|
|
|
${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
|
2020-06-28 22:22:39 +00:00
|
|
|
restore-keys: |
|
2020-06-28 22:40:02 +00:00
|
|
|
${{ runner.os }}-cache-${{ matrix.php }}-
|
2020-06-28 22:17:36 +00:00
|
|
|
- name: setup
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
|
|
|
extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip
|
2021-01-23 20:09:16 +00:00
|
|
|
tools: composer:v2
|
2020-06-28 22:17:36 +00:00
|
|
|
coverage: none
|
2020-06-28 22:26:09 +00:00
|
|
|
- name: configure
|
|
|
|
run: cp .env.ci .env
|
2020-06-28 22:17:36 +00:00
|
|
|
- name: install dependencies
|
2020-06-28 22:22:39 +00:00
|
|
|
run: composer install --prefer-dist --no-interaction --no-progress
|
2020-06-28 22:40:02 +00:00
|
|
|
- name: run cs-fixer
|
2021-01-26 03:25:15 +00:00
|
|
|
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php_cs.dist
|
2020-06-28 22:41:46 +00:00
|
|
|
continue-on-error: true
|
2020-06-28 22:31:06 +00:00
|
|
|
- name: execute unit tests
|
|
|
|
run: vendor/bin/phpunit --bootstrap bootstrap/app.php tests/Unit
|
2020-06-28 22:40:02 +00:00
|
|
|
if: ${{ always() }}
|
2020-06-28 22:31:06 +00:00
|
|
|
env:
|
|
|
|
DB_CONNECTION: testing
|
|
|
|
TESTING_DB_HOST: UNIT_NO_DB
|
2021-04-17 19:10:40 +00:00
|
|
|
- name: execute integration tests (mysql)
|
2020-06-28 22:17:36 +00:00
|
|
|
run: vendor/bin/phpunit tests/Integration
|
2021-04-17 19:10:40 +00:00
|
|
|
if: "${{ matrix.database }} == 'mysql'"
|
2020-06-28 22:17:36 +00:00
|
|
|
env:
|
|
|
|
TESTING_DB_PORT: ${{ job.services.mysql.ports[3306] }}
|
|
|
|
TESTING_DB_USERNAME: root
|
2021-04-17 19:10:40 +00:00
|
|
|
- name: execute integration tests (mariadb)
|
|
|
|
run: vendor/bin/phpunit tests/Integration
|
|
|
|
if: "${{ matrix.database }} == 'mariadb'"
|
|
|
|
env:
|
|
|
|
TESTING_DB_PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
TESTING_DB_USERNAME: root
|