forked from friendica/friendica
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (106 loc) · 3.86 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project
#
# SPDX-License-Identifier: CC0-1.0
name: CI tests
on:
push:
pull_request:
workflow_dispatch:
jobs:
unit-tests:
name: Unit-Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup PHP with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php }}
coverage: xdebug
tools: none
- name: Clone addon repository
run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
- name: Run Unit tests
run: composer run test:unit
database-tests:
name: Database-Tests (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: test
MYSQL_PASSWORD: test
MYSQL_USER: test
ports:
- 3306/tcp
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --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.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout
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
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
- name: Clone addon repository
run: git clone -b develop --single-branch https://git.friendi.ca/friendica/friendica-addons.git addon
# 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: vendor/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] }}