2021-09-11 19:20:04 +00:00
|
|
|
name: Run Tests
|
2020-06-28 22:17:36 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-09-11 19:20:04 +00:00
|
|
|
branches:
|
|
|
|
- 'develop'
|
|
|
|
- 'v2'
|
2020-06-28 22:17:36 +00:00
|
|
|
pull_request:
|
|
|
|
jobs:
|
2021-04-17 19:10:40 +00:00
|
|
|
tests:
|
2021-09-11 19:20:04 +00:00
|
|
|
runs-on: ubuntu-20.04
|
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')"
|
2021-09-11 19:20:04 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-05-05 00:41:04 +00:00
|
|
|
php: [ 7.4, 8.0, 8.1 ]
|
2021-09-11 19:20:04 +00:00
|
|
|
database: [ 'mariadb:10.2', 'mysql:8' ]
|
2020-06-28 22:17:36 +00:00
|
|
|
services:
|
2021-09-11 19:20:04 +00:00
|
|
|
database:
|
|
|
|
image: ${{ matrix.database }}
|
2021-04-17 19:10:40 +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
|
2021-09-11 19:20:04 +00:00
|
|
|
name: "php-${{ matrix.php }} (${{ matrix.database }})"
|
2020-06-28 22:17:36 +00:00
|
|
|
steps:
|
2021-09-11 19:20:04 +00:00
|
|
|
- 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)"
|
2021-09-11 19:20:04 +00:00
|
|
|
- uses: actions/cache@v2
|
2020-06-28 22:22:39 +00:00
|
|
|
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') }}
|
2021-09-11 19:20:04 +00:00
|
|
|
- uses: shivammathur/setup-php@v2
|
2020-06-28 22:17:36 +00:00
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
2021-09-11 19:20:04 +00:00
|
|
|
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
2021-01-23 20:09:16 +00:00
|
|
|
tools: composer:v2
|
2020-06-28 22:17:36 +00:00
|
|
|
coverage: none
|
2021-09-11 19:20:04 +00:00
|
|
|
- run: cp .env.ci .env
|
|
|
|
- run: composer install --prefer-dist --no-interaction --no-progress
|
|
|
|
- run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php
|
2020-06-28 22:41:46 +00:00
|
|
|
continue-on-error: true
|
2020-06-28 22:31:06 +00:00
|
|
|
- name: execute unit tests
|
2021-09-11 19:13:15 +00:00
|
|
|
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
2020-06-28 22:40:02 +00:00
|
|
|
if: ${{ always() }}
|
2020-06-28 22:31:06 +00:00
|
|
|
env:
|
2022-05-05 00:41:04 +00:00
|
|
|
DB_HOST: UNIT_NO_DB
|
2021-09-11 19:20:04 +00:00
|
|
|
- name: execute integration tests
|
2021-04-17 19:10:40 +00:00
|
|
|
run: vendor/bin/phpunit tests/Integration
|
|
|
|
env:
|
2022-05-05 00:41:04 +00:00
|
|
|
DB_PORT: ${{ job.services.database.ports[3306] }}
|
|
|
|
DB_USERNAME: root
|