-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 3.32 KB
/
phpunit.yml
File metadata and controls
113 lines (98 loc) · 3.32 KB
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
name: PHP Tests
on:
schedule:
- cron: "0 12 * * *"
push:
branches:
- development
- master
paths:
- 'src/**.php'
- 'tests/**.php'
- composer.json
- phpunit.xml.dist
- .github/workflows/phpunit.yml
pull_request:
branches:
- development
- master
paths:
- 'src/**.php'
- 'tests/**.php'
- composer.json
- phpunit.xml.dist
- .github/workflows/phpunit.yml
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests:
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.mysql-versions }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
db-platforms: ['MySQLi']
mysql-versions: ['5.7', '8.0']
services:
mysql:
image: mysql:${{ matrix.mysql-versions }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: web_service_tests
MYSQL_USER: tests_user
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer
coverage: xdebug
env:
update: true
- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --ansi --no-interaction
- name: Compute coverage option
uses: actions/github-script@v6
id: phpunit-coverage-option
with:
script: 'return "${{ matrix.php-versions }}" == "8.0" ? "" : "--no-coverage"'
result-encoding: string
- name: Test with PHPUnit
run: script -e -c "vendor/bin/phpunit --color=always --exclude-group=auto-review ${{ steps.phpunit-coverage-option.outputs.result }}"
env:
DB: ${{ matrix.db-platforms }}
TERM: xterm-256color
- name: Run Coveralls
if: github.repository_owner == 'daycry' && matrix.php-versions == '8.0'
run: |
composer global require --ansi php-coveralls/php-coveralls:^2.4
php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
coveralls-finish:
if: github.repository_owner == 'daycry'
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true