friendica-github/.github/workflows/php.yml

88 lines
2.7 KiB
YAML
Raw Normal View History

name: Testing Friendica
on: [workflow_dispatch]
jobs:
friendica:
name: Friendica (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
2024-11-07 13:34:50 +00:00
services:
mariadb:
2024-11-07 13:38:43 +00:00
image: mariadb:11.1
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: test
MYSQL_PASSWORD: test
MYSQL_USER: test
ports:
2024-11-07 13:38:43 +00:00
- 3306/tcp
2024-11-06 23:02:24 +00:00
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2024-11-07 13:34:50 +00:00
redis:
image: redis
ports:
2024-11-07 13:38:43 +00:00
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
2024-11-07 13:34:50 +00:00
memcached:
image: memcached
ports:
2024-11-07 13:38:43 +00:00
- 11211/tcp
2024-11-07 13:34:50 +00:00
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
2024-11-07 13:34:50 +00:00
steps:
- name: Checkout
2024-11-06 22:41:56 +00:00
uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: pecl, composer:v1
extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick, memcache
coverage: xdebug
ini-values: apc.enabled=1, apc.enable_cli=1
2024-11-06 22:41:56 +00:00
# Install composer dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Copy default Friendica config
run: cp config/local-sample.config.php config/local.config.php
- name: Verify MariaDB connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Setup MYSQL database
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql
- name: Test with phpunit
run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
MYSQL_DATABASE: test
MYSQL_PASSWORD: test
MYSQL_USER: test
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
REDIS_HOST: 127.0.0.1
MEMCACHED_PORT: ${{ job.services.memcached.ports[11211] }}
MEMCACHE_PORT: ${{ job.services.memcached.ports[11211] }}