-
-
Notifications
You must be signed in to change notification settings - Fork 159
49 lines (45 loc) · 1.62 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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.4, 8.3, 8.2 ]
database: [ mysql, sqlite ]
release: [ stable, lowest ]
include:
- php: 8.3
release: stable
coverage: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Start database container
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up --wait ${{ matrix.database }}
if: matrix.database != 'sqlite'
- name: Install dependencies
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \
composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }}
- name: Run tests
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run -e DB_CONNECTION=${{ matrix.database }} \
--rm php${{ matrix.php }}${{ env.XDEBUG }} vendor/bin/phpunit ${{ env.COVERAGE }}
env:
COVERAGE: ${{ matrix.coverage && '--coverage-clover=coverage.xml' || '' }}
XDEBUG: ${{ matrix.coverage && '-xdebug' || '' }}
- name: Upload code coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.coverage && env.CODECOV_TOKEN