forked from PHPExif/php-exif
-
Notifications
You must be signed in to change notification settings - Fork 7
180 lines (150 loc) · 4.95 KB
/
php.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: "Integrate"
# Run this workflow every time a new commit pushed to your repository
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
kill_previous:
name: "0️⃣ Kill previous runs"
runs-on: "ubuntu-latest"
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch.
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
php_syntax_errors:
name: "1️⃣ PHP: Syntax errors"
runs-on: "ubuntu-latest"
needs:
- "kill_previous"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
- name: "Checkout code"
uses: "actions/checkout@v3"
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
- name: Validate files
run: composer validate-files
code_style_errors:
name: "1️⃣ PHP: Code Style errors"
runs-on: "ubuntu-latest"
needs:
- "kill_previous"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
- name: "Checkout code"
uses: "actions/checkout@v3"
- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
- name: Check Style
run: composer check-code-style
phpstan:
name: "2️⃣ PHP: PHPStan"
runs-on: "ubuntu-latest"
needs:
- "php_syntax_errors"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: "latest"
coverage: none
tools: phpstan
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
- name: Run PHPStan
run: vendor/bin/phpstan analyze
tests:
name: "2️⃣ PHP ${{ matrix.php-version }}: Tests"
needs:
- "php_syntax_errors"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
env:
extensions: curl, dom, imagick, json, libxml, mbstring
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set Up Imagick, FFmpeg & Exiftools
run: |
sudo apt-get update
sudo apt-get --fix-broken install
sudo apt-get -y install ffmpeg libimage-exiftool-perl libmagickwand-dev
- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
tools: pecl, composer
# Install dependencies and handle caching in one go.
# Dependencies need to be installed to make sure the PHPUnit classes are recognized.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
# - name: boot test server
# run: vendor/bin/http_test_server > /dev/null 2>&1 &
- name: Prepare log directory
run: mkdir -p build/logs
- name: Validate files
run: composer validate-files
- name: Check Style
run: composer check-code-style
- name: Run tests
run: composer run-tests
- name: Codecov
uses: codecov/codecov-action@v1
# support for mutation testing.
#
# This section is disabled because Mutation testing is a rather slow process
# and furthermore adds lots of noise into the pull request review panel by Github.
# While it is an intersting set of tests to have, this does not constitute major
# improvements to the full code base.
#
# TODO: This section can be uncommented once ALL the code paths are evaluted.
# This unfortunately includes changes such as in_array(...,..., true) into in_array(...,..., false)
# and other behaviours which are very edge cases
#
# infection:
# name: "3️⃣ PHP: Mutation testing"
# runs-on: "ubuntu-latest"
# needs:
# - "tests"
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Set Up Imagick, FFmpeg & Exiftools
# run: |
# sudo apt-get update
# sudo apt-get --fix-broken install
# sudo apt-get -y install ffmpeg libimage-exiftool-perl libmagickwand-dev
# - name: Setup PHP
# uses: shivammathur/[email protected]
# with:
# php-version: "latest"
# coverage: xdebug
# - name: Install Composer dependencies
# uses: "ramsey/composer-install@v2"
# - name: Run Infection
# run: vendor/bin/infection