Skip to content

Commit 0904a3d

Browse files
authored
Modernize tooling & internals (#14)
1 parent 67892a7 commit 0904a3d

32 files changed

+731
-523
lines changed

.gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/tests export-ignore
2+
/.editorconfig export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
6+
*.php diff=php

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "composer"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/lint.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
# Run on all PRs
9+
10+
env:
11+
CI: "true"
12+
13+
jobs:
14+
phpcs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
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.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-
31+
32+
- name: Install dependencies
33+
run: composer update
34+
--no-ansi
35+
--no-interaction
36+
--no-progress
37+
--no-suggest
38+
--prefer-dist
39+
40+
- name: PHPCS
41+
run: composer phpcs

.github/workflows/static-analysis.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Static analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
# Run on all PRs
9+
10+
env:
11+
CI: "true"
12+
13+
jobs:
14+
phpstan:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
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.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-php-
31+
32+
- name: Install dependencies
33+
run: composer update
34+
--no-ansi
35+
--no-interaction
36+
--no-progress
37+
--no-suggest
38+
--prefer-dist
39+
40+
- name: PHPStan
41+
run: composer phpstan

.github/workflows/test.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
# Run on all PRs
9+
10+
env:
11+
CI: "true"
12+
13+
jobs:
14+
phpunit:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
dependencies:
20+
- 'high'
21+
- 'low'
22+
php:
23+
- '7.2'
24+
- '7.3'
25+
- '7.4'
26+
- '8.0'
27+
28+
steps:
29+
- name: Check out code
30+
uses: actions/checkout@v2
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
coverage: pcov
36+
ini-values: zend.assertions=1, assert.exception=1, error_reporting=-1
37+
php-version: ${{ matrix.php }}
38+
39+
- name: Cache Composer packages
40+
id: composer-cache
41+
uses: actions/cache@v2
42+
with:
43+
path: vendor
44+
key: ${{ runner.os }}-php-${{ matrix.dependencies }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
45+
restore-keys: |
46+
${{ runner.os }}-php-${{ matrix.dependencies }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
47+
${{ runner.os }}-php-${{ matrix.dependencies }}-${{ matrix.php }}-
48+
${{ runner.os }}-php-${{ matrix.dependencies }}-
49+
${{ runner.os }}-php-
50+
51+
- name: Install highest dependencies
52+
if: ${{ matrix.dependencies == 'high' }}
53+
run: composer update
54+
--no-ansi
55+
--no-interaction
56+
--no-progress
57+
--no-suggest
58+
--prefer-dist
59+
60+
- name: Install lowest dependencies
61+
if: ${{ matrix.dependencies == 'low' }}
62+
run: composer update
63+
--no-ansi
64+
--no-interaction
65+
--no-progress
66+
--no-suggest
67+
--prefer-dist
68+
--prefer-lowest
69+
70+
- name: PHPUnit
71+
run: vendor/bin/phpunit
72+
--coverage-clover coverage.xml
73+
74+
- name: Submit code coverage
75+
if: ${{ always() }}
76+
uses: codecov/codecov-action@v1

.github/workflows/tests.yml

-112
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/build/
22
/vendor/
33
composer.lock
4+
.phpunit.result.cache

CHANGELOG.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
55

6-
## [Unreleased]
6+
## [2.2.0] - Unreleased
77
### Summary
88
This release focuses on supporting newer versions of PHP and minimizing external dependencies.
99

10+
This will probably be the last version in the 2.x line.
11+
The next major version will only support PHP 8.
12+
1013
### Added
11-
- Test suite: PHP 7.4
14+
- Test suite: PHP 7.4, 8.0
15+
- Type information has been added in numerous places.
1216

1317
### Changed (Internal)
1418
- Migrated from Travis to Github Actions
1519
- Migrated from Coveralls to Codecov
20+
- Tests are no longer exported. Test traits for client code have been moved to `src` so they will still be available in releases.
21+
- Code style updated to PSR-12
1622

1723
### Removed
1824
- Test suite: PHP 7.1

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ Input
22
=====
33
An input validation framework with a boring name
44

5-
[![Build Status](https://github.com/Firehed/input/workflows/tests/badge.svg)](https://github.com/Firehed/input/actions)
6-
[![Coverage Status](https://codecov.io/gh/Firehed/input/branch/master/graph/badge.svg)](https://codecov.io/gh/Firehed/input)
5+
[![Test](https://github.com/Firehed/input/actions/workflows/test.yml/badge.svg)](https://github.com/Firehed/input/actions/workflows/test.yml)
6+
[![Static analysis](https://github.com/Firehed/input/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/Firehed/input/actions/workflows/static-analysis.yml)
7+
[![Lint](https://github.com/Firehed/input/actions/workflows/lint.yml/badge.svg)](https://github.com/Firehed/input/actions/workflows/lint.yml)
8+
[![codecov](https://codecov.io/gh/Firehed/input/branch/master/graph/badge.svg?token=gTzlnli3QV)](https://codecov.io/gh/Firehed/input)
79

810
[Changelog](CHANGELOG.md)
911

composer.json

+18-8
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,36 @@
1010
],
1111
"autoload": {
1212
"psr-4": {
13-
"Firehed\\Input\\": ["src/", "tests/"]
13+
"Firehed\\Input\\": "src"
14+
}
15+
},
16+
"autoload-dev": {
17+
"psr-4": {
18+
"Firehed\\Input\\": "tests"
1419
}
1520
},
1621
"config": {
1722
"sort-packages": true
1823
},
1924
"require": {
20-
"php": ">=7.0"
25+
"php": "^7.2 || ^8.0"
2126
},
2227
"require-dev": {
23-
"phpstan/phpstan": "^0.11",
24-
"phpstan/phpstan-phpunit": "^0.11",
25-
"phpunit/phpunit": "^7"
28+
"phpstan/phpstan": "^0.12.32",
29+
"phpstan/phpstan-phpunit": "^0.12",
30+
"phpunit/phpunit": "^8.3 || ^9",
31+
"squizlabs/php_codesniffer": "^3.6"
2632
},
2733
"scripts": {
2834
"test": [
2935
"@phpunit",
30-
"@phpstan"
36+
"@phpstan",
37+
"@phpcs"
3138
],
32-
"phpstan": "phpstan analyse --no-progress .",
33-
"phpunit": "phpunit --coverage-text"
39+
"autofix": "phpcbf",
40+
"phpunit": "phpunit",
41+
"phpstan": "phpstan analyse",
42+
"phpstan-baseline": "phpstan analyse --generate-baseline",
43+
"phpcs": "phpcs"
3444
}
3545
}

phpcs.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<!-- Default paths to cover -->
4+
<file>src</file>
5+
<file>tests</file>
6+
7+
<rule ref="PSR12"/>
8+
</ruleset>

0 commit comments

Comments
 (0)