Skip to content

Commit

Permalink
update testings
Browse files Browse the repository at this point in the history
  • Loading branch information
rosven9856 committed Sep 6, 2024
1 parent d124817 commit 78a1f98
Show file tree
Hide file tree
Showing 8 changed files with 754 additions and 56 deletions.
47 changes: 33 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- run: composer validate --strict --ansi
composer-require-checker:
- run: composer validate
composer-normalize:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -60,8 +60,8 @@ jobs:
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer require-checker
composer-unused:
- run: composer normalize
composer-require-checker:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -79,8 +79,8 @@ jobs:
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer unused
composer-normalize:
- run: composer require-checker
composer-unused:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -98,8 +98,8 @@ jobs:
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer normalize --dry-run --diff --ansi
php-cs-fixer:
- run: composer unused
coding-standards:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -117,8 +117,8 @@ jobs:
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer fixcs -- --dry-run --diff --format=checkstyle --ansi | cs2pr
rector:
- run: composer php-cs-fixer -- --dry-run --diff --format=checkstyle --ansi | cs2pr
refactoring:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -137,7 +137,7 @@ jobs:
with:
composer-options: --optimize-autoloader
- run: composer rector -- --dry-run
psalm:
static-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -156,7 +156,7 @@ jobs:
with:
composer-options: --optimize-autoloader
- run: composer psalm -- --php-version=${{ matrix.php }} --stats --output-format=github --shepherd
phpunit:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -170,9 +170,28 @@ jobs:
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: xdebug
coverage: pcov
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
# - run: composer test -- --colors=always --order-by=random --coverage-clover coverage.xml
- run: composer test -- --colors=always --order-by=random
- run: composer phpunit
mutation-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- 8.3
steps:
- uses: actions/checkout@v4
with:
ref: ${{env.BRANCH}}
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: pcov
- uses: ramsey/composer-install@v3
with:
composer-options: --optimize-autoloader
- run: composer infection
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
ARG PHP_VERSION=8.3.10-1
ARG PHP_VERSION=8.3

FROM rosven9856/php:$PHP_VERSION

RUN apk add --update --no-cache --virtual .build-deps ${PHPIZE_DEPS} \
&& pecl install pcov \
&& docker-php-ext-enable pcov \
&& apk del .build-deps

RUN addgroup -g 1000 --system php
RUN adduser -G php --system -D -s /bin/sh -u 1000 php

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center">
<p style="text-align: center">
<img width="560" height="260" src="docs/img/github_gitea_actions.jpg" alt="github gitea actions"/>
</p>

Expand Down Expand Up @@ -50,7 +50,7 @@ The path to the compiled package archive

build
```shell
docker build . --build-arg=PHP_VERSION=8.3.10-1 -t=composer-package-action
docker build . --build-arg=PHP_VERSION=8.3 -t=composer-package-action
```

initialization
Expand All @@ -63,3 +63,7 @@ running
docker run --rm -e GITHUB_WORKSPACE=/usr/bin/app -v .:/usr/bin/app composer-package-action php app.php
```

testing
```shell
docker run --rm -e GITHUB_WORKSPACE=/usr/bin/app -v .:/usr/bin/app composer-package-action composer tests
```
2 changes: 1 addition & 1 deletion action.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=8.3.10-1
ARG PHP_VERSION=8.3

FROM rosven9856/php:$PHP_VERSION

Expand Down
23 changes: 19 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ergebnis/composer-normalize": "^2.42",
"friendsofphp/php-cs-fixer": "^3.57",
"icanhazstring/composer-unused": "^0.8.11",
"infection/infection": "^0.27.11",
"maglnet/composer-require-checker": "^4.11",
"phpunit/phpunit": "^10.4.2",
"phpyh/coding-standard": "^2.6",
Expand All @@ -39,15 +40,29 @@
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
},
"sort-packages": true
"sort-packages": true,
"sort-scripts": false
},
"scripts": {
"fixcs": "php-cs-fixer fix --diff --verbose",
"infection": "infection --threads=max --show-mutations",
"normalize": "composer normalize --dry-run --diff --ansi",
"php-cs-fixer": "php-cs-fixer fix --diff --verbose",
"phpunit": "phpunit --colors=always --order-by=random",
"psalm": "psalm --show-info=true --no-diff",
"rector": "rector process",
"require-checker": "composer-require-checker check --config-file=composer-require-checker.json composer.json",
"test": "phpunit",
"unused": "composer-unused --excludePackage=ext-zip"
"tests": [
"@validate",
"@normalize",
"@require-checker",
"@unused",
"composer php-cs-fixer -- --dry-run --diff --format=checkstyle --ansi",
"composer rector -- --dry-run",
"composer psalm -- --stats --shepherd",
"@phpunit",
"@infection"
],
"unused": "composer-unused --excludePackage=ext-zip",
"validate": "composer validate --strict --ansi"
}
}
Loading

0 comments on commit 78a1f98

Please sign in to comment.