83 lines
2.1 KiB
YAML
83 lines
2.1 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
phpunit:
|
|
name: PHPUnit
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mariadb:10.11
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
MYSQL_DATABASE: alrahma_test
|
|
MYSQL_USER: alrahma
|
|
MYSQL_PASSWORD: alrahma
|
|
ports:
|
|
- 3306:3306
|
|
options: >-
|
|
--health-cmd="mariadb-admin ping -h 127.0.0.1 -uroot -proot"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=10
|
|
|
|
env:
|
|
GIT_SSL_NO_VERIFY: 'true'
|
|
CI_ENVIRONMENT: testing
|
|
database.tests.hostname: 127.0.0.1
|
|
database.tests.database: alrahma_test
|
|
database.tests.username: alrahma
|
|
database.tests.password: alrahma
|
|
database.tests.DBDriver: MySQLi
|
|
database.tests.DBPrefix: ''
|
|
database.tests.port: 3306
|
|
JWT_SECRET: test-secret-for-ci
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.2'
|
|
extensions: dom, gd, intl, mbstring, mysqli, zip
|
|
coverage: xdebug
|
|
|
|
- name: Validate Composer config
|
|
run: composer validate --no-check-publish --strict
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Prepare writable directories
|
|
run: |
|
|
mkdir -p \
|
|
writable/cache/testing \
|
|
writable/logs \
|
|
writable/session \
|
|
writable/uploads \
|
|
writable/debugbar
|
|
chown -R "$(id -u):$(id -g)" writable || true
|
|
chmod -R u+rwX,g+rwX writable
|
|
|
|
- name: Verify writable cache
|
|
run: |
|
|
test -d writable/cache/testing
|
|
test -w writable/cache/testing
|
|
touch writable/cache/testing/.ci-write-test
|
|
rm writable/cache/testing/.ci-write-test
|
|
|
|
- name: Run database migrations
|
|
run: php spark migrate --all --no-interaction
|
|
|
|
- name: Run tests
|
|
run: composer test
|