2022-10-14 18:59:20 +02:00
|
|
|
name: Tests
|
|
|
|
|
2020-06-29 00:17:36 +02:00
|
|
|
on:
|
|
|
|
push:
|
2021-09-11 21:20:04 +02:00
|
|
|
branches:
|
2022-10-26 18:43:05 +02:00
|
|
|
- "develop"
|
|
|
|
- "1.0-develop"
|
2020-06-29 00:17:36 +02:00
|
|
|
pull_request:
|
2022-10-26 18:43:05 +02:00
|
|
|
branches:
|
|
|
|
- "develop"
|
|
|
|
- "1.0-develop"
|
2022-10-14 18:59:20 +02:00
|
|
|
|
2020-06-29 00:17:36 +02:00
|
|
|
jobs:
|
2021-04-17 21:10:40 +02:00
|
|
|
tests:
|
2022-10-14 18:59:20 +02:00
|
|
|
name: Tests
|
2021-09-11 21:20:04 +02:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-02-23 20:30:16 +01:00
|
|
|
php: [8.1, 8.2]
|
2022-10-26 18:43:05 +02:00
|
|
|
database: ["mariadb:10.2", "mysql:8"]
|
2020-06-29 00:17:36 +02:00
|
|
|
services:
|
2021-09-11 21:20:04 +02:00
|
|
|
database:
|
|
|
|
image: ${{ matrix.database }}
|
2021-04-17 21:10:40 +02:00
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
2022-10-31 18:38:56 +01:00
|
|
|
MYSQL_DATABASE: testing
|
2021-04-17 21:10:40 +02:00
|
|
|
ports:
|
|
|
|
- 3306
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
2020-06-29 00:17:36 +02:00
|
|
|
steps:
|
2022-10-14 18:59:20 +02:00
|
|
|
- name: Code Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Get cache directory
|
2020-06-29 00:22:39 +02:00
|
|
|
id: composer-cache
|
|
|
|
run: |
|
2022-10-26 18:43:05 +02:00
|
|
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
2022-10-14 18:59:20 +02:00
|
|
|
|
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v3
|
2020-06-29 00:22:39 +02:00
|
|
|
with:
|
2022-10-26 18:43:05 +02:00
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-${{ matrix.php }}-
|
2022-10-14 18:59:20 +02:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
2020-06-29 00:17:36 +02:00
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
2021-09-11 21:20:04 +02:00
|
|
|
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
|
2021-01-23 21:09:16 +01:00
|
|
|
tools: composer:v2
|
2020-06-29 00:17:36 +02:00
|
|
|
coverage: none
|
2022-10-14 18:59:20 +02:00
|
|
|
|
|
|
|
- name: Setup .env
|
|
|
|
run: cp .env.ci .env
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
|
|
|
|
|
|
|
|
- name: Unit tests
|
2021-09-11 21:13:15 +02:00
|
|
|
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
|
2020-06-29 00:40:02 +02:00
|
|
|
if: ${{ always() }}
|
2020-06-29 00:31:06 +02:00
|
|
|
env:
|
2022-05-05 02:41:04 +02:00
|
|
|
DB_HOST: UNIT_NO_DB
|
2022-10-14 18:59:20 +02:00
|
|
|
|
|
|
|
- name: Integration tests
|
2021-04-17 21:10:40 +02:00
|
|
|
run: vendor/bin/phpunit tests/Integration
|
|
|
|
env:
|
2022-05-05 02:41:04 +02:00
|
|
|
DB_PORT: ${{ job.services.database.ports[3306] }}
|
|
|
|
DB_USERNAME: root
|