-
Notifications
You must be signed in to change notification settings - Fork 25
126 lines (114 loc) · 4.52 KB
/
php-checks.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
name: PHP checks
on:
pull_request:
release:
types: [ published ]
workflow_dispatch:
env:
php: "
{php: '8.1', experimental: false},
{php: '8.2', experimental: false},
{php: '8.3', experimental: false},
{php: '8.4', experimental: false},
"
php-ext: curl, dom, fileinfo, iconv, intl, mbstring, mysql, pdo, zip
jobs:
set-environment:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.out }}
php-ext: ${{ steps.set-php-ext.outputs.out }}
steps:
- id: set-matrix
run: echo "out={\"include\":[${{ env.php }}]}" >> $GITHUB_OUTPUT
- id: set-php-ext
run: echo "out=${{ env.php-ext }}" >> $GITHUB_OUTPUT
check-composer:
needs: [ set-environment ]
name: Check Composer - PHP(${{ matrix.php }}) Experimental(${{ matrix.experimental }})
strategy:
matrix: ${{fromJson(needs.set-environment.outputs.matrix)}}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ needs.set-environment.outputs.php-ext }}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
- name: Validate composer.json and composer.lock
run: composer validate --no-cache --no-interaction
- name: Check required php extensions
if: "${{ matrix.experimental == false }}"
run: composer check --no-cache
- name: Install dependencies
if: "${{ matrix.experimental == false }}"
run: composer install --prefer-dist --no-progress --no-suggest
- name: Install experimental dependencies, ignore php requirements
if: "${{ matrix.experimental == true }}"
run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-reqs
unittest-codecept:
needs: [ set-environment, check-composer ]
name: Unittest by Codecept - PHP(${{ matrix.php }}) Experimental(${{ matrix.experimental }})
strategy:
matrix: ${{fromJson(needs.set-environment.outputs.matrix)}}
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
# Docs: https://docs.github.com/en/actions/using-containerized-services
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: yii
MYSQL_PASSWORD: yii
MYSQL_USER: yii
MYSQL_DATABASE: yii
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ needs.set-environment.outputs.php-ext }}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
- name: Install dependencies
if: "${{ matrix.experimental == false }}"
run: composer install --prefer-dist --no-progress --no-suggest
- name: Install experimental dependencies, ignore php requirements
if: "${{ matrix.experimental == true }}"
run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-reqs
- name: Copy test config.
run: cp config/config_tests.template.json config/config_tests.json
- name: Validate config of codecept.
run: |
vendor/bin/codecept --version
vendor/bin/codecept config:validate
- name: Run unittest.
run: |
vendor/bin/codecept clean
vendor/bin/codecept build
vendor/bin/codecept run Unit