Files
2026-11-11 14:34:25 -05:00

136 lines
4.7 KiB
YAML

name: Tests
on:
push:
branches:
- "2.0-develop"
pull_request:
branches:
- "2.0-develop"
concurrency:
group: tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-8.4-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-8.4-
- uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: 8.4
extensions: bcmath, curl, gd, intl, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: cp .env.ci .env
- run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
- run: npm ci
- run: vendor/bin/pint --test --parallel --cache-file=.pint.cache app bootstrap/app.php bootstrap/tests.php config database routes tests
- run: vendor/bin/rector --dry-run --no-progress-bar
- run: vendor/bin/phpstan analyse --no-progress --memory-limit=2G
- run: php -d variables_order=EGPCS vendor/bin/pest --type-coverage --min=100
env:
__PEST_PLUGIN_ENV: 1
# SDK types and icons are current, tsc and oxlint.
- run: npm run api:check
frontend:
name: Frontend
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# SDK tests exercise the PHP extension OpenAPI generator.
- uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: 8.4
extensions: mbstring
coverage: none
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
- run: npm run build:vite
tests:
name: PHP ${{ matrix.php }} · ${{ matrix.database }}
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# Every supported PHP and database version, paired rather than crossed:
# differences come from the database far more often than from PHP.
include:
- php: "8.3"
database: mariadb:10.11
- php: "8.3"
database: mysql:8
- php: "8.4"
database: mariadb:11
- php: "8.4"
database: mysql:9
services:
database:
image: ${{ matrix.database }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testing
ports:
- 3306
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
extensions: bcmath, curl, gd, intl, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- run: cp .env.ci .env
- run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
- run: vendor/bin/pest --bootstrap vendor/autoload.php tests/Unit
env:
DB_HOST: UNIT_NO_DB
- run: vendor/bin/pest tests/Integration
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
DB_USERNAME: root
- run: composer docs:openapi:verify
if: matrix.database == 'mysql:8'
env:
APP_ENV: testing
CACHE_STORE: array
PTERODACTYL_EXTENSIONS_ENABLED: 'false'
DB_PORT: ${{ job.services.database.ports[3306] }}
DB_USERNAME: root