Skip to content

Commit aec5ec0

Browse files
committed
Bump php to ^8.0, add tooling, linting, fixes
1 parent e12085b commit aec5ec0

30 files changed

+4584
-2135
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: https://editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml,yaml}]
18+
indent_size = 2

.github/workflows/phpunit.yml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,70 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
13
name: PHPUnit
24

3-
on: [push]
5+
on: [ push ]
46

57
jobs:
68
build-test:
79
runs-on: ubuntu-latest
810

11+
permissions:
12+
contents: write
13+
statuses: write
14+
15+
outputs:
16+
lock: ${{ steps.hash.outputs.lock }}
17+
cache: ${{ steps.composer-cache.outputs.cache }}
18+
19+
strategy:
20+
fail-fast: true
21+
matrix:
22+
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
23+
stability: [ 'stable', 'lowest' ]
24+
925
steps:
1026
- uses: actions/checkout@v2
1127

12-
- uses: php-actions/composer@v5
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
tools: composer
33+
extensions: json, dom, curl, libxml, mbstring
34+
coverage: xdebug
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Get composer cache directory
39+
id: composer-cache
40+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
1341

14-
- name: PHPUnit Tests
15-
uses: php-actions/phpunit@v2
42+
- name: Get composer.lock or composer.json hash for caching
43+
id: hash
44+
shell: bash
45+
run: |
46+
if [ -f composer.lock ]; then
47+
echo "lock=${{ hashFiles('**/composer.lock') }}" >> $GITHUB_OUTPUT
48+
else
49+
echo "lock=${{ hashFiles('**/composer.json') }}" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Cache Composer packages
53+
id: composer-cache
54+
uses: actions/cache@v4
1655
with:
17-
php_extensions: xdebug mbstring
18-
bootstrap: vendor/autoload.php
19-
configuration: phpunit.xml
20-
args: --coverage-text
56+
path: ${{ outputs.cache }}
57+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ outputs.lock }}
58+
restore-keys: |
59+
${{ runner.os }}-php-${{ matrix.php }}-${{ outputs.lock }}
60+
${{ runner.os }}-php-${{ matrix.php }}-
61+
${{ runner.os }}-php-
62+
63+
- name: Install Dependencies (prefer-${{ matrix.stability }})
64+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-${{ matrix.stability }}
65+
66+
- name: Configure matchers
67+
uses: mheap/phpunit-matcher-action@v1
68+
69+
- name: Execute composer test (Unit and Feature tests)
70+
run: composer test:ci

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Homestead.yaml
1212
npm-debug.log
1313
yarn-error.log
1414
.env
15-
.phpunit.result.cache
15+
*.cache

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ env:
77
matrix:
88
fast_finish: true
99
include:
10-
- php: 7.2
11-
- php: 7.2
10+
- php: 8.0
11+
- php: 8.0
1212
env: setup=lowest
13-
- php: 7.3
14-
- php: 7.3
13+
- php: 8.1
14+
- php: 8.1
15+
env: setup=lowest
16+
- php: 8.2
17+
- php: 8.2
1518
env: setup=lowest
1619

1720
sudo: false

composer.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,35 @@
88
"email": "[email protected]"
99
}
1010
],
11+
"scripts": {
12+
"lint": "pint --test",
13+
"lint:fix": "pint --repair",
14+
"psalm": "psalm",
15+
"psalm:fix": "psalm --alter --issues=MissingReturnType,MissingParamType",
16+
"test": "phpunit --coverage-text",
17+
"test:ci": "phpunit --teamcity"
18+
},
1119
"require": {
1220
"ext-json": "*",
1321
"php": "^8.0"
1422
},
1523
"require-dev": {
16-
"orchestra/testbench": "^7.0"
24+
"orchestra/testbench": "^7.0",
25+
"rector/rector": "^1.2",
26+
"ergebnis/composer-normalize": "^2.44",
27+
"vimeo/psalm": "^5.26",
28+
"psalm/plugin-laravel": "^2.9",
29+
"laravel/pint": "^1.18"
1730
},
1831
"autoload": {
19-
"psr-4" : {
32+
"psr-4": {
2033
"nullthoughts\\LaravelDataSync\\": "src/"
2134
}
2235
},
2336
"autoload-dev": {
24-
"psr-4" : {
25-
"nullthoughts\\LaravelDataSync\\Tests\\": "tests/"
37+
"psr-4": {
38+
"nullthoughts\\LaravelDataSync\\Tests\\": "tests/",
39+
"nullthoughts\\LaravelDataSync\\Tests\\Fakes\\": "tests/fakes/"
2640
}
2741
},
2842
"extra": {
@@ -31,5 +45,10 @@
3145
"nullthoughts\\LaravelDataSync\\DataSyncBaseServiceProvider"
3246
]
3347
}
48+
},
49+
"config": {
50+
"allow-plugins": {
51+
"ergebnis/composer-normalize": true
52+
}
3453
}
3554
}

0 commit comments

Comments
 (0)