Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7ddd17

Browse files
committed
Add tests
1 parentf25fbd5 commitd7ddd17

File tree

59 files changed

+2568
-3217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2568
-3217
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name:Continuous Integration
2+
on:
3+
push:
4+
branches:
5+
-'main'
6+
-'master'
7+
-'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
8+
pull_request:
9+
jobs:
10+
package-name:
11+
name:Package Name
12+
runs-on:ubuntu-latest
13+
outputs:
14+
package-name:${{ steps.package-name.outputs.package-name }}
15+
steps:
16+
-uses:actions/checkout@v1
17+
-id:package-name
18+
run:|
19+
printf "::set-output name=package-name::[\"%s\"]" $(docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.name' "${GITHUB_WORKSPACE}/composer.json")
20+
supported-versions-matrix:
21+
name:Supported Versions Matrix
22+
runs-on:ubuntu-latest
23+
outputs:
24+
version:${{ steps.supported-versions-matrix.outputs.version }}
25+
upcoming:${{ steps.supported-versions-matrix.outputs.upcoming }}
26+
steps:
27+
-uses:actions/checkout@v1
28+
-id:supported-versions-matrix
29+
uses:WyriHaximus/github-action-composer-php-versions-in-range@v1
30+
with:
31+
upcomingReleases:true
32+
generate-checks-strategy:
33+
name:Generate Checks
34+
runs-on:ubuntu-latest
35+
outputs:
36+
check:${{ steps.generate-checks-strategy.outputs.check }}
37+
steps:
38+
-uses:actions/checkout@v1
39+
-id:generate-checks-strategy
40+
name:Generate check
41+
run:|
42+
printf "Checks found: %s\r\n" $(make task-list-ci)
43+
printf "::set-output name=check::%s" $(make task-list-ci)
44+
composer-install:
45+
strategy:
46+
fail-fast:false
47+
matrix:
48+
php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
49+
composer:[current, highest]
50+
needs:
51+
-supported-versions-matrix
52+
runs-on:ubuntu-latest
53+
container:
54+
image:wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root
55+
steps:
56+
-uses:actions/checkout@v1
57+
-name:Cache composer packages
58+
uses:actions/cache@v1
59+
with:
60+
path:./vendor/
61+
key:${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
62+
-name:Install Dependencies
63+
run:composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
64+
if:matrix.composer == 'lowest'
65+
-name:Install Dependencies
66+
run:composer install --ansi --no-progress --no-interaction --prefer-dist -o
67+
if:matrix.composer == 'current'
68+
-name:Install Dependencies
69+
run:composer update --ansi --no-progress --no-interaction --prefer-dist -o
70+
if:matrix.composer == 'highest'
71+
can-require:
72+
name:Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }}
73+
strategy:
74+
fail-fast:false
75+
matrix:
76+
php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
77+
package-name:${{ fromJson(needs.package-name.outputs.package-name) }}
78+
needs:
79+
-package-name
80+
-supported-versions-matrix
81+
runs-on:ubuntu-latest
82+
container:
83+
image:ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
84+
steps:
85+
-uses:actions/checkout@v2
86+
with:
87+
path:checked_out_package
88+
-name:Set Up composer.json
89+
run:|
90+
echo "{\"repositories\": [{\"name\": \"${{ matrix.package-name }}\",\"type\": \"path\",\"url\": \"./checked_out_package\"}]}" > composer.json
91+
-name:Require package
92+
if:needs.supported-versions-matrix.outputs.upcoming != matrix.php
93+
run:|
94+
composer config --no-plugins "allow-plugins.*/*"true
95+
composer require "${{ matrix.package-name }}:dev-${GITHUB_SHA}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv || composer require "${{ matrix.package-name }}:dev-${GITHUB_REF_NAME}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv
96+
qa:
97+
strategy:
98+
fail-fast:false
99+
matrix:
100+
php:${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
101+
composer:[current, highest]
102+
check:${{ fromJson(needs.generate-checks-strategy.outputs.check) }}
103+
needs:
104+
-supported-versions-matrix
105+
-composer-install
106+
-generate-checks-strategy
107+
runs-on:ubuntu-latest
108+
container:
109+
image:wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root
110+
steps:
111+
-uses:actions/checkout@v1
112+
-name:Cache composer packages
113+
uses:actions/cache@v1
114+
with:
115+
path:./vendor/
116+
key:${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
117+
-name:Install Dependencies
118+
run:composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
119+
if:matrix.composer == 'lowest'
120+
-name:Install Dependencies
121+
run:composer install --ansi --no-progress --no-interaction --prefer-dist -o
122+
if:matrix.composer == 'current'
123+
-name:Install Dependencies
124+
run:composer update --ansi --no-progress --no-interaction --prefer-dist -o
125+
if:matrix.composer == 'highest'
126+
-name:Fetch Tags
127+
run:git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
128+
if:matrix.check == 'backward-compatibility-check'
129+
-run:make cs-fix || true
130+
-run:make ${{ matrix.check }} || true
131+
if:needs.supported-versions-matrix.outputs.upcoming == matrix.php
132+
env:
133+
COVERALLS_REPO_TOKEN:${{ secrets.COVERALLS_REPO_TOKEN }}
134+
COVERALLS_RUN_LOCALLY:${{ secrets.COVERALLS_RUN_LOCALLY }}
135+
-run:make ${{ matrix.check }}
136+
if:needs.supported-versions-matrix.outputs.upcoming != matrix.php
137+
env:
138+
COVERALLS_REPO_TOKEN:${{ secrets.COVERALLS_REPO_TOKEN }}
139+
COVERALLS_RUN_LOCALLY:${{ secrets.COVERALLS_RUN_LOCALLY }}

‎Makefile‎

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,69 @@ SHELL=bash
33

44
.PHONY:*
55

6-
#ifneq ("$(wildcard /.dockerenv)","")
7-
DOCKER_RUN=
8-
#else
9-
#DOCKER_RUN=docker run --rm -it\
10-
#-v `pwd`:`pwd`\
11-
#-w `pwd`\
12-
#"wyrihaximusnet/php:7.4-zts-alpine3.11-dev"
13-
#endif
14-
15-
all: lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused
16-
17-
lint:
6+
DOCKER_CGROUP:=$(shell cat /proc/1/cgroup | grep docker | wc -l)
7+
COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer/cache)
8+
9+
ifneq ("$(wildcard /.dockerenv)","")
10+
IN_DOCKER=TRUE
11+
else ifneq ("$(DOCKER_CGROUP)","0")
12+
IN_DOCKER=TRUE
13+
else
14+
IN_DOCKER=FALSe
15+
endif
16+
17+
ifeq ("$(IN_DOCKER)","TRUE")
18+
DOCKER_RUN=
19+
else
20+
DOCKER_RUN=docker run --rm -it \
21+
-v "`pwd`:`pwd`" \
22+
-v "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" \
23+
-w "`pwd`" \
24+
"wyrihaximusnet/php:8.1-nts-alpine-slim-dev"
25+
endif
26+
27+
all:## Runs everything ###
28+
@grep -E'^[a-zA-Z0-9_-]+:.*?## .*$$'$(MAKEFILE_LIST)| grep -v"###"| awk'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}'| xargs --open-tty$(MAKE)
29+
30+
syntax-php:## Lint PHP syntax
1831
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor.
1932

20-
cs:
21-
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(nproc)
33+
cs-fix:## Fix any automatically fixable code style issues
34+
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shellnproc)
2235

