Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Unit update #8

Merged
merged 1 commit into from
May 15, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.0, 8.1, 8.2 ]
php: [ 8.0, 8.1, 8.2, 8.3 ]

name: php:${{ matrix.php }}

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:8.2-fpm
ARG PHP_VERSION
FROM php:${PHP_VERSION}-fpm

RUN apt-get update
RUN apt-get install -y git zip unzip libzip-dev libmcrypt-dev --no-install-recommends
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ else // OCONUS

## Local Development Notes

```shell
docker build . -t php:8.2
The numeric value after the command represents the PHP version

docker run --rm -it -v $(pwd):/app php:8.2 composer install
docker run --rm -it -v $(pwd):/app php:8.2 composer test
docker run --rm -it -v $(pwd):/app php:8.2 composer phpcs
```shell
task build-8.3
task setup-8.3
task test-8.3
```

Alternatively you can run `task test-all` to build, setup, and test against all supported PHP versions.
46 changes: 46 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3'
vars:
DEFAULT_PHP_VERSION: "8.3"
tasks:
build:
vars:
PHP_VERSION: '{{default .DEFAULT_PHP_VERSION .PHP_VERSION}}'
cmds:
- docker build --build-arg PHP_VERSION={{.PHP_VERSION}} -t cc:{{.PHP_VERSION}} .
build-*:
vars:
PHP_VERSION: '{{index .MATCH 0}}'
cmds:
- task: build
vars: { PHP_VERSION: "{{.PHP_VERSION}}" }
silent: true
docker-run:
vars:
COMMAND: '{{.COMMAND}}'
PHP_VERSION: '{{default .DEFAULT_PHP_VERSION .PHP_VERSION}}'
cmds:
- docker run --rm -it -v $(pwd):/app cc:{{.PHP_VERSION}} composer {{.COMMAND}}
setup-*:
vars:
PHP_VERSION: '{{index .MATCH 0}}'
cmds:
- rm -f composer.lock 2> /dev/null
- task: docker-run
vars: { COMMAND: "install", PHP_VERSION: "{{.PHP_VERSION}}" }
test-*:
vars:
PHP_VERSION: '{{index .MATCH 0}}'
cmds:
- task: docker-run
vars: { COMMAND: "test", PHP_VERSION: "{{.PHP_VERSION}}" }
- task: docker-run
vars: { COMMAND: "phpcs", PHP_VERSION: "{{.PHP_VERSION}}" }
test-all:
cmds:
- |
VERSIONS=("8.0" "8.1" "8.2" "8.3")
for VERSION in "${VERSIONS[@]}"; do
task build-$VERSION
task setup-$VERSION
task test-$VERSION
done
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0 || ^10.5.0",
"phpunit/phpunit": ">9.0",
"squizlabs/php_codesniffer": "^3.0"
},
"scripts": {
Expand Down
Loading