67 lines
2.3 KiB
YAML
67 lines
2.3 KiB
YAML
name: Run Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'develop'
|
|
- 'feature/react-admin'
|
|
pull_request:
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-20.04
|
|
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php: [ 7.4, 8.0 ]
|
|
database: [ 'mariadb:10.2', 'mysql:8' ]
|
|
services:
|
|
database:
|
|
image: ${{ matrix.database }}
|
|
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
|
|
name: "php-${{ matrix.php }} (${{ matrix.database }})"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Get cache directory
|
|
id: composer-cache
|
|
run: |
|
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
- name: Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.php_cs.cache
|
|
${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cache-${{ matrix.php }}-
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
|
tools: composer:v2
|
|
coverage: none
|
|
- name: Configure .env
|
|
run: cp .env.ci .env
|
|
- name: composer install
|
|
run: composer install --prefer-dist --no-interaction --no-progress
|
|
- name: Run cs-fixer
|
|
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php
|
|
continue-on-error: true
|
|
- name: Execute Unit Tests
|
|
run: php artisan test tests/Unit
|
|
if: ${{ always() }}
|
|
env:
|
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
|
TESTING_DB_USERNAME: root
|
|
- name: Execute Integration Tests
|
|
run: php artisan test tests/Integration
|
|
env:
|
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
|
TESTING_DB_USERNAME: root
|