Skip to content

Commit ca08783

Browse files
committed
Require PHP 7.4 min
- upgrade deps - tweak CI - update CS - use codecov - use roave/infection-static-analysis-plugin
1 parent 165be4f commit ca08783

28 files changed

+279
-277
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
/.gitignore export-ignore
55
/.github export-ignore
66
/infection.json.dist export-ignore
7+
/Makefile export-ignore
78
/phpcs.xml.dist export-ignore
89
/phpstan.neon.dist export-ignore
910
/phpunit.xml.dist export-ignore
11+
/psalm.xml.dist export-ignore
1012
/tests export-ignore

.github/workflows/ci.yml

+47-125
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,74 @@
1-
name: CI
1+
name: "CI"
22

33
on:
44
pull_request:
55
push:
66
branches:
77
- "master"
88
schedule:
9-
- cron: "0 17 * * *"
9+
- cron: "42 3 * * *"
1010

1111
jobs:
12-
coding-standard:
13-
runs-on: ubuntu-18.04
14-
name: Coding Standard
12+
phpunit:
13+
name: "PHPUnit"
14+
runs-on: "ubuntu-20.04"
1515

16-
steps:
17-
- uses: actions/checkout@v2
18-
19-
- name: Install PHP
20-
uses: shivammathur/[email protected]
21-
with:
22-
php-version: 7.4
23-
coverage: none
24-
extensions: json
25-
tools: cs2pr
26-
27-
- name: Get Composer Cache Directory
28-
id: composer-cache
29-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
30-
31-
- name: Cache dependencies
32-
uses: actions/cache@v1
33-
with:
34-
path: ${{ steps.composer-cache.outputs.dir }}
35-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
36-
restore-keys: ${{ runner.os }}-composer-
37-
38-
- name: Install Dependencies
39-
run: composer install ${DEPENDENCIES}
40-
41-
- name: Coding Standard
42-
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
43-
44-
phpstan:
45-
runs-on: ubuntu-18.04
46-
name: PHPStan
16+
strategy:
17+
matrix:
18+
php-version:
19+
- "7.4"
20+
- "8.0"
21+
dependencies:
22+
- "highest"
23+
include:
24+
- dependencies: "lowest"
25+
php-version: "7.4"
4726

4827
steps:
49-
- uses: actions/checkout@v2
50-
51-
- name: Install PHP
52-
uses: shivammathur/[email protected]
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
5330
with:
54-
php-version: 7.4
55-
coverage: none
56-
extensions: json
57-
tools: cs2pr
58-
59-
- name: Get Composer Cache Directory
60-
id: composer-cache
61-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
31+
fetch-depth: 2
6232

63-
- name: Cache dependencies
64-
uses: actions/cache@v1
33+
- name: "Install PHP"
34+
uses: "shivammathur/setup-php@v2"
6535
with:
66-
path: ${{ steps.composer-cache.outputs.dir }}
67-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
68-
restore-keys: ${{ runner.os }}-composer-
69-
70-
- name: Install Dependencies
71-
run: composer install ${DEPENDENCIES}
36+
php-version: "${{ matrix.php-version }}"
37+
coverage: "pcov"
38+
ini-values: "zend.assertions=1"
7239

73-
- name: PHPStan
74-
run: vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr
75-
76-
coverage:
77-
runs-on: ubuntu-18.04
78-
name: Code Coverage
79-
80-
steps:
81-
- uses: actions/checkout@v2
40+
- name: "Install dependencies with Composer"
41+
uses: "ramsey/composer-install@v1"
8242
with:
83-
ref: ${{ github.ref }}
43+
dependency-versions: "${{ matrix.dependencies }}"
8444

85-
- name: Install PHP
86-
uses: shivammathur/[email protected]
87-
with:
88-
php-version: 7.4
89-
coverage: pcov
90-
extensions: json
45+
- name: "Run PHPUnit"
46+
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
9147

92-
- name: Get Composer Cache Directory
93-
id: composer-cache
94-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
95-
96-
- name: Cache dependencies
97-
uses: actions/cache@v1
48+
- name: "Upload coverage file"
49+
uses: "actions/upload-artifact@v2"
9850
with:
99-
path: ${{ steps.composer-cache.outputs.dir }}
100-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
101-
restore-keys: ${{ runner.os }}-composer-
102-
103-
- name: Install Dependencies
104-
run: composer install ${DEPENDENCIES}
105-
106-
- name: Code coverage
107-
run: |
108-
./vendor/bin/phpunit --coverage-clover /tmp/coverage/clover.xml
51+
name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage"
52+
path: "coverage.xml"
10953

110-
- name: Report to Coveralls
111-
env:
112-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113-
COVERALLS_RUN_LOCALLY: 1
114-
run: vendor/bin/php-coveralls --coverage_clover /tmp/coverage/clover.xml --json_path /tmp/coverage/coveralls.json
115-
116-
tests:
117-
name: Tests
118-
runs-on: ubuntu-18.04
119-
strategy:
120-
matrix:
121-
php: [ 7.3, 7.4 ]
122-
dependencies: [ "", --prefer-lowest ]
54+
upload_coverage:
55+
name: "Upload coverage to Codecov"
56+
runs-on: "ubuntu-20.04"
57+
needs:
58+
- "phpunit"
12359

12460
steps:
125-
- uses: actions/checkout@v2
126-
127-
- name: Install PHP
128-
uses: shivammathur/[email protected]
61+
- name: "Checkout"
62+
uses: "actions/checkout@v2"
12963
with:
130-
php-version: ${{ matrix.php }}
131-
coverage: none
132-
extensions: json, mbstring
133-
- name: Get Composer Cache Directory
134-
id: composer-cache
135-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
64+
fetch-depth: 2
13665

137-
- name: Cache dependencies
138-
uses: actions/cache@v1
66+
- name: "Download coverage files"
67+
uses: "actions/download-artifact@v2"
13968
with:
140-
path: ${{ steps.composer-cache.outputs.dir }}
141-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
142-
restore-keys: ${{ runner.os }}-composer-
143-
144-
- name: Install Dependencies
145-
run: composer install ${DEPENDENCIES}
69+
path: "reports"
14670

147-
- name: Run tests
148-
run: |
149-
export $ENV
150-
./vendor/bin/phpunit
151-
env:
152-
ENV: ${{ matrix.env}}
71+
- name: "Upload to Codecov"
72+
uses: "codecov/codecov-action@v1"
73+
with:
74+
directory: reports
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Coding Standards"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
coding-standards:
11+
name: "Coding Standards"
12+
runs-on: "ubuntu-20.04"
13+
14+
strategy:
15+
matrix:
16+
php-version:
17+
- "7.4"
18+
19+
steps:
20+
- name: "Checkout"
21+
uses: "actions/checkout@v2"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
tools: "cs2pr"
29+
30+
- name: "Install dependencies with Composer"
31+
uses: "ramsey/composer-install@v1"
32+
33+
- name: "Run PHP_CodeSniffer"
34+
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"

.github/workflows/infection.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Infection
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
Infection:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- name: "Checkout"
15+
uses: "actions/checkout@v2"
16+
with:
17+
fetch-depth: 2
18+
19+
- name: "Install PHP"
20+
uses: "shivammathur/setup-php@v2"
21+
with:
22+
php-version: 7.4
23+
coverage: "pcov"
24+
25+
- name: "Install dependencies with Composer"
26+
uses: "ramsey/composer-install@v1"
27+
28+
- name: Run Infection
29+
run: vendor/bin/roave-infection-static-analysis-plugin --min-msi=64 --min-covered-msi=66 --log-verbosity=none -s
30+
env:
31+
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

.github/workflows/infection.yml

-31
This file was deleted.

.github/workflows/shepherd.yml

-22
This file was deleted.

.github/workflows/static-analysis.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Static Analysis"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
static-analysis-phpstan:
11+
name: "Static Analysis with PHPStan"
12+
runs-on: "ubuntu-20.04"
13+
14+
strategy:
15+
matrix:
16+
php-version:
17+
- "7.4"
18+
19+
steps:
20+
- name: "Checkout code"
21+
uses: "actions/checkout@v2"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
tools: "cs2pr"
29+
30+
- name: "Install dependencies with Composer"
31+
uses: "ramsey/composer-install@v1"
32+
33+
- name: "Run a static analysis with phpstan/phpstan"
34+
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
35+
36+
static-analysis-psalm:
37+
name: "Static Analysis with Psalm"
38+
runs-on: "ubuntu-20.04"
39+
40+
strategy:
41+
matrix:
42+
php-version:
43+
- "7.4"
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v2
48+
49+
- name: Psalm
50+
uses: docker://vimeo/psalm-github-actions:4.4.1
51+
with:
52+
args: --shepherd
53+
composer_require_dev: true
54+
security_analysis: true
55+
report_file: results.sarif
56+
- name: Upload Security Analysis results to GitHub
57+
uses: github/codeql-action/upload-sarif@v1
58+
with:
59+
sarif_file: results.sarif

0 commit comments

Comments
 (0)