Skip to content

Commit

Permalink
Autobots, roll out
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Apr 15, 2020
0 parents commit f8bfd8f
Show file tree
Hide file tree
Showing 18 changed files with 1,024 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
schedule:
# once a month
- cron: '0 0 1 * *'
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
runs-on: ubuntu-latest
name: "Lint"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: pcov

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}-v1

- name: Install dependencies
run: composer install --no-suggest --no-interaction --verbose

- name: Check platform requirements
run: composer check-platform-reqs --verbose

- name: PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --no-interaction --verbose

- name: composer normalize
run: composer normalize --dry-run --no-interaction --verbose

- name: Infection
run: ./vendor/bin/infection --show-mutations --min-msi=100 --no-progress --no-interaction --verbose
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: Psalm
run: ./vendor/bin/psalm --shepherd --no-progress

- name: PHPStan
run: ./vendor/bin/phpstan --no-interaction --verbose

tests:
runs-on: ubuntu-latest
name: "Test suite on PHP: ${{ matrix.php }}; Laravel: ${{ matrix.laravel }}; Dependecies: ${{ matrix.dependency-version }}"
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
laravel: ['5.5.*', '5.6.*', '5.7.*', '5.8.*', '^6.0', '^7.0']
dependency-version: ['prefer-lowest', 'prefer-stable']
include:
- laravel: '5.5.*'
testbench: '3.5.*'
- laravel: '5.6.*'
testbench: '3.6.*'
- laravel: '5.7.*'
testbench: '3.7.*'
- laravel: '5.8.*'
testbench: '3.8.*'
- laravel: '^6.0'
testbench: '^4.0'
- laravel: '^7.0'
testbench: '^5.0'
exclude:
- laravel: '5.3.*'
php: '7.2'
- laravel: '^6.0'
php: '7.1'
- laravel: '^7.0'
php: '7.1'

steps:
- name: checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-${{ matrix.dependency-version }}-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}-v1

- name: Install dependencies
run: |
composer remove infection/infection phpunit/phpunit ergebnis/composer-normalize orchestra/testbench orchestra/testbench phpstan/phpstan phpunit/phpunit timacdonald/php-style vimeo/psalm --dev --no-update --no-interaction --verbose
composer require "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-update --no-interaction --verbose
composer update --${{ matrix.dependency-version }} --no-suggest --no-interaction --verbose
- name: Check platform requirements
run: composer check-platform-reqs --verbose

- name: Run tests
run: ./vendor/bin/phpunit --coverage-text --debug --verbose
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vendor
/composer.lock
/.phpunit.result.cache
/.php_cs.cache
/coverage
/infection.log
8 changes: 8 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->notPath('OptionalRequired.php');

return style_rules($finder);
71 changes: 71 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "timacdonald/has-parameters",
"description": "A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.",
"keywords": [
"laravel",
"middleware",
"parameters",
"arguments"
],
"license": "MIT",
"authors": [
{
"name": "Tim MacDonald",
"email": "hello@timacdonald.me",
"homepage": "https://timacdonald.me"
}
],
"require": {
"php": "^7.1",
"illuminate/support": "5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0 || ^7.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.3",
"infection/infection": "^0.16.1",
"orchestra/testbench": "^5.1",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit": "^9.0",
"timacdonald/php-style": "dev-master",
"vimeo/psalm": "^3.0"
},
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"autoload": {
"psr-4": {
"TiMacDonald\\Middleware\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"fix": [
"clear",
"@composer normalize",
"./vendor/bin/php-cs-fixer fix"
],
"lint": [
"clear",
"@composer normalize --dry-run",
"./vendor/bin/php-cs-fixer fix --dry-run",
"./vendor/bin/psalm --threads=8",
"./vendor/bin/phpstan analyse"
],
"test": [
"clear",
"./vendor/bin/phpunit",
"./vendor/bin/infection --threads=8"
]
},
"support": {
"issues": "https://github.com/timacdonald/with-parameters/issues",
"source": "https://github.com/timacdonald/with-parameters/releases/latest",
"docs": "https://github.com/timacdonald/with-parameters/blob/master/readme.md"
}
}
16 changes: 16 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "infection.log",
"badge": {
"branch": "master"
}
},
"mutators": {
"@default": true
}
}
21 changes: 21 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Tim MacDonald

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
checkMissingIterableValueType: false
level: max
paths:
- src
- tests
ignoreErrors:
19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
34 changes: 34 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
strictBinaryOperands="true"
resolveFromConfigFile="true"
allowStringToStandInForClass="true"
ignoreInternalFunctionNullReturn="false"
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<InternalMethod>
<errorLevel type="suppress">
<file name="tests/HasParametersTest.php" />
</errorLevel>
</InternalMethod>
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<file name="tests/HasParametersTest.php" />
</errorLevel>
</PropertyNotSetInConstructor>
</issueHandlers>
</psalm>

0 comments on commit f8bfd8f

Please sign in to comment.