Skip to content

Check PHP syntax (#54) #61

Check PHP syntax (#54)

Check PHP syntax (#54) #61

Workflow file for this run

name: Tests
env:
BUILD_CLDR_VERSION: "47"
on:
push:
branches:
- main
tags-ignore:
- "**"
paths-ignore:
- .github/workflows/gh-pages.yml
- "gh-pages/**"
pull_request:
branches:
- main
jobs:
php-coding-style:
name: Check PHP coding style
runs-on: ubuntu-latest
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: mbstring, zip
tools: composer:2, php-cs-fixer:3
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Check PHP coding style
run: php-cs-fixer fix --config=./.php-cs-fixer.dist.php --dry-run --using-cache=no --diff --show-progress=dots --verbose --no-interaction --ansi
php-syntax:
name: Check PHP syntax
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "5.3"
- "8.4"
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: opcache
tools: none
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Check PHP syntax
uses: mlocati/check-php-syntax@v1
with:
include: |
bin/export-plural-rules
bin/import-cldr-data
exclude: |
.php-cs-fixer.dist.php
fail-on-warnings: true
phpunit:
name: Run PHPUnit tests
needs:
- php-coding-style
- php-syntax
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
include:
- os: windows-latest
php-version: "5.6"
- os: windows-latest
php-version: "7.4"
- os: windows-latest
php-version: "8.4"
runs-on: ${{ matrix.os }}
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Install Composer dependencies
run: composer update --no-progress --no-suggest --optimize-autoloader --ansi --no-interaction
-
name: Build CLDR data
run: php ./bin/import-cldr-data ${{ env.BUILD_CLDR_VERSION }}
-
name: Run PHPUnit
run: composer --no-interaction run-script test
commit:
name: Commit CLDR data
runs-on: ubuntu-latest
needs: phpunit
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: none
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Build CLDR data
run: php ./bin/import-cldr-data ${{ env.BUILD_CLDR_VERSION }}
-
name: Check changes
id: check-changes
run: |
git add --all src/cldr-data
if git diff-index --name-status --exit-code HEAD src/cldr-data; then
echo 'No changes detected.'
else
echo 'Changes detected.'
echo 'commit=yes' >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.check-changes.outputs.commit == 'yes'
run: |
git config --local user.name 'GitHub Actions'
git config --local user.email noreply@github.com
git commit -m 'Update CLDR data'
git push