Skip to content

Commit 4d7140b

Browse files
actions(tests): backport v2 workflow (pterodactyl#3558)
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
1 parent 0b521c0 commit 4d7140b

File tree

1 file changed

+22
-43
lines changed

1 file changed

+22
-43
lines changed

.github/workflows/tests.yml

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,59 @@
1-
name: run tests
1+
name: Run Tests
22
on:
33
push:
4-
branches-ignore:
5-
- master
6-
- "release/**"
4+
branches:
5+
- 'develop'
6+
- 'v2'
77
pull_request:
88
jobs:
99
tests:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-20.04
1111
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [ 7.4, 8.0 ]
16+
database: [ 'mariadb:10.2', 'mysql:8' ]
1217
services:
13-
mariadb:
14-
image: mariadb:10.2
18+
database:
19+
image: ${{ matrix.database }}
1520
env:
1621
MYSQL_ALLOW_EMPTY_PASSWORD: yes
1722
MYSQL_DATABASE: panel_test
1823
ports:
1924
- 3306
2025
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
21-
mysql:
22-
image: mysql:8
23-
env:
24-
MYSQL_ALLOW_EMPTY_PASSWORD: yes
25-
MYSQL_DATABASE: panel_test
26-
ports:
27-
- 3306
28-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
php: [ 7.4, 8.0 ]
33-
database: [ mysql, mariadb ]
34-
name: "php-${{ matrix.php }} (engine: ${{ matrix.database }})"
26+
name: "php-${{ matrix.php }} (${{ matrix.database }})"
3527
steps:
36-
- name: checkout
37-
uses: actions/checkout@v2
28+
- uses: actions/checkout@v2
3829
- name: get cache directory
3930
id: composer-cache
4031
run: |
4132
echo "::set-output name=dir::$(composer config cache-files-dir)"
42-
- name: cache dependencies
43-
uses: actions/cache@v2
33+
- uses: actions/cache@v2
4434
with:
4535
path: |
4636
~/.php_cs.cache
4737
${{ steps.composer-cache.outputs.dir }}
4838
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
49-
- name: setup
50-
uses: shivammathur/setup-php@v2
39+
- uses: shivammathur/setup-php@v2
5140
with:
5241
php-version: ${{ matrix.php }}
53-
extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip
42+
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
5443
tools: composer:v2
5544
coverage: none
56-
- name: configure
57-
run: cp .env.ci .env
58-
- name: install dependencies
59-
run: composer install --prefer-dist --no-interaction --no-progress
60-
- name: run cs-fixer
61-
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php_cs.dist
45+
- run: cp .env.ci .env
46+
- run: composer install --prefer-dist --no-interaction --no-progress
47+
- run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php
6248
continue-on-error: true
6349
- name: execute unit tests
6450
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
6551
if: ${{ always() }}
6652
env:
6753
DB_CONNECTION: testing
6854
TESTING_DB_HOST: UNIT_NO_DB
69-
- name: execute integration tests (mysql)
70-
run: vendor/bin/phpunit tests/Integration
71-
if: ${{ matrix.database == 'mysql' }}
72-
env:
73-
TESTING_DB_PORT: ${{ job.services.mysql.ports[3306] }}
74-
TESTING_DB_USERNAME: root
75-
- name: execute integration tests (mariadb)
55+
- name: execute integration tests
7656
run: vendor/bin/phpunit tests/Integration
77-
if: ${{ matrix.database == 'mariadb' }}
7857
env:
79-
TESTING_DB_PORT: ${{ job.services.mariadb.ports[3306] }}
58+
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
8059
TESTING_DB_USERNAME: root

0 commit comments

Comments
 (0)