Skip to content

Commit ada5def

Browse files
authored
upgrade to code-safe-2.2 (LycheeOrg#48)
* add comment of why mutation testing is disabled * update composer
1 parent 7b1eb6c commit ada5def

14 files changed

+986
-152
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ trim_trailing_whitespace = false
2020
[*.js]
2121
indent_style = tab
2222
indent_size = 4
23+
24+
[*.yml]
25+
indent_style = space
26+
indent_size = 2
27+
trim_trailing_whitespace = true

.github/workflows/php.yml

+138-16
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,122 @@
1-
name: Tests
1+
name: "Integrate"
22

33
# Run this workflow every time a new commit pushed to your repository
44
on:
55
push:
66
paths-ignore:
77
- '**/*.md'
8+
- 'public/dist/*.js'
9+
- 'public/dist/**/*.js'
810
pull_request:
911
paths-ignore:
1012
- '**/*.md'
13+
- 'public/dist/*.js'
14+
- 'public/dist/**/*.js'
15+
# Allow manually triggering the workflow.
16+
workflow_dispatch:
1117

1218
jobs:
13-
tests:
14-
runs-on: ${{ matrix.operating-system }}
19+
kill_previous:
20+
name: "0️⃣ Kill previous runs"
21+
runs-on: "ubuntu-latest"
1522
# 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.
1623
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
24+
steps:
25+
- name: Cancel Previous Runs
26+
uses: styfle/cancel-workflow-action@0.7.0
27+
with:
28+
access_token: ${{ github.token }}
29+
30+
php_syntax_errors:
31+
name: "1️⃣ PHP: Syntax errors"
32+
runs-on: "ubuntu-latest"
33+
needs:
34+
- "kill_previous"
35+
steps:
36+
- name: "Set up PHP"
37+
uses: "shivammathur/setup-php@v2"
38+
with:
39+
php-version: "latest"
40+
41+
- name: "Checkout code"
42+
uses: "actions/checkout@v3"
43+
44+
- name: "Install dependencies"
45+
uses: "ramsey/composer-install@v2"
46+
47+
- name: Validate files
48+
run: composer validate-files
49+
50+
code_style_errors:
51+
name: "1️⃣ PHP: Code Style errors"
52+
runs-on: "ubuntu-latest"
53+
needs:
54+
- "kill_previous"
55+
steps:
56+
- name: "Set up PHP"
57+
uses: "shivammathur/setup-php@v2"
58+
with:
59+
php-version: "latest"
60+
61+
- name: "Checkout code"
62+
uses: "actions/checkout@v3"
63+
64+
- name: "Install dependencies"
65+
uses: "ramsey/composer-install@v2"
66+
67+
- name: Check Style
68+
run: composer check-code-style
69+
70+
phpstan:
71+
name: "2️⃣ PHP: PHPStan"
72+
runs-on: "ubuntu-latest"
73+
needs:
74+
- "php_syntax_errors"
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v3
78+
79+
- name: Setup PHP
80+
uses: shivammathur/setup-php@2.15.0
81+
with:
82+
php-version: "latest"
83+
coverage: none
84+
tools: phpstan
85+
86+
- name: Install Composer dependencies
87+
uses: "ramsey/composer-install@v2"
88+
89+
- name: Run PHPStan
90+
run: vendor/bin/phpstan analyze
1791

92+
tests:
93+
name: "2️⃣ PHP ${{ matrix.php-version }}: ${{ matrix.beta }} ${{ matrix.dependencies }}"
94+
needs:
95+
- "php_syntax_errors"
96+
runs-on: "ubuntu-latest"
1897
strategy:
1998
fail-fast: false
2099
matrix:
21-
operating-system: [ubuntu-20.04]
22-
php-versions: ['8.0', '8.1']
23-
beta: ['beta', '']
24-
dependencies: ['locked', 'lowest', 'highest']
100+
php-version:
101+
- "8.0"
102+
- "8.1"
103+
dependencies:
104+
- "locked"
105+
- "lowest"
106+
- "highest"
107+
beta:
108+
- "beta"
109+
- ""
25110
exclude:
26-
- beta: 'beta'
27-
dependencies: 'locked'
28-
- beta: 'beta'
29-
dependencies: 'lowest'
30-
31-
name: PHP ${{ matrix.php-versions }} -- ${{ matrix.beta }} ${{ matrix.dependencies }}
111+
- beta: "beta"
112+
dependencies: "locked"
113+
- beta: "beta"
114+
dependencies: "lowest"
32115

33116
env:
34117
extensions: curl, dom, imagick, json, libxml, mbstring
35-
key: cache-v1 # can be any string, change to clear the extension cache.
36118

37119
steps:
38-
# Checks out a copy of your repository on the ubuntu machine
39120
- name: Checkout code
40121
uses: actions/checkout@v3
41122

@@ -48,7 +129,7 @@ jobs:
48129
- name: Setup PHP Action
49130
uses: shivammathur/setup-php@2.15.0
50131
with:
51-
php-version: ${{ matrix.php-versions }}
132+
php-version: ${{ matrix.php-version }}
52133
extensions: ${{ env.extensions }}
53134
coverage: xdebug
54135
tools: pecl, composer
@@ -79,3 +160,44 @@ jobs:
79160

80161
- name: Run tests
81162
run: composer run-tests
163+
164+
- name: Codecov
165+
uses: codecov/codecov-action@v1
166+
167+
# support for mutation testing.
168+
#
169+
# This section is disabled because Mutation testing is a rather slow process
170+
# and furthermore adds lots of noise into the pull request review panel by Github.
171+
# While it is an intersting set of tests to have, this does not constitute major
172+
# improvements to the full code base.
173+
#
174+
# TODO: This section can be uncommented once ALL the code paths are evaluted.
175+
# This unfortunately includes changes such as in_array(...,..., true) into in_array(...,..., false)
176+
# and other behaviours which are very edge cases
177+
#
178+
# infection:
179+
# name: "3️⃣ PHP: Mutation testing"
180+
# runs-on: "ubuntu-latest"
181+
# needs:
182+
# - "tests"
183+
# steps:
184+
# - name: Checkout code
185+
# uses: actions/checkout@v3
186+
187+
# - name: Set Up Imagick, FFmpeg & Exiftools
188+
# run: |
189+
# sudo apt-get update
190+
# sudo apt-get --fix-broken install
191+
# sudo apt-get -y install ffmpeg libimage-exiftool-perl libmagickwand-dev
192+
193+
# - name: Setup PHP
194+
# uses: shivammathur/setup-php@2.15.0
195+
# with:
196+
# php-version: "latest"
197+
# coverage: xdebug
198+
199+
# - name: Install Composer dependencies
200+
# uses: "ramsey/composer-install@v2"
201+
202+
# - name: Run Infection
203+
# run: vendor/bin/infection

.github/workflows/phpstan.yaml

-41
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ composer.phar
55
.DS_Store
66
.idea
77
.phpunit.result.cache
8+
infection.html

composer.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232
"ext-fileinfo": "*",
3333
"neitanod/forceutf8": "^2.0.4",
3434
"php-ffmpeg/php-ffmpeg": "^1.0",
35-
"thecodingmachine/safe": "^1.3"
35+
"thecodingmachine/safe": "^2.2"
3636
},
3737
"require-dev": {
38-
"lychee-org/phpstan-lychee": "dev-master",
3938
"friendsofphp/php-cs-fixer": "^3.3",
39+
"infection/infection": "^0.26.13",
40+
"lychee-org/phpstan-lychee": "dev-master",
4041
"php-parallel-lint/php-parallel-lint": "^1.2",
4142
"phpmd/phpmd": "^2.9",
4243
"phpunit/phpunit": "^9.5.10",
@@ -76,7 +77,10 @@
7677
},
7778
"preferred-install": "dist",
7879
"sort-packages": true,
79-
"optimize-autoloader": true
80+
"optimize-autoloader": true,
81+
"allow-plugins": {
82+
"infection/extension-installer": true
83+
}
8084
},
8185
"prefer-stable": true
8286
}

0 commit comments

Comments
 (0)