Merge pull request #84 from keyqcloud/fix/jwt-cors-preflight #487
This file contains hidden or 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
| name: PHP Composer | |
| on: | |
| push: | |
| branches: [ "master", "feature/**" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Unit tests (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3'] | |
| services: | |
| mariadb: | |
| image: mariadb:10.5.29 | |
| env: | |
| MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes" | |
| MARIADB_DATABASE: kytedev | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mysqli, curl, mbstring, json, bz2 | |
| coverage: none | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php${{ matrix.php }}- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Composer audit (security advisories) | |
| run: composer audit --no-dev | |
| - name: Run unit tests | |
| env: | |
| KYTE_DB_HOST: 127.0.0.1 | |
| KYTE_DB_USERNAME: root | |
| KYTE_DB_PASSWORD: "" | |
| KYTE_DB_DATABASE: kytedev | |
| KYTE_DB_CHARSET: utf8 | |
| run: vendor/bin/phpunit --testsuite unit | |
| static-analysis: | |
| name: PHPStan static analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up PHP 8.2 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| extensions: mysqli, curl, mbstring, json, bz2 | |
| coverage: none | |
| - name: Cache Composer packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php8.2-phpstan-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php8.2-phpstan- | |
| ${{ runner.os }}-php8.2- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHPStan | |
| # Level 1 with a baseline of the existing codebase's pre-existing | |
| # findings (phpstan-baseline.neon). Going forward this enforces | |
| # "no new level-1 violations"; the baseline shrinks as legacy | |
| # patterns get cleaned up over time. | |
| run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress |