-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (89 loc) · 2.37 KB
/
ci.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
name: CI Workflow
on:
pull_request:
push:
branches:
- master
jobs:
build:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
php:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
dsn:
- ''
- mysql://lampager_test:lampager_test@127.0.0.1/lampager_test
- postgres://lampager_test:lampager_test@localhost/lampager_test
services:
mysql:
image: mysql:8.0
ports:
- '3306:3306'
env:
MYSQL_DATABASE: lampager_test
MYSQL_USER: lampager_test
MYSQL_PASSWORD: lampager_test
MYSQL_ROOT_PASSWORD: lampager_test
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=30s
--health-retries=5
postgres:
image: postgres:15.2
ports:
- '5432:5432'
env:
POSTGRES_DB: lampager_test
POSTGRES_USER: lampager_test
POSTGRES_PASSWORD: lampager_test
options: >-
--health-cmd=pg_isready
--health-interval=10s
--health-timeout=30s
--health-retries=5
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache composer
uses: actions/cache@v3
with:
path: .composer/cache
key: buildx-${{ github.sha }}
restore-keys: composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Set up MySQL
run: |
mysql \
--host=127.0.0.1 \
--user=root \
--password=lampager_test <<< "
ALTER USER 'lampager_test'@'%' IDENTIFIED WITH mysql_native_password BY 'lampager_test';
"
- name: Install dependencies
run: |
composer install
mkdir -p build/logs
- name: Test
env:
DB_DSN: ${{ matrix.dsn }}
run: |
composer test
- name: Coverage
if: ${{ matrix.php == 8.3 && matrix.dsn == '' }}
env:
COVERALLS_REPO_TOKEN: ${{ github.token }}
run: |
export PATH=$(composer config --global home):$PATH
composer global require 'php-coveralls/php-coveralls:*'
php-coveralls --verbose