Skip to content

Commit 3b77e94

Browse files
authored
Update support (#24)
- Updates CI - Ensures 8.1 support - Drops PHP 7 support - Drops Laravel 7 support - Updates minimum version of sixlive/json-schema-assertions
1 parent af09fd0 commit 3b77e94

File tree

7 files changed

+118
-71
lines changed

7 files changed

+118
-71
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,43 @@
1-
name: Run Tests
1+
name: run-tests
2+
23
on:
34
push:
5+
branches: [main]
46
pull_request:
5-
schedule:
6-
- cron: 0 0 * * *
7+
branches: [main]
8+
79
jobs:
8-
run-tests:
10+
test:
911
runs-on: ubuntu-latest
1012
strategy:
1113
fail-fast: false
1214
matrix:
13-
php:
14-
- 7.4
15-
- 7.3
16-
- 8.0
17-
laravel:
18-
- 8.*
19-
- 7.*
20-
dependency-version:
21-
- prefer-lowest
22-
- prefer-stable
15+
php: [8.0, 8.1]
16+
laravel: [8.*]
17+
stability: [prefer-lowest, prefer-stable]
2318
include:
2419
- laravel: 8.*
25-
testbench: 6.*
26-
- laravel: 7.*
27-
testbench: 5.*
28-
name: >-
29-
P${{ matrix.php }} - L${{ matrix.laravel }} - ${{
30-
matrix.dependency-version }}
20+
21+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
22+
3123
steps:
3224
- name: Checkout code
33-
uses: actions/checkout@v1
34-
- name: Cache dependencies
35-
uses: actions/cache@v1
36-
with:
37-
path: ~/.composer/cache/files
38-
key: >-
39-
dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php
40-
}}-composer-${{ hashFiles('composer.json') }}
25+
uses: actions/checkout@v2
26+
4127
- name: Setup PHP
4228
uses: shivammathur/setup-php@v2
4329
with:
44-
php-version: '${{ matrix.php }}'
30+
php-version: ${{ matrix.php }}
31+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
4532
coverage: none
33+
34+
- name: Setup problem matchers
35+
run: |
36+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
37+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
38+
4639
- name: Install dependencies
47-
run: >
48-
composer require "laravel/framework:${{ matrix.laravel }}"
49-
"orchestra/testbench:${{ matrix.testbench }}" --no-interaction
50-
--no-update
40+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
5141

52-
composer update --${{ matrix.dependency-version }} --prefer-dist
53-
--no-interaction --no-suggest
5442
- name: Execute tests
5543
run: vendor/bin/phpunit
56-

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ build/
22
composer.lock
33
vendor/
44
coverage/
5+
.php-cs-fixer.cache
6+
.phpunit.result.cache

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.php-cs-fixer.dist.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR12' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
])
40+
->setFinder($finder);

composer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
}
2020
],
2121
"require": {
22-
"php": ">=7.2|^8.0",
23-
"phpunit/phpunit": "^8.0",
24-
"illuminate/support": "^7.0|^8.0",
25-
"sixlive/json-schema-assertions": "^1.2"
22+
"php": "^8.0",
23+
"laravel/framework": "^8.70",
24+
"phpunit/phpunit": "^9.5",
25+
"sixlive/json-schema-assertions": "^2.0"
2626
},
2727
"require-dev": {
28-
"friendsofphp/php-cs-fixer": "^2.12",
29-
"orchestra/testbench": "^5.0|^6.0"
28+
"friendsofphp/php-cs-fixer": "^3.2",
29+
"orchestra/testbench": "^6.20"
3030
},
3131
"autoload": {
3232
"psr-4": {
@@ -41,8 +41,7 @@
4141
"scripts": {
4242
"test": "vendor/bin/phpunit",
4343
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
44-
"styles:lint": "vendor/bin/php-cs-fixer fix --dry-run --diff",
45-
"styles:fix": "vendor/bin/php-cs-fixer fix"
44+
"cs": "vendor/bin/php-cs-fixer fix --config=./.php-cs-fixer.dist.php"
4645
},
4746
"config": {
4847
"sort-packages": true

phpunit.xml.dist

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="Laravel JSON Assertions Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
22-
<logging>
23-
<log type="tap" target="build/report.tap"/>
24-
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-html" target="build/coverage"/>
26-
<log type="coverage-text" target="build/coverage.txt"/>
27-
<log type="coverage-clover" target="build/logs/clover.xml"/>
28-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
<report>
8+
<clover outputFile="build/logs/clover.xml"/>
9+
<html outputDirectory="build/coverage"/>
10+
<text outputFile="build/coverage.txt"/>
11+
</report>
12+
</coverage>
13+
<testsuites>
14+
<testsuite name="Laravel JSON Assertions Test Suite">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<logging>
19+
<junit outputFile="build/report.junit.xml"/>
20+
</logging>
2921
</phpunit>

0 commit comments

Comments
 (0)