Skip to content
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
17 changes: 9 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "syntatis/php-utils",
"image": "ghcr.io/syntatis/php:7.4-fpm",
"name": "syntatis/utils-php",
"dockerComposeFile": [
"../compose.yml"
],
"service": "php",
"workspaceFolder": "/var/www/work",
"customizations": {
"vscode": {
"settings": {
Expand All @@ -18,13 +22,10 @@
"extensions": [
"bmewburn.vscode-intelephense-client",
"christian-kohler.path-intellisense",
"editorconfig.editorconfig",
"kasik96.latte",
"mikestead.dotenv",
"editorConfig.editorConfig",
"neilbrayfield.php-docblocker",
"sanderronde.phpstan-vscode",
"wmaurer.change-case",
"dotjoshjohnson.xml"
"SanderRonde.phpstan-vscode",
"valeryanm.vscode-phpsab"
]
}
}
Expand Down
17 changes: 11 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.{json,neon,neon.dist,yml,md}]
[*.json]
indent_size = 2

[*.{yml,md,neon,neon.dist}]
[*.{yml,yaml,neon,.neon.dist,json}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt}]
end_of_line = crlf
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
/.github export-ignore
/.gitignore export-ignore
/.vscode export-ignore
/CODE_OF_CONDUCT.md export-ignore
/codecov.yml export-ignore
/docker-compose.yml export-ignore
/compose.yml export-ignore
/docs export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/README.md export-ignore
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ updates:
interval: "monthly"
labels:
- "dependencies"
- "ci-cd"
- "chore"

- package-ecosystem: "composer"
versioning-strategy: increase
Expand All @@ -17,7 +17,7 @@ updates:
day: "friday"
labels:
- "dependencies"
- "composer"
- "chore"
ignore:
- dependency-name: "symfony/*"
versions: [">5.0"]
Expand Down
99 changes: 65 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: CI

on:
workflow_dispatch:
Expand All @@ -13,55 +13,86 @@ on:
- "phpcs.xml.dist"
- "phpstan.neon.dist"
- "phpunit.xml.dist"
push:
branches:
- main
paths:
- ".github/workflows/ci.yml"
- "**.php"
- "composer.json"
- "composer.lock"
- "phpcs.xml.dist"
- "phpstan.neon.dist"
- "phpunit.xml.dist"
types: [ready_for_review, synchronize, opened]

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

jobs:
test:
typo:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
name: Typo

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

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Check spelling
uses: crate-ci/typos@v1.34.0

- name: Setup Composer cache
uses: actions/cache@v4
lint:
runs-on: ubuntu-latest
name: Lint

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.version }}-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.version }}-composer-
php-version: 7.4

- name: Install PHP dependencies
uses: ramsey/composer-install@v3

- name: Analyze source code
run: composer lint

analyze:
runs-on: ubuntu-latest
name: Analyze

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
tools: composer:v2
php-version: 7.4

- name: Install PHP dependencies
uses: ramsey/composer-install@v3

- name: Install dependencies
run: composer update --prefer-dist --no-ansi --no-interaction --no-progress
- name: Analyze source code
run: composer analyze

- name: Run linter
if: ${{ matrix.version == '7.4' }}
run: composer phpcs
test:
needs: [typo, lint, analyze]
runs-on: ubuntu-latest
name: Test

strategy:
fail-fast: true
max-parallel: 3
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
stability: [prefer-lowest, prefer-stable]
machine: [windows-latest, ubuntu-latest]

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

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

- name: Run static analysis
run: composer phpstan
- name: Install PHP dependencies
uses: ramsey/composer-install@v3

- name: Run test
run: vendor/bin/phpunit --coverage-clover coverage.xml
Expand Down
55 changes: 35 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
#OS
.DS_*
# OS generated files #
######################
.DS_Store
Thumbs.db

# Composer
/vendor
composer.lock
auth.json
# Logs and databases #
######################
*.sql
*.log

# Log, cache, and tmp files
# Caches #
##########
*.cache
*.log
*.meta
tmp/

# Dotenv
.env.*
!.env
# Compiled source #
###################
*.tar*
*.zip
dist*
build*
@*

# Dependencies #
################
vendor*
composer.lock

# Tests #
#############
# Temporary files #
###################
tmp
artifacts/
phpunit.xml
phpstan.neon
phpcs.xml

# Docker
docker-composer.override.yml
# Environment files #
######################
.env

# Private Configs #
######################
phpcs.xml
phpstan.xml
phpunit.xml
*.override.xml
10 changes: 10 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
php:
image: ghcr.io/syntatis/php:${PHP_VERSION:-7.4}-fpm
restart: on-failure
volumes:
- ./:/var/www/work
- vscode_server_volume:/root/.vscode-server

volumes:
vscode_server_volume:
18 changes: 7 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,13 @@
}
},
"scripts": {
"phpcs:fix": "vendor/bin/phpcbf",
"phpcs": "vendor/bin/phpcs",
"phpstan": "vendor/bin/phpstan analyse --xdebug",
"phpunit:coverage": [
"format": "vendor/bin/phpcbf",
"lint": "vendor/bin/phpcs",
"analyze": "vendor/bin/phpstan analyse --xdebug",
"test": "vendor/bin/phpunit --no-coverage",
"test:coverage": [
"@putenv XDEBUG_MODE=coverage",
"vendor/bin/phpunit"
],
"phpunit": "vendor/bin/phpunit --no-coverage",
"test": [
"@phpcs",
"@phpstan",
"@phpunit"
]
},
"require": {
Expand All @@ -70,5 +65,6 @@
"squizlabs/php_codesniffer": "^3.13",
"symfony/var-dumper": ">=5.4.40",
"syntatis/coding-standard": "^2.0"
}
},
"non-feature-branches": ["dependabot/*"]
}