Skip to content

allow players to customize the hue of their pets' hat styles! (#204) #564

allow players to customize the hue of their pets' hat styles! (#204)

allow players to customize the hue of their pets' hat styles! (#204) #564

Workflow file for this run

name: Run unit tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for Repository Pattern Usage
run: |
echo "Checking for uses of Doctrine Repositories..."
# Search for ServiceEntityRepository usage
SERVICE_REPO_FILES=$(grep -r "ServiceEntityRepository" src/ --include="*.php" -l || true)
# Search for repositoryClass configuration
REPO_CLASS_FILES=$(grep -r "repositoryClass:" . --include="*.php" -l || true)
# Check if any violations were found
VIOLATIONS_FOUND=false
if [ ! -z "$SERVICE_REPO_FILES" ]; then
echo "❌ Files containing 'ServiceEntityRepository' found:"
echo "$SERVICE_REPO_FILES"
VIOLATIONS_FOUND=true
fi
if [ ! -z "$REPO_CLASS_FILES" ]; then
echo "❌ Files containing 'repositoryClass:' found:"
echo "$REPO_CLASS_FILES"
VIOLATIONS_FOUND=true
fi
if [ "$VIOLATIONS_FOUND" = true ]; then
echo ""
echo "🧚‍♀️ Hey, listen! Doctrine repository usage detected. Please remove these files/configurations."
echo "Use direct entity manager queries or domain-specific query builders instead."
exit 1
fi
- name: Check License Headers
uses: apache/skywalking-eyes/header@main
with:
config: .github/license-eye-config.yaml
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: intl, mbstring, calendar, ctype, curl, iconv, json, pdo
tools: composer, phpunit
- name: Get changed PHP files
id: changed-files
run: |
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.php$' | tr '\n' ' ' || true)
echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT
- name: Check syntax of changed PHP files
if: steps.changed-files.outputs.files != ''
run: |
# If no PHP files changed, we're done
if [ -z "$CHANGED_FILES" ]; then
echo "No PHP files changed in this PR."
exit 0
fi
# Check syntax of each changed file
echo "$CHANGED_FILES" | xargs -n1 php -l
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist
- name: Run Composer Audit
run: composer audit
- name: Check PSR-4
run: composer php-cs-fixer-dry-run
- name: PHPStan
run: php vendor/bin/phpstan analyse
- name: Test!
run: vendor/bin/phpunit --exclude-group requiresDatabase