2020-08-18 18:56:14 +00:00
|
|
|
name: Testing Friendica
|
2020-08-22 18:09:41 +00:00
|
|
|
on: [push, pull_request]
|
2020-08-18 18:56:14 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
friendica:
|
|
|
|
name: Friendica (PHP ${{ matrix.php-versions }})
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
mariadb:
|
|
|
|
image: mariadb:latest
|
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
|
|
|
MYSQL_DATABASE: test
|
2020-08-19 10:28:34 +00:00
|
|
|
MYSQL_PASSWORD: test
|
|
|
|
MYSQL_USER: test
|
2020-08-18 18:56:14 +00:00
|
|
|
ports:
|
|
|
|
- 3306/tcp
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
redis:
|
|
|
|
image: redis
|
|
|
|
ports:
|
|
|
|
- 6379/tcp
|
|
|
|
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
memcached:
|
|
|
|
image: memcached
|
|
|
|
ports:
|
|
|
|
- 11211/tcp
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-04-05 09:38:07 +00:00
|
|
|
php-versions: ['7.3', '7.4', '8.0']
|
2020-08-18 18:56:14 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2020-10-24 13:12:26 +00:00
|
|
|
tools: pecl, composer:v1
|
2020-08-19 12:09:16 +00:00
|
|
|
extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick, memcache
|
2020-08-18 18:56:14 +00:00
|
|
|
coverage: xdebug
|
|
|
|
ini-values: apc.enabled=1, apc.enable_cli=1
|
|
|
|
|
|
|
|
- name: Start mysql service
|
|
|
|
run: sudo /etc/init.d/mysql start
|
|
|
|
|
|
|
|
- name: Validate composer.json and composer.lock
|
|
|
|
run: composer validate
|
|
|
|
|
|
|
|
- name: Get composer cache directory
|
|
|
|
id: composercache
|
|
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composercache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist
|
|
|
|
|
2021-04-05 10:33:56 +00:00
|
|
|
- name: Setup PHPUnit 8
|
|
|
|
run: bin/dev/setup-phpunit.sh
|
2021-04-01 20:16:16 +00:00
|
|
|
|
2020-08-18 18:56:14 +00:00
|
|
|
- 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: |
|
2020-08-19 10:28:34 +00:00
|
|
|
mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql
|
2020-08-18 18:56:14 +00:00
|
|
|
|
|
|
|
- name: Test with phpunit
|
2021-04-05 10:33:56 +00:00
|
|
|
run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
|
2020-08-18 18:56:14 +00:00
|
|
|
env:
|
2020-08-19 10:28:34 +00:00
|
|
|
MYSQL_HOST: 127.0.0.1
|
|
|
|
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
|
2020-08-18 18:56:14 +00:00
|
|
|
MYSQL_DATABASE: test
|
2020-08-19 10:28:34 +00:00
|
|
|
MYSQL_PASSWORD: test
|
|
|
|
MYSQL_USER: test
|
2020-08-19 12:09:16 +00:00
|
|
|
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
|
2020-10-18 18:47:03 +00:00
|
|
|
REDIS_HOST: 127.0.0.1
|
2020-08-19 12:09:16 +00:00
|
|
|
MEMCACHED_PORT: ${{ job.services.memcached.ports[11211] }}
|
|
|
|
MEMCACHE_PORT: ${{ job.services.memcached.ports[11211] }}
|
2020-08-18 18:56:14 +00:00
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
2020-08-22 18:09:41 +00:00
|
|
|
file: clover.xml
|