Skip to content

Commit f47a218

Browse files
peter279kkpicaza
authored andcommitted
Initial GitHub Workflow and Infection setup
1 parent 2f9c409 commit f47a218

File tree

7 files changed

+270
-18
lines changed

7 files changed

+270
-18
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Check Coding Standards"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "1.x.x"
10+
11+
jobs:
12+
coding-standards:
13+
name: "Check Coding Standards"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "locked"
21+
php-version:
22+
- "7.4"
23+
- "8.0"
24+
operating-system:
25+
- "ubuntu-latest"
26+
27+
steps:
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
30+
31+
- name: "Install PHP"
32+
uses: "shivammathur/setup-php@v2"
33+
with:
34+
coverage: "pcov"
35+
php-version: "${{ matrix.php-version }}"
36+
ini-values: memory_limit=-1
37+
38+
- name: "Cache dependencies"
39+
uses: "actions/cache@v2"
40+
with:
41+
path: |
42+
~/.composer/cache
43+
vendor
44+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
46+
47+
- name: "Install lowest dependencies"
48+
if: ${{ matrix.dependencies == 'lowest' }}
49+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install highest dependencies"
52+
if: ${{ matrix.dependencies == 'highest' }}
53+
run: "composer update --no-interaction --no-progress --no-suggest"
54+
55+
- name: "Install locked dependencies"
56+
if: ${{ matrix.dependencies == 'locked' }}
57+
run: "composer install --no-interaction --no-progress --no-suggest"
58+
59+
- name: "Coding Standard"
60+
run: "vendor/bin/phpcs"

.github/workflows/mutation-tests.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Mutation tests"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "1.x.x"
10+
11+
jobs:
12+
mutation-tests:
13+
name: "Mutation tests"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "locked"
21+
php-version:
22+
- "7.4"
23+
- "8.0"
24+
operating-system:
25+
- "ubuntu-latest"
26+
27+
steps:
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
30+
31+
- name: "Install PHP"
32+
uses: "shivammathur/setup-php@v2"
33+
with:
34+
coverage: "pcov"
35+
php-version: "${{ matrix.php-version }}"
36+
ini-values: memory_limit=-1
37+
38+
- name: "Cache dependencies"
39+
uses: "actions/cache@v2"
40+
with:
41+
path: |
42+
~/.composer/cache
43+
vendor
44+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
46+
47+
- name: "Install lowest dependencies"
48+
if: ${{ matrix.dependencies == 'lowest' }}
49+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install highest dependencies"
52+
if: ${{ matrix.dependencies == 'highest' }}
53+
run: "composer update --no-interaction --no-progress --no-suggest"
54+
55+
- name: "Install locked dependencies"
56+
if: ${{ matrix.dependencies == 'locked' }}
57+
run: "composer install --no-interaction --no-progress --no-suggest"
58+
59+
- name: "Infection"
60+
run: "vendor/bin/infection"
61+
env:
62+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
63+

.github/workflows/phpstan.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Static Analysis by PHPStan"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "1.x.x"
10+
11+
jobs:
12+
static-analysis-phpstan:
13+
name: "Static Analysis by PHPStan"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "locked"
21+
php-version:
22+
- "7.4"
23+
- "8.0"
24+
operating-system:
25+
- "ubuntu-latest"
26+
27+
steps:
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
30+
31+
- name: "Install PHP"
32+
uses: "shivammathur/setup-php@v2"
33+
with:
34+
coverage: "pcov"
35+
php-version: "${{ matrix.php-version }}"
36+
ini-values: memory_limit=-1
37+
38+
- name: "Cache dependencies"
39+
uses: "actions/cache@v2"
40+
with:
41+
path: |
42+
~/.composer/cache
43+
vendor
44+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
46+
47+
- name: "Install lowest dependencies"
48+
if: ${{ matrix.dependencies == 'lowest' }}
49+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install highest dependencies"
52+
if: ${{ matrix.dependencies == 'highest' }}
53+
run: "composer update --no-interaction --no-progress --no-suggest"
54+
55+
- name: "Install locked dependencies"
56+
if: ${{ matrix.dependencies == 'locked' }}
57+
run: "composer install --no-interaction --no-progress --no-suggest"
58+
59+
- name: "phpstan"
60+
run: "composer run inspect"

.github/workflows/phpunit.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "PHPUnit tests"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "1.x.x"
10+
11+
jobs:
12+
phpunit:
13+
name: "PHPUnit tests"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "locked"
21+
php-version:
22+
- "7.4"
23+
- "8.0"
24+
operating-system:
25+
- "ubuntu-latest"
26+
27+
steps:
28+
- name: "Checkout"
29+
uses: "actions/checkout@v2"
30+
31+
- name: "Install PHP"
32+
uses: "shivammathur/setup-php@v2"
33+
with:
34+
coverage: "pcov"
35+
php-version: "${{ matrix.php-version }}"
36+
ini-values: memory_limit=-1
37+
38+
- name: "Cache dependencies"
39+
uses: "actions/cache@v2"
40+
with:
41+
path: |
42+
~/.composer/cache
43+
vendor
44+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
46+
47+
- name: "Install lowest dependencies"
48+
if: ${{ matrix.dependencies == 'lowest' }}
49+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
50+
51+
- name: "Install highest dependencies"
52+
if: ${{ matrix.dependencies == 'highest' }}
53+
run: "composer update --no-interaction --no-progress --no-suggest"
54+
55+
- name: "Install locked dependencies"
56+
if: ${{ matrix.dependencies == 'locked' }}
57+
run: "composer install --no-interaction --no-progress --no-suggest"
58+
59+
- name: "Tests"
60+
run: "vendor/bin/phpunit"

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
},
2626
"require-dev": {
2727
"phpro/grumphp": "~0.17 || ~1.0",
28-
"phpstan/phpstan": "^0.11.5 || ^0.12.0",
28+
"infection/infection": "^0.21.0",
29+
"phpstan/phpstan": "^0.12.0",
2930
"phpunit/phpunit": "^8.0 || ^9.0",
3031
"squizlabs/php_codesniffer": "^3.4",
3132
"wshafer/psr11-monolog": "@dev"
@@ -44,12 +45,14 @@
4445
"check-all": [
4546
"@test",
4647
"@cs-check",
47-
"@inspect"
48+
"@inspect",
49+
"@infection"
4850
],
4951
"cs-check": "phpcs src --colors",
5052
"cs-fix": "phpcbf src --colors",
5153
"inspect": "phpstan analyse src -l7 --ansi",
52-
"test": "phpunit --colors=always"
54+
"test": "phpunit --colors=always",
55+
"infection": "XDEBUG_MODE=coverage infection"
5356
},
5457
"config": {
5558
"sort-packages": true

infection.json.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"source": {
3+
"directories": [
4+
"src"
5+
]
6+
},
7+
"mutators": {
8+
"@default": true
9+
}
10+
}

phpunit.xml.dist

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true">
6-
<testsuites>
7-
<testsuite name="Antidot\\Tests">
8-
<directory>./test</directory>
9-
</testsuite>
10-
</testsuites>
11-
12-
<filter>
13-
<whitelist processUncoveredFilesFromWhitelist="true">
14-
<directory suffix=".php">./src</directory>
15-
</whitelist>
16-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Antidot\\Tests">
10+
<directory>./test</directory>
11+
</testsuite>
12+
</testsuites>
1713
</phpunit>

0 commit comments

Comments
 (0)