Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.

Commit 89f8296

Browse files
authored
Updated configurations and implemented mutation testing (#5)
1 parent 56d2b6b commit 89f8296

File tree

16 files changed

+1438
-448
lines changed

16 files changed

+1438
-448
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
shell: bash
15+
1216
steps:
1317
- uses: actions/checkout@v2
1418
with:
@@ -20,15 +24,6 @@ jobs:
2024
- name: Validate composer.json and composer.lock
2125
run: composer validate
2226

23-
- name: Cache Composer packages
24-
id: composer-cache
25-
uses: actions/cache@v2
26-
with:
27-
path: vendor
28-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-php-
31-
3227
- name: Install dependencies
3328
if: steps.composer-cache.outputs.cache-hit != 'true'
3429
run: composer install --prefer-dist --no-progress --optimize-autoloader
@@ -39,14 +34,11 @@ jobs:
3934
commit_message: Apply composer.lock updates
4035
branch: ${{ github.head_ref }}
4136

42-
- name: Lint files
43-
run: composer run-script lint
44-
45-
- name: Run test suite
46-
run: composer run-script test
47-
48-
- name: Format files
49-
run: composer run-script format
37+
- name: Lint, Format and Test Files
38+
run: composer run-script ci
39+
env:
40+
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
41+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
5042

5143
- name: Commit formatting changes
5244
uses: stefanzweifel/git-auto-commit-action@v4.1.2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.idea/
22
vendor/
33
coverage/
4+
var/
45
.env
56
*.cache
67
*.bak

composer.json

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
{
2-
"name": "jamesrweb/codewars-api-client",
2+
"authors": [
3+
{
4+
"email": "james@jamesrobb.co.uk",
5+
"name": "James Robb"
6+
}
7+
],
8+
"autoload": {
9+
"psr-4": {
10+
"CodewarsApiClient\\": "src/"
11+
}
12+
},
13+
"autoload-dev": {
14+
"files": [
15+
"tests/Helpers/Regex.php"
16+
],
17+
"psr-4": {
18+
"Tests\\": "tests/"
19+
}
20+
},
321
"description": "A client for the Codewars API",
4-
"type": "library",
5-
"license": "MIT",
22+
"homepage": "https://jamesrweb.github.io/codewars-api-client",
623
"keywords": [
724
"codewars",
825
"api-client"
926
],
27+
"license": "MIT",
28+
"minimum-stability": "stable",
29+
"name": "jamesrweb/codewars-api-client",
1030
"readme": "README.md",
11-
"homepage": "https://jamesrweb.github.io/codewars-api-client",
1231
"repositories": [
1332
{
1433
"type": "composer",
@@ -19,47 +38,46 @@
1938
"url": "https://github.com/jamesrweb/codewars-api-client"
2039
}
2140
],
22-
"authors": [
23-
{
24-
"name": "James Robb",
25-
"email": "james@jamesrobb.co.uk"
26-
}
27-
],
28-
"scripts": {
29-
"lint": "phpstan analyse -c ./config/phpstan/phpstan.neon",
30-
"format": "php-cs-fixer fix --config ./config/php-cs-fixer/.php_cs --using-cache no",
31-
"start": "php -t public -S localhost:8080",
32-
"test": "phpunit tests --testdox --configuration ./config/phpunit/phpunit.xml",
33-
"test:watch": "phpunit-watcher watch tests --testdox --configuration phpunit.xml"
34-
},
35-
"minimum-stability": "stable",
3641
"require": {
42+
"nyholm/psr7": "^1.4",
3743
"php": ">=8.0",
38-
"symfony/http-client": "^5.2",
3944
"psr/http-client": "^1.0",
4045
"psr/http-message": "^1.0",
41-
"nyholm/psr7": "^1.4",
46+
"symfony/http-client": "^5.2",
4247
"thecodingmachine/safe": "^1.3"
4348
},
4449
"require-dev": {
45-
"phpunit/phpunit": "^9",
46-
"spatie/phpunit-watcher": "^1.23",
4750
"friendsofphp/php-cs-fixer": "^2.18",
51+
"infection/infection": "^0.21.5",
4852
"madewithlove/php-cs-fixer-config": "^2.0",
49-
"phpstan/phpstan": "^0.12.76",
53+
"nette/schema": "^1.2",
5054
"phpstan/extension-installer": "^1.1",
55+
"phpstan/phpstan": "^0.12.76",
5156
"phpstan/phpstan-strict-rules": "^0.12.9",
52-
"nette/schema": "^1.2"
57+
"phpunit/phpunit": "^9",
58+
"spatie/phpunit-watcher": "^1.23",
59+
"thecodingmachine/phpstan-safe-rule": "^1.0"
5360
},
54-
"autoload": {
55-
"psr-4": {
56-
"CodewarsApiClient\\": "src/"
57-
}
61+
"scripts": {
62+
"ci": [
63+
"composer run lint",
64+
"composer run format",
65+
"composer run test"
66+
],
67+
"format": "php-cs-fixer fix --config ./config/php-cs-fixer/config.php",
68+
"lint": "phpstan analyse -c ./config/phpstan/phpstan.neon",
69+
"test": [
70+
"composer run test:unit",
71+
"composer run test:mutation"
72+
],
73+
"test:mutation": [
74+
"@putenv XDEBUG_MODE=coverage",
75+
"infection --no-interaction --threads=4 --coverage=../../var/coverage/xml --configuration=./config/infection/config.json"
76+
],
77+
"test:unit": [
78+
"@putenv XDEBUG_MODE=coverage",
79+
"phpunit tests --configuration ./config/php-unit/phpunit.xml"
80+
]
5881
},
59-
"autoload-dev": {
60-
"files": ["tests/Helpers/Regex.php"],
61-
"psr-4": {
62-
"Tests\\": "tests/"
63-
}
64-
}
65-
}
82+
"type": "library"
83+
}

0 commit comments

Comments
 (0)