misc_pterodactyl-panel/.github/workflows/tests.yml

72 lines
2.4 KiB
YAML
Raw Normal View History

name: Run Tests
on:
push:
branches:
- 'develop'
2021-08-02 21:25:44 +00:00
- 'v2'
pull_request:
jobs:
2021-04-17 19:10:40 +00:00
tests:
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')"
strategy:
fail-fast: false
matrix:
php: [ 7.4, 8.0 ]
2021-07-24 21:20:30 +00:00
database: [ 'mariadb:10.2', 'mysql:8' ]
services:
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
name: "php-${{ matrix.php }} (${{ matrix.database }})"
steps:
- name: Checkout
uses: actions/checkout@v2
- 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)"
- name: Cache
2020-06-28 22:22:39 +00:00
uses: actions/cache@v2
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
- 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
2020-06-28 22:26:09 +00:00
run: cp .env.ci .env
- name: composer install
2020-06-28 22:22:39 +00:00
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run cs-fixer
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format=txt --config .php-cs-fixer.dist.php
continue-on-error: true
- 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] }}
- name: Execute Unit Tests
run: php artisan test tests/Unit
if: ${{ always() }}
env:
2021-07-24 21:08:13 +00:00
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
- name: Execute Integration Tests
run: php artisan test tests/Integration
if: ${{ always() }}
2021-04-17 19:10:40 +00:00
env:
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}