Skip to content

Commit

Permalink
- Updates all project CI config from travis to github actions
Browse files Browse the repository at this point in the history
- Updates to CI pipeline to run code analysis and other check
- Updates to code to confirm with php stan results
- Add MIT license
  • Loading branch information
alex-patterson-webdev committed Mar 29, 2021
1 parent e76b17c commit c7b9952
Show file tree
Hide file tree
Showing 10 changed files with 2,244 additions and 111 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI Pipeline

on:
push:
branches:
- master
- feature/*
pull_request:
branches:
- master
- feature/*

jobs:
test:
name: "Integration Test Suite"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: "Validate composer.json and composer.lock"
run: composer validate --strict

- name: "Cache Composer packages"
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: "Install dependencies"
run: composer install --prefer-dist --no-progress --no-suggest

- name: "Check coding standards"
run: composer arp:check

- name: "Checking for solutions to code formatting"
run: composer arp:lint

- name: "Running static analysis checks"
run: composer arp:analyse

- name: "Running unit tests with code coverage"
run: composer arp:unit-test-with-coverage

- name: "Uploading code coverage report to Codecov"
uses: codecov/[email protected]
with:
files: ./test/coverage/clover.xml
fail_ci_if_error: true
verbose: true
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ vendor/
composer.phar
.phpunit.result.cache
.php_cs.cache
coverage.xml
clover.xml
test/coverage/clover.xml
24 changes: 24 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Finder;

$rules = [
'@PSR12' => true,
];

/** @var iterable<string> $finder */
$finder = Finder::create()
->exclude('node_modules')
->exclude('vendor')
->in([
__DIR__ . '/src/',
__DIR__ . '/test/unit/',
]);

return (new PhpCsFixer\Config())
->setRules($rules)
->setFinder($finder)
->setUsingCache(false);

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2020 Alex Patterson

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.
33 changes: 30 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name" : "alex-patterson-webdev/laminas-factory",
"description": "Factory components used to create services in Laminas Framework applications",
"minimum-stability": "dev",
"prefer-stable": true,
"license": "MIT",
"authors": [
{
"name": "Alex Patterson",
Expand All @@ -13,7 +15,10 @@
"laminas/laminas-servicemanager": "^3.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"phpstan/phpstan": ">=0.12",
"friendsofphp/php-cs-fixer": "^2.18"
},
"autoload": {
"psr-4": {
Expand All @@ -22,11 +27,33 @@
},
"autoload-dev": {
"psr-4": {
"ArpTest\\LaminasFactory\\" : "test/phpunit/"
"ArpTest\\LaminasFactory\\" : "test/unit/"
}
},
"scripts": {
"unit-test": "php vendor/bin/phpunit"
"arp:test": [
"@arp:check",
"@arp:lint",
"@arp:analyse",
"@arp:unit-test-with-coverage"
],
"arp:test-dev": [
"@arp:check",
"@arp:lint",
"@arp:fix",
"@arp:analyse-max",
"@arp:unit-test"
],
"arp:check": "php vendor/bin/phpcs -s --standard=phpcs.xml --colors src/ test/",
"arp:lint": "php vendor/bin/php-cs-fixer fix --dry-run --verbose --config=.php_cs.dist",
"arp:fix": "php vendor/bin/php-cs-fixer fix --config=.php_cs.dist",
"arp:analyse": "php vendor/bin/phpstan analyse src/ test/ --level=8",
"arp:analyse-max": "php vendor/bin/phpstan analyse src/ test/ --level=8",
"arp:unit-test": "php vendor/bin/phpunit",
"arp:unit-test-with-coverage": [
"@putenv XDEBUG_MODE=coverage",
"php vendor/bin/phpunit --coverage-clover=test/coverage/clover.xml"
]
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading

0 comments on commit c7b9952

Please sign in to comment.