-
Notifications
You must be signed in to change notification settings - Fork 53
111 lines (95 loc) · 3.13 KB
/
default.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
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.0", "7.2", "7.3", "7.4"]
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:
# - name: Stop any running MySQL
# run: sudo systemctl stop mysql.service
# - uses: chhsiung/github-actions-mysql@0f348ad54f14038adafed5914b5ce775806768ab
# with:
# rootPassword: 'password'
# sqlMode: 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
- uses: niden/actions-memcached@v7
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: memcached
- uses: actions/checkout@v2
with:
submodules: true
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(php composer.phar config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-composer-
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" --silent; do
sleep 1
done
- name: Set up database and code
run: |
mysql -h 127.0.0.1 -u root -ppassword twfy_test < db/schema.sql
php composer.phar install --no-interaction
- 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
- name: Documentation
if: matrix.php_version == '7.4' && github.ref_name == 'master' && github.event_name == 'push'
run: |
sudo apt-get update && sudo apt-get install -y graphviz
./build-docs.sh