Skip to content

Commit d39a002

Browse files
authored
Merge pull request #38 from nullthoughts/feat/updates-and-upgrades
* Bump php to ^8.0, add tooling, linting, fixes * chore: add pull_request to github workflow * chore: tweak triggers in github workflow
2 parents e12085b + 70ae101 commit d39a002

30 files changed

+4588
-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: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,74 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
13
name: PHPUnit
24

3-
on: [push]
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
410

511
jobs:
612
build-test:
713
runs-on: ubuntu-latest
814

15+
permissions:
16+
contents: write
17+
statuses: write
18+
19+
outputs:
20+
lock: ${{ steps.hash.outputs.lock }}
21+
cache: ${{ steps.composer-cache.outputs.cache }}
22+
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
27+
stability: [ 'stable', 'lowest' ]
28+
929
steps:
1030
- uses: actions/checkout@v2
1131

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

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