Ignore /.vscode/ & /etc/{docker,nginx}/ #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set colorcolumn=: | |
name: php-linter | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
php_version: | |
description: "Specify the PHP version to use (e.g., 8.0, 8.1)" | |
required: false | |
default: '8.1' | |
env: | |
PHP_VERSION: ${{ inputs.php_version || '8.1' }} | |
permissions: | |
contents: read | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update apt cache | |
run: sudo apt-get update | |
- name: Install php ${{ env.PHP_VERSION }} | |
run: sudo apt-get install php${{ env.PHP_VERSION }}-cli | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: lib | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install composer/vendor dependencies | |
run: composer install --prefer-dist --no-progress --ignore-platform-reqs | |
- name: Validate PHP syntax | |
run: bash -c 'set -e;for file in $(find ./src -type f -regex ".*\.\(php\|phtml\)" -print); do php -e -l -f "$file"; done' |