ci-examples/PHP/.woodpecker.yaml
Martijn de Boer f629af8e6a Add PHP Lint for recent versions (#40)
This example adds a matrix step for the 4 most recent supported PHP versions. It uses a bash command and the PHP built-in linter to find errors. It doesn't print much output due to the nature of the linter, but the build step fails with exit code 1 if linting fails.

Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/40
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Martijn de Boer <git@sexybiggetje.nl>
Co-committed-by: Martijn de Boer <git@sexybiggetje.nl>
2024-04-11 18:50:10 +00:00

20 lines
575 B
YAML

# PHP Lint on recent (supported) versions.
# Will exit with exit code 1 when 'php -l <file>' failes.
# Recursive lint snippet taken fron the gist comments over at https://gist.github.com/mathiasverraes/3096500
matrix:
PHPVERSION:
- 8.0
- 8.1
- 8.2
- 8.3
steps:
lint:
image: php:${PHPVERSION}-cli
commands:
- find . -path ./app/vendor -prune -o -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
when:
- event: pull_request
- event: [push, tag, manual]
branch: main