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

60 lines
2 KiB
YAML
Raw Normal View History

name: Run Tests
on:
push:
branches:
- 'develop'
- '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 ]
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:
- 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)"
- uses: actions/cache@v2
2020-06-28 22:22:39 +00:00
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
- 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
- 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
continue-on-error: true
- name: execute unit tests
2021-09-11 19:13:15 +00:00
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
if: ${{ always() }}
env:
DB_CONNECTION: testing
TESTING_DB_HOST: UNIT_NO_DB
- name: execute integration tests
2021-04-17 19:10:40 +00:00
run: vendor/bin/phpunit tests/Integration
env:
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
2021-04-17 19:10:40 +00:00
TESTING_DB_USERNAME: root