Enable Github Actions
This commit is contained in:
parent
5c3d077dfb
commit
0b98d67b80
|
@ -0,0 +1,104 @@
|
||||||
|
name: Testing Friendica
|
||||||
|
on: [push, pull_request, pull_request_review]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
friendica:
|
||||||
|
name: Friendica (PHP ${{ matrix.php-versions }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
MYSQL_HOST: localhost
|
||||||
|
MYSQL_PORT: 3306
|
||||||
|
MYSQL_DATABASE: test
|
||||||
|
MYSQL_PASSWORD: ""
|
||||||
|
MYSQL_USERNAME: travis
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: mariadb:latest
|
||||||
|
env:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
||||||
|
MYSQL_DATABASE: test
|
||||||
|
MYSQL_PASSWORD: ""
|
||||||
|
MYSQL_USERNAME: travis
|
||||||
|
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:
|
||||||
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
|
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 }}
|
||||||
|
tools: pecl
|
||||||
|
extensions: pdo_mysql, gd, zip, opcache, ctype, pcntl, ldap, apcu, memcached, redis, imagick
|
||||||
|
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
|
||||||
|
|
||||||
|
- 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" -uroot -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||||
|
mysql -h"127.0.0.1" -P"$PORT" -uroot test < database.sql
|
||||||
|
|
||||||
|
- name: Test with Parallel-lint
|
||||||
|
run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
|
||||||
|
|
||||||
|
- name: Test with phpunit
|
||||||
|
run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
|
||||||
|
env:
|
||||||
|
MYSQL_HOST: localhost
|
||||||
|
MYSQL_PORT: 3306
|
||||||
|
MYSQL_DATABASE: test
|
||||||
|
MYSQL_PASSWORD: ""
|
||||||
|
MYSQL_USERNAME: root
|
||||||
|
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
file: clover.xml
|
Loading…
Reference in New Issue
Block a user