Skip to content

test: remove backup test files and obsolete test classes #47

test: remove backup test files and obsolete test classes

test: remove backup test files and obsolete test classes #47

name: Codestyle and Unittest
on:
push:
branches:
- '*'
- '!master'
- '!develop'
paths:
- "**.php"
workflow_dispatch:
jobs:
# 1. Job: Statische Analyse (Lint, Stan, CodeSniffer)
# Diese laufen zusammen, da sie keine Datenbank benötigen.
static-analysis:
name: PHP Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer
- name: Run PHP Linter
run: composer run-script phplint
- name: Run PHP Stan
run: composer run-script phpstan
- name: Run PHP Codesniffer
run: composer run-script phpcs
- name: Notify Failure
if: failure()
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
details: Static Analysis (Lint/Stan/CS) failed.
webhookUrl: ${{ secrets.WEBHOOK_DISCORD_URL }}
# 2. Job: Tests (Unit & Functional)
# Dieser Job benötigt die MariaDB Service-Container
tests:
name: PHP Tests
needs: static-analysis
runs-on: ubuntu-latest
services:
database-testing:
image: mariadb:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db
MYSQL_USER: dev
MYSQL_PASSWORD: dev
ports:
- 3306:3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
env:
DB_DATABASE: db
DB_USERNAME: dev
DB_PASSWORD: dev
DB_HOST: 127.0.0.1
DB_PORT: 3306
APP_ENV: action
steps:
- uses: actions/checkout@v6.0.2
- name: Setup PHP and Composer
uses: ./.github/actions/setup-php-composer
- name: Run Tests
run: ./vendor/bin/pest --configuration=phpunit.xml --compact
env:
APP_ENV: action
DB_HOST: 127.0.0.1
- name: Notify Failure
if: failure()
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
details: Integration Tests failed.
webhookUrl: ${{ secrets.WEBHOOK_DISCORD_URL }}
# 3. Job: Abschluss-Benachrichtigung
final-status:
name: Final Status Message
needs: [ static-analysis, tests ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check Info Success
if: ${{ needs.static-analysis.result == 'success' && needs.tests.result == 'success' }}
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: info
details: Checks successfully executed on API.
webhookUrl: ${{ secrets.WEBHOOK_DISCORD_URL }}
- name: Check Info Failure
if: ${{ needs.static-analysis.result != 'success' || needs.tests.result != 'success' }}
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
details: >-
${{ format('❌ Incorrect checks during the API check. [View Logs](https://github.com/{0}/actions/runs/{1})',
github.repository,
github.run_id) }}
webhookUrl: ${{ secrets.WEBHOOK_DISCORD_URL }}