name: CI on: push: branches: [ "**" ] pull_request: jobs: lint: name: PHP Lint runs-on: ubuntu-latest strategy: matrix: php: [ "7.4", "8.2" ] steps: - uses: actions/checkout@v4 - name: Setup PHP ${{ matrix.php }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: pdo, pdo_mysql, curl, mbstring, json coverage: none - name: Syntax check all PHP files run: | set -e find . -name '*.git' -prune -o -name '*.php' -print | while read -r f; do php -l "$f" done - name: Validate language files run: | php -r ' $de = require "lang/de.php"; $en = require "lang/en.php"; if (!is_array($de) || !is_array($en)) { fwrite(STDERR, "Bad lang file\n"); exit(1); } $missingEn = array_diff(array_keys($de), array_keys($en)); $missingDe = array_diff(array_keys($en), array_keys($de)); if ($missingEn || $missingDe) { fwrite(STDERR, "Fehlend in en: " . implode(", ", $missingEn) . "\n"); fwrite(STDERR, "Fehlend in de: " . implode(", ", $missingDe) . "\n"); exit(1); } echo "lang OK (" . count($de) . " Schluessel)\n";' - name: Check that every used translation key exists run: | php -r ' $de = require "lang/de.php"; $missing = []; $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(".", FilesystemIterator::SKIP_DOTS)); foreach ($it as $file) { $path = $file->getPathname(); if (substr($path, -4) !== ".php") continue; if (strpos($path, "/vendor/") !== false || strpos($path, "/tools/") !== false) continue; preg_match_all("/__\(\s*\x27([a-z0-9_]+)\x27/", file_get_contents($path), $m); foreach ($m[1] as $key) { if (!isset($de[$key]) && substr($key, -1) !== "_") { $missing[$key] = $path; } } } if ($missing) { foreach ($missing as $key => $path) { fwrite(STDERR, "Unbekannter Schluessel $key in $path\n"); } exit(1); } echo "Alle verwendeten Schluessel vorhanden\n";' test: name: Unit Tests & Static Analysis runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup PHP 8.2 uses: shivammathur/setup-php@v2 with: php-version: "8.2" extensions: pdo, pdo_mysql, curl, mbstring, json tools: composer coverage: none - name: Install dependencies run: composer install --no-interaction --no-progress - name: PHPUnit run: vendor/bin/phpunit - name: PHPStan run: vendor/bin/phpstan analyse --no-progress