2021-07-09 18:58:06 +00:00
|
|
|
name: Run Tests
|
2020-06-28 22:17:36 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-07-09 19:07:17 +00:00
|
|
|
branches:
|
|
|
|
- 'develop'
|
2021-08-02 21:25:44 +00:00
|
|
|
- 'v2'
|
2020-06-28 22:17:36 +00:00
|
|
|
pull_request:
|
|
|
|
jobs:
|
2021-04-17 19:10:40 +00:00
|
|
|
tests:
|
2021-07-09 18:58:06 +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-07-09 18:58:06 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php: [ 7.4, 8.0 ]
|
2021-07-24 21:20:30 +00:00
|
|
|
database: [ 'mariadb:10.2', 'mysql:8' ]
|
2020-06-28 22:17:36 +00:00
|
|
|
services:
|
2021-07-09 18:58:06 +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-07-09 18:58:06 +00:00
|
|
|
name: "php-${{ matrix.php }} (${{ matrix.database }})"
|
2020-06-28 22:17:36 +00:00
|
|
|
steps:
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Checkout
|
2020-06-28 22:17:36 +00:00
|
|
|
uses: actions/checkout@v2
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Get cache directory
|
2020-06-28 22:22:39 +00:00
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Cache
|
2020-06-28 22:22:39 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2020-06-28 22:40:02 +00:00
|
|
|
path: |
|
|
|
|
~/.php_cs.cache
|
|
|
|
${{ steps.composer-cache.outputs.dir }}
|
2021-10-30 20:41:38 +00:00
|
|
|
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Setup PHP
|
2020-06-28 22:17:36 +00:00
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
2021-07-09 18:58:06 +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-07-09 18:58:06 +00:00
|
|
|
- name: Configure .env
|
2020-06-28 22:26:09 +00:00
|
|
|
run: cp .env.ci .env
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: composer install
|
2020-06-28 22:22:39 +00:00
|
|
|
run: composer install --prefer-dist --no-interaction --no-progress
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Run cs-fixer
|
2021-10-30 20:41:38 +00:00
|
|
|
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=txt --config .php-cs-fixer.dist.php
|
2020-06-28 22:41:46 +00:00
|
|
|
continue-on-error: true
|
2021-10-30 20:41:38 +00:00
|
|
|
- name: Static Analysis
|
|
|
|
if: ${{ matrix.php }} == '8.0'
|
|
|
|
run: |
|
|
|
|
php artisan ide-helper:models -N
|
|
|
|
./vendor/bin/phpstan analyse --memory-limit=2G
|
|
|
|
env:
|
|
|
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Execute Unit Tests
|
2021-07-24 21:05:37 +00:00
|
|
|
run: php artisan test tests/Unit
|
2020-06-28 22:40:02 +00:00
|
|
|
if: ${{ always() }}
|
2020-06-28 22:31:06 +00:00
|
|
|
env:
|
2021-07-24 21:08:13 +00:00
|
|
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
2021-07-09 18:58:06 +00:00
|
|
|
- name: Execute Integration Tests
|
2021-07-24 21:05:37 +00:00
|
|
|
run: php artisan test tests/Integration
|
2021-10-30 20:41:38 +00:00
|
|
|
if: ${{ always() }}
|
2021-04-17 19:10:40 +00:00
|
|
|
env:
|
2021-07-09 18:58:06 +00:00
|
|
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|