Skip to content

require php-sap/datetime #5 #9

require php-sap/datetime #5

require php-sap/datetime #5 #9

Workflow file for this run

name: PHP
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
permissions:
contents: "read"
jobs:
# PHP lint for different PHP versions
build:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
name: "PHP ${{ matrix.php-version }}"
steps:
- # git checkout
name: "git checkout"
uses: "actions/checkout@v3"
- # Setup PHP
name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
- # Check PHP version
name: "Check PHP version"
run: "php -v"
- # Lint PHP files
name: "Lint PHP files"
run: |
for file in $(find src/ -type f -name '*.php'); do
echo -n "==> ${file}: ";
php -l "${file}";
done
- # Validate composer.json and composer.lock
name: "Validate composer.json and composer.lock"
run: "composer validate --strict"
- # Cache Composer packages
name: "Cache Composer packages"
id: "composer-cache"
uses: "actions/cache@v3"
with:
path: "vendor"
key: "${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-php-"
- # Install dependencies
name: "Install composer dependencies"
run: "composer install --prefer-dist --no-progress"
- # Run PHP_CodeSniffer validations
name: "Run PHP_CodeSniffer validations"
run: "vendor/bin/phpcs"