Seperate action for documentation #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Test on PHP ${{ matrix.php_version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php_version: ["7.3", "7.4", "8.2"] | |
services: | |
mariadb: | |
image: mariadb:10.5 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: twfy_test | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
redis: | |
image: bitnami/redis | |
ports: | |
- 6379:6379 | |
env: | |
REDIS_PASSWORD: password | |
options: >- | |
--health-cmd "redis-cli -a password ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis-sentinel: | |
image: bitnami/redis-sentinel | |
env: | |
REDIS_MASTER_HOST: redis | |
REDIS_MASTER_SET: mymaster | |
REDIS_MASTER_PASSWORD: password | |
REDIS_SENTINEL_QUORUM: 1 | |
ports: | |
- 26379:26379 | |
options: >- | |
--health-cmd "redis-cli -p 26379 ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup TWFY Project | |
uses: ./.github/actions/setup-twfy | |
with: | |
php_version: ${{ matrix.php_version }} | |
- name: Verify MariaDB connection and setup database | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" --silent; do | |
sleep 1 | |
done | |
mysql -h 127.0.0.1 -u root -ppassword twfy_test < db/schema.sql | |
- name: Run tests | |
env: | |
TWFY_TEST_DB_HOST: "127.0.0.1" | |
TWFY_TEST_DB_USER: "root" | |
TWFY_TEST_DB_PASS: "password" | |
TWFY_TEST_DB_NAME: "twfy_test" | |
run: | | |
mkdir -p build/logs | |
vendor/bin/phpunit --exclude-group xapian | |
- name: Afterwards | |
if: matrix.php_version == '7.4' | |
run: | | |
wget https://scrutinizer-ci.com/ocular.phar | |
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml |