Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pipeline to globy standard and added phpstan, cs fixer, psalm … #2

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 47 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CQ

on:
push:
Expand All @@ -8,8 +8,12 @@ on:
branches:
- '*'

permissions:
contents: read

jobs:
build:
code-quality:
name: Coding standards, code quality and static code analysis
runs-on: ubuntu-latest

strategy:
Expand All @@ -24,22 +28,52 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: dom

- 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

- name: Run test suite
run: vendor/bin/pest
- name: Run the linter
run: composer lint

- name: Run PHPStan
if: success() || failure()
run: composer phpstan -- --error-format=github > phpstan.json

- name: Run psalm
if: success() || failure()
run: composer psalm --output-format=github

integration-tests:
name: Test suite and coverage
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3']

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: |
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
composer coverage --min=90 --coverage-clover=coverage.xml
else
composer pest
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ examples/hashresult.php
*.iws
*.ipr
.idea/
.tmp/

# eclipse project file
.settings/
Expand Down
26 changes: 25 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,37 @@
"pestphp/pest": "^2.4",
"friendsofphp/php-cs-fixer": "^3.16",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1"
"phpstan/phpstan-deprecation-rules": "^1.1",
"vimeo/psalm": "^5.23"
},
"autoload-dev": {
"psr-4": {
"HashSensitiveTests\\": "tests/"
}
},
"scripts": {
"test": [
"composer exec phpunit"
],
"lint": [
"vendor/bin/php-cs-fixer fix src --dry-run --allow-risky=yes"
],
"lint:fix": [
"vendor/bin/php-cs-fixer fix src --allow-risky=yes"
],
"phpstan": [
"php -d memory_limit=1G ./vendor/bin/phpstan analyse -c phpstan.neon"
],
"psalm": [
"php ./vendor/bin/psalm"
],
"pest": [
"php ./vendor/bin/pest"
],
"coverage": [
"php ./vendor/bin/pest --coverage"
]
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
Expand Down
Loading