Skip to content

Commit e3f781e

Browse files
authored
2 - added some files for better development improvements (#4)
* 2 - added some files for better development improvements * 3 - use correct docker compose version - remove leading slashes - add install step to `make test` * 3 - try to use PHP 8.3 in CI * 3 - remove unnecessary export-ignore * 3 - added trailing slashes to identify that line represents a directory
1 parent d7dcaf5 commit e3f781e

File tree

7 files changed

+67
-6
lines changed

7 files changed

+67
-6
lines changed

.docker/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG PHP_VERSION=8.2
2+
ARG PHPUNIT_VERSION=10.4.0
3+
ARG PHPSTAN_VERSION=1.10.38
4+
5+
FROM php:${PHP_VERSION}-cli-alpine
6+
COPY --from=composer /usr/bin/composer /usr/bin/composer
7+
8+
ARG PHPUNIT_VERSION
9+
ARG PHPSTAN_VERSION
10+
11+
RUN docker-php-ext-install bcmath && docker-php-ext-enable bcmath
12+
RUN wget -O phpunit https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar && chmod +x phpunit
13+
RUN wget -O phpstan https://github.com/phpstan/phpstan/releases/download/${PHPSTAN_VERSION}/phpstan.phar && chmod +x phpstan
14+

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PHP_VERSION=8.2
2+
PHPUNIT_VERSION=10.4.0
3+
PHPSTAN_VERSION=1.10.38

.gitattributes

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
*.png binary
88

99
# Remove files for archives generated using `git archive`
10-
phpunit.xml.dist export-ignore
11-
.travis.yml export-ignore
12-
.gitignore export-ignore
13-
.gitattributes export-ignore
1410
.editorconfig export-ignore
11+
.env export-ignore
12+
.gitattributes export-ignore
13+
.gitignore export-ignore
14+
phpcs.xml export-ignore
15+
phpstan.neon export-ignore
16+
phpunit.xml.dist export-ignore
17+
compose.yaml export-ignore
18+
Makefile export-ignore
19+
20+
# Remove directories for archives
21+
.docker/ export-ignore
22+
.github/ export-ignore
23+
tests/ export-ignore

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version: ['8.1', '8.2']
16+
php-version: ['8.1', '8.2', '8.3']
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -26,11 +26,13 @@ jobs:
2626
coverage: pcov
2727

2828
- name: Composer install
29+
continue-on-error: ${{ matrix.php-version == '8.3' }}
2930
run: |
3031
composer --version
3132
composer install
3233
3334
- name: Run PHPUnit
35+
continue-on-error: ${{ matrix.php-version == '8.3' }}
3436
run: |
3537
if [[ ${{ matrix.php-version }} == '8.1' ]]; then
3638
vendor/bin/phpunit --coverage-clover=coverage.xml

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
install:
2+
@docker compose run --rm -it php composer install
3+
4+
phpunit:
5+
@docker compose run --rm -it php composer test
6+
7+
coverage:
8+
@docker compose run --rm -it php composer test-coverage
9+
10+
phpstan:
11+
@docker compose run --rm -it php composer stan
12+
13+
cs-check:
14+
@docker compose run --rm -it php composer cs-check
15+
16+
cs-fix:
17+
@docker compose run --rm -it php composer cs-fix
18+
19+
test: install cs-check phpstan phpunit

compose.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3"
2+
3+
services:
4+
php:
5+
build:
6+
context: .
7+
dockerfile: .docker/Dockerfile
8+
args:
9+
PHP_VERSION: "${PHP_VERSION:-8.2}"
10+
PHPUNIT_VERSION: "${PHPUNIT_VERSION:-10.4.0}"
11+
PHPSTAN_VERSION: "${PHPSTAN_VERSION:-1.10.38}"
12+
volumes:
13+
- ./:/code
14+
working_dir: /code

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"scripts": {
4444
"test": "phpunit",
4545
"test-coverage": "phpunit --log-junit tmp/coverage/unitreport.xml --coverage-html tmp/coverage --coverage-clover tmp/coverage/coverage.xml",
46-
"stan": "vendor/bin/phpstan.phar analyse",
46+
"stan": "phpstan analyse",
4747
"lowest": "validate-prefer-lowest",
4848
"lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json",
4949
"cs-check": "vendor/bin/phpcs",

0 commit comments

Comments
 (0)