Skip to content

Commit

Permalink
Merge pull request #1 from abyssphp/master
Browse files Browse the repository at this point in the history
unification of organization repositories
  • Loading branch information
nulxrd committed Dec 30, 2023
2 parents 19fdcd2 + bf1b0c8 commit 141ff2e
Show file tree
Hide file tree
Showing 20 changed files with 306 additions and 111 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/ci.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "*.*"
paths:
- composer.*
- phpcs.xml.dist
- src/**
- tests/**
push:
branches:
- "*.x"
paths:
- composer.*
- phpcs.xml.dist
- src/**
- tests/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coding-standards:
name: Coding Standards
runs-on: "ubuntu-latest"

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: "Check coding standards"
run: "composer run lint:style -- -q --no-colors --report=checkstyle"
62 changes: 62 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "*.*"
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- lib/**
- phpunit.xml.dist
- tests/**
push:
branches:
- "*.x"
paths:
- .github/workflows/continuous-integration.yml
- composer.*
- lib/**
- phpunit.xml.dist
- tests/**

env:
fail-fast: true

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-versions: [ '8.2', '8.3' ]
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']

steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}
- name: Install dependencies
run: composer install --prefer-source --no-interaction --dev
- name: Coding Standard
run: composer run lint:style
- name: Static Code Analysis (PHPStan)
run: composer run analyze:phpstan
- name: Static Code Analysis (Psalm)
run: composer run analyze:psalm
- name: Run test suite
run: composer run unit:tests
48 changes: 48 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "*.*"
paths:
- composer.*
- src/**
- phpstan*
- psalm*
push:
branches:
- "*.x"
paths:
- composer.*
- src/**
- phpstan*
- psalm*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
static-analysis:
name: Static Analysis
runs-on: "ubuntu-latest"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: '8.2'
tools: cs2pr

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Static Analysis (PHPStan)
run: "composer run analyze:phpstan -- --error-format=checkstyle | cs2pr"

- name: Static Analysis (PHPStan)
run: "composer run analyze:psalm -- --shepherd"
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# ide
.idea/
.vscode/
## IDE
.idea/
.vscode/

# composer
vendor
## Composer
vendor/
composer.lock

# caches
.build/
## QA Tools
phpcs.xml
phpstan.neon
phpunit.xml
10 changes: 10 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*
!.gitignore

cache/*
!cache
!cache/.gitkeep

coverage/*
!coverage
!coverage/.gitkeep
Empty file added build/cache/.gitkeep
Empty file.
Empty file added build/coverage/.gitkeep
Empty file.
38 changes: 23 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
"psr/container": "^2.0",
"phpstan/extension-installer": "^1.3"
},
"minimum-stability": "stable",
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit": "^10.4",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7"
"nulldark/devtools": "@dev"
},
"autoload": {
"psr-4": {
Expand All @@ -29,21 +27,31 @@
}
},
"scripts": {
"dev:analyze": "vendor/bin/phpstan analyze --ansi --memory-limit=1G",
"dev:lint": [
"@dev:lint:fix",
"@dev:lint:style"
"analyze:md": "phpmd src/ xml phpmd.xml",
"analyze:phpstan": "phpstan analyze --ansi",
"analyze:psalm": "psalm",
"build:clean": "git clean -fX build/.",
"build:clean:cache": "git clone -fX build/cache/.",
"build:clean:coverage": "git clone -fX build/coverage/.",
"checks": [
"@lint:style",
"@analyze:psalm",
"@analyze:phpstan",
"@test:unit",
"@test:coverage:html"
],
"dev:lint:fix": "vendor/bin/phpcbf",
"dev:lint:style": "vendor/bin/phpcs -p --colors",
"dev:tests": [
"@dev:tests:unit"
],
"dev:tests:unit": "phpunit"
"lint:style": "phpcs --colors --cache=build/cache/phpcs.cache",
"lint:fix": "phpcbf --cache=build/cache/phpcs.cache",
"lint:syntax": "parallel-lint --colors src tests",
"test:units": "phpunit --colors=always",
"test:coverage:ci": "phpunit --colors=always --coverage-text --coverage-xml ./build/coverage/xml tests",
"test:coverage:html": "phpunit --colors=always --coverage-html ./build/coverage/html tests"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"nulldark/devtools": true
}
}
}
7 changes: 5 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
parameters:
level: max
tmpDir: ./build/cache/phpstan
tipsOfTheDay: false
treatPhpDocTypesAsCertain: false
tmpDir: .build/cache/phpstan
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
paths:
- src
- src/
18 changes: 0 additions & 18 deletions phpunit.xml

This file was deleted.

36 changes: 36 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory="build/cache/phpunit"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
colors="true"
>
<coverage/>

<testsuites>
<testsuite name="units">
<directory>tests/Unit/</directory>
</testsuite>
</testsuites>

<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src/</directory>
</include>
</source>

<php>
<ini name="error_reporting" value="32767" />
<ini name="display_errors" value="1" />
<ini name="display_startup_errors" value="1" />
<ini name="memory_limit" value="-1" />
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
</php>
</phpunit>
33 changes: 33 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<psalm xmlns="https://getpsalm.org/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
cacheDirectory="./build/cache/psalm"
errorLevel="2"
hoistConstants="true"
resolveFromConfigFile="true"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="true"
ensureArrayStringOffsetsExist="true"
addParamDefaultToDocblockType="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="tests"/>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>

<issueHandlers>
<UnsupportedPropertyReferenceUsage errorLevel="suppress" />
</issueHandlers>

<plugins>
<pluginClass class="Psalm\MockeryPlugin\Plugin"/>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>

</psalm>
Loading

0 comments on commit 141ff2e

Please sign in to comment.