Skip to content

Commit

Permalink
Use our standardized ci setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Jul 29, 2022
1 parent cb264fa commit 1bff085
Show file tree
Hide file tree
Showing 10 changed files with 3,895 additions and 262 deletions.
15 changes: 10 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
49 changes: 49 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# https://docs.github.com/en/actions

name: "Integrate"

on: # yamllint disable-line rule:truthy
push:
branches:
- "5.x"
pull_request: null
# Allow manually triggering the workflow.
workflow_dispatch: null

jobs:
code-coverage:
name: "Code Coverage"
uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@main"
with:
composer-root-version: "2.x-dev"

coding-standards:
name: "Coding Standards"
uses: "phpDocumentor/.github/.github/workflows/[email protected]"
with:
composer-root-version: "2.x-dev"

dependency-analysis:
name: "Dependency analysis"
uses: "phpDocumentor/.github/.github/workflows/[email protected]"
with:
composer-root-version: "2.x-dev"

lint-root:
name: "Lint root"
uses: "phpDocumentor/.github/.github/workflows/lint.yml@main"
with:
composer-options: "--no-check-publish --ansi"

static-analysis:
name: "Static analysis"
uses: "phpDocumentor/.github/.github/workflows/[email protected]"
with:
php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix"
composer-root-version: "2.x-dev"

unit-tests:
name: "Unit test"
uses: "phpDocumentor/.github/.github/workflows/[email protected]"
with:
composer-root-version: "2.x-dev"
194 changes: 0 additions & 194 deletions .github/workflows/push.yml

This file was deleted.

62 changes: 33 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
.PHONY: install-phive
install-phive:
mkdir tools; \
wget -O tools/phive.phar https://phar.io/releases/phive.phar; \
wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \
gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \
gpg --verify tools/phive.phar.asc tools/phive.phar; \
chmod +x tools/phive.phar

.PHONY: setup
setup: install-phive
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phar-ga:latest php tools/phive.phar install --force-accept-unsigned

.PHONY: phpcs
phpcs:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -s

.PHONY: phpcbf
phpcbf:
.PHONY: help
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: code-style
code-style:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s

.PHONY: fix-code-style
fix-code-style:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf

.PHONY: phpstan
phpstan:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --configuration phpstan.neon
.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm

.PHONY: psalm
psalm:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.3 vendor/bin/psalm.phar
.PHONY: test
test:
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/phpunit
test: test-unit ## Runs all test suites with phpunit/phpunit
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit

.PHONY: pre-commit-test
pre-commit-test: test phpcs phpstan psalm
.PHONY: test-unit
test-unit: ## Runs unit tests with phpunit/phpunit
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit --testsuite=unit

.PHONY: dependency-analysis
dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 .phive/composer-require-checker check --config-file=/opt/project/composer-require-checker.json

vendor: composer.json composer.lock
composer validate --no-check-publish
composer install --no-interaction --no-progress

.PHONY: rector
rector: ## Refactor code using rector
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/rector process

.PHONY: pre-commit-test
pre-commit-test: fix-code-style test code-style static-code-analysis
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@
"homepage": "https://www.phpdoc.org",
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"license": "MIT",
"minimum-stability": "stable",
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "[email protected]"
}
],
"require": {
"php": "^7.3 || ^8.0"
"php": "^7.4 || ^8.0"
},
"autoload" : {
"psr-4" : {
"phpDocumentor\\Reflection\\": "src/"
}
},
"require-dev": {
"psalm/phar": "^4.8"
},
"extra": {
"branch-alias": {
"dev-2.x": "2.x-dev"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.8",
"vimeo/psalm": "^4.25"
},
"config": {
"platform": {
"php": "7.4.1"
}
}
}
Loading

0 comments on commit 1bff085

Please sign in to comment.