actions(tests): backport v2 workflow (#3558)
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
This commit is contained in:
parent
0b521c011f
commit
4d7140bd3b
1 changed files with 25 additions and 46 deletions
71
.github/workflows/tests.yml
vendored
71
.github/workflows/tests.yml
vendored
|
@ -1,64 +1,50 @@
|
||||||
name: run tests
|
name: Run Tests
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches:
|
||||||
- master
|
- 'develop'
|
||||||
- "release/**"
|
- 'v2'
|
||||||
pull_request:
|
pull_request:
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
|
||||||
services:
|
|
||||||
mariadb:
|
|
||||||
image: mariadb:10.2
|
|
||||||
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
|
|
||||||
mysql:
|
|
||||||
image: mysql:8
|
|
||||||
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
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php: [ 7.4, 8.0 ]
|
php: [ 7.4, 8.0 ]
|
||||||
database: [ mysql, mariadb ]
|
database: [ 'mariadb:10.2', 'mysql:8' ]
|
||||||
name: "php-${{ matrix.php }} (engine: ${{ matrix.database }})"
|
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:
|
steps:
|
||||||
- name: checkout
|
- uses: actions/checkout@v2
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: get cache directory
|
- name: get cache directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: cache dependencies
|
- uses: actions/cache@v2
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.php_cs.cache
|
~/.php_cs.cache
|
||||||
${{ steps.composer-cache.outputs.dir }}
|
${{ steps.composer-cache.outputs.dir }}
|
||||||
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
|
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
|
||||||
- name: setup
|
- uses: shivammathur/setup-php@v2
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip
|
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
coverage: none
|
coverage: none
|
||||||
- name: configure
|
- run: cp .env.ci .env
|
||||||
run: cp .env.ci .env
|
- run: composer install --prefer-dist --no-interaction --no-progress
|
||||||
- name: install dependencies
|
- run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config .php-cs-fixer.dist.php
|
||||||
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.dist
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: execute unit tests
|
- name: execute unit tests
|
||||||
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
||||||
|
@ -66,15 +52,8 @@ jobs:
|
||||||
env:
|
env:
|
||||||
DB_CONNECTION: testing
|
DB_CONNECTION: testing
|
||||||
TESTING_DB_HOST: UNIT_NO_DB
|
TESTING_DB_HOST: UNIT_NO_DB
|
||||||
- name: execute integration tests (mysql)
|
- name: execute integration tests
|
||||||
run: vendor/bin/phpunit tests/Integration
|
run: vendor/bin/phpunit tests/Integration
|
||||||
if: ${{ matrix.database == 'mysql' }}
|
|
||||||
env:
|
env:
|
||||||
TESTING_DB_PORT: ${{ job.services.mysql.ports[3306] }}
|
TESTING_DB_PORT: ${{ job.services.database.ports[3306] }}
|
||||||
TESTING_DB_USERNAME: root
|
|
||||||
- name: execute integration tests (mariadb)
|
|
||||||
run: vendor/bin/phpunit tests/Integration
|
|
||||||
if: ${{ matrix.database == 'mariadb' }}
|
|
||||||
env:
|
|
||||||
TESTING_DB_PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
||||||
TESTING_DB_USERNAME: root
|
TESTING_DB_USERNAME: root
|
||||||
|
|
Loading…
Reference in a new issue