23-
cs-fix:
24-
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(nproc)
36+
cs:## Check the code for code style issues
37+
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(shellnproc)
2538

26-
stan:
39+
stan:## Run static analysis (PHPStan)
2740
$(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon
2841

29-
psalm:
30-
$(DOCKER_RUN) vendor/bin/psalm --threads=$(nproc) --shepherd --stats
42+
psalm:## Run static analysis (Psalm)
43+
$(DOCKER_RUN) vendor/bin/psalm --threads=$(shellnproc) --shepherd --stats
3144

32-
unit:
45+
unit:## Run tests
3346
$(DOCKER_RUN) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml
3447

3548
unit-ci: unit
3649
if [-f ./build/logs/clover.xml ];then wget https://scrutinizer-ci.com/ocular.phar&& sleep 3&& php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml;fi
3750

38-
infection:
39-
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(nproc)
51+
infection:## Run mutation testing
52+
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(shellnproc)
4053

41-
composer-require-checker:
54+
composer-require-checker:## Ensure we require every package used in this package directly
4255
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json
4356

44-
composer-unused:
45-
$(DOCKER_RUN) composer unused --ansi
57+
composer-unused:## Ensure we don't require any package we don't use in this package directly
58+
$(DOCKER_RUN) vendor/bin/composer-unused --ansi
59+
60+
backward-compatibility-check:## Check code for backwards incompatible changes
61+
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check||true
62+
63+
shell:## Provides Shell access in the expected environment ###
64+
$(DOCKER_RUN) ash
65+
66+
task-list-ci:## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
67+
@grep -E'^[a-zA-Z0-9_-]+:.*?## .*$$'$(MAKEFILE_LIST)| grep -v"###"| sort| awk'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}'| jq --raw-input --slurp -c'split("\n")| .[0:-1]'
68+
69+
help:## Show this help ###
70+
@printf"\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
71+
@grep -E'^[a-zA-Z0-9_-]+:.*?## .*$$'$(MAKEFILE_LIST)| sort| awk'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}'| tr -d'#'

‎composer-require-checker.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"symbol-whitelist" : [
33
"null","true","false",
44
"static","self","parent",
5-
"array","string","int","float","bool","iterable","callable","void","object",
6-
"WyriHaximus\\Constants\\Boolean\\FALSE_","WyriHaximus\\Constants\\Boolean\\TRUE_"
5+
"array","string","int","float","bool","iterable","callable","void","object","mixed",
6+
"WyriHaximus\\Constants\\Boolean\\FALSE_","WyriHaximus\\Constants\\Boolean\\TRUE_",
7+
"WyriHaximus\\getIn","WyriHaximus\\iteratorOrArrayToArray","WyriHaximus\\listClassesInDirectories",
8+
"WyriHaximus\\Constants\\HTTPStatusCodes\\OK"
79
],
810
"php-core-extensions" : [
911
"Core",

‎composer.json‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
"require": {
77
"php":"^8.1",
88
"composer-plugin-api":"^2",
9-
"cakephp/collection":"^4.4",
10-
"chimera/bus-tactician":"^0.4.0",
9+
"ancarda/psr7-string-stream":"^1.3",
10+
"chimera/foundation":"^0.4.0",
1111
"chimera/mapping":"^0.4.0",
1212
"chimera/routing":"^0.4.0",
1313
"chimera/routing-mezzio":"^0.4.0",
14+
"composer/composer":"^2.4",
1415
"doctrine/annotations":"^1.13",
1516
"for/http-middleware-psr15-adapter":"^2",
1617
"illuminate/collections":"^9.25.1",
17-
"joshdifabio/composed":"^1",
1818
"laminas/laminas-diactoros":"^2.14",
19+
"laminas/laminas-stratigility":"^3.9",
1920
"lcobucci/content-negotiation-middleware":"^3.1",
20-
"lcobucci/jwt":"^4.2",
21+
"league/tactician":"^1.1",
2122
"league/tactician-container":"^3 || ^2",
2223
"mammatus/app":"dev-master",
2324
"mammatus/healthz-vhost":"dev-master",
@@ -27,22 +28,31 @@
2728
"mammatus/http-server-websockets":"dev-master",
2829
"mammatus/life-cycle-events":"^1",
2930
"mammatus/metrics-prometheus-vhost":"dev-master",
31+
"mezzio/mezzio-fastroute":"^3.5",
3032
"mezzio/mezzio-helpers":"^5.6",
3133
"mezzio/mezzio-router":"^3.6",
3234
"middlewares/access-log":"^2",
3335
"middlewares/cache":"^2",
3436
"middlewares/client-ip":"^2",
3537
"middlewares/filesystem":"^2",
3638
"middlewares/https":"^2",
39+
"middlewares/negotiation":"^2.1",
3740
"middlewares/response-time":"^2",
3841
"nikic/fast-route":"^1.2",
3942
"nikic/php-parser":"^4.10",
40-
"northwoods/broker":"^3.0",
41-
"opis/closure":"^3.5",
43+
"psr/container":"^3 || ^2 || ^1",
44+
"psr/http-factory":"^3 || ^2 || ^1",
45+
"psr/http-message":"^3 || ^2 || ^1",
46+
"psr/http-server-middleware":"^3 || ^2 || ^1",
47+
"psr/log":"^3 || ^2 || ^1",
4248
"react-inspector/http-middleware":"^2.0",
4349
"react/async":"^4",
50+
"react/cache":"^1.1",
51+
"react/event-loop":"^1.3",
4452
"react/http":"^1.7",
45-
"roave/better-reflection":"^5",
53+
"react/promise":"^2.9",
54+
"react/socket":"^1.12",
55+
"roave/better-reflection":"^6 || ^5",
4656
"thecodingmachine/safe":"^1",
4757
"thruway/client":"^0.5.8",
4858
"thruway/middleware":"^0.1.1",
@@ -51,6 +61,7 @@
5161
"wyrihaximus/broadcast-contracts":"^1.3",
5262
"wyrihaximus/doctrine-annotation-autoloader":"^1",
5363
"wyrihaximus/get-in-packages-composer.jason":"^2",
64+
"wyrihaximus/html-compress":"^4.2",
5465
"wyrihaximus/iterator-or-array-to-array":"^1.1",
5566
"wyrihaximus/json-psr7":"^1.3",
5667
"wyrihaximus/list-classes-in-directory":"^1.3",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp