CI #113
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: CI | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| jobs: | |
| phpunit: | |
| name: PHPUnit (PHP ${{ matrix.php }} - ${{ matrix.operating-system }}) | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| operating-system: [ ubuntu-latest, windows-latest ] | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| - if: steps.checkout.outcome == 'failure' | |
| uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer:v2 | |
| coverage: none | |
| - uses: ramsey/composer-install@v4 | |
| - run: vendor/bin/phpunit tests | |
| e2e-test: | |
| name: E2E Tests (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| - if: steps.checkout.outcome == 'failure' | |
| uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer:v2 | |
| coverage: none | |
| - uses: ramsey/composer-install@v4 | |
| - run: vendor/bin/phpunit tests/E2E | |
| integration-test: | |
| name: Integration Test (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| steps: | |
| - id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| - if: steps.checkout.outcome == 'failure' | |
| uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Install plugin dependencies | |
| run: composer install --no-dev | |
| - name: Check advisory package list against Packagist | |
| run: php bin/check-advisory-packages | |
| - name: Create test project | |
| run: | | |
| mkdir -p /tmp/typo3-test | |
| cd /tmp/typo3-test | |
| cat > composer.json << 'EOF' | |
| { | |
| "name": "test/typo3-project", | |
| "require": { | |
| "typo3/cms-core": "12.0.0" | |
| }, | |
| "repositories": [ | |
| { | |
| "type": "path", | |
| "url": "${{ github.workspace }}" | |
| } | |
| ], | |
| "config": { | |
| "allow-plugins": { | |
| "plan2net/typo3-update-check": true, | |
| "typo3/cms-composer-installers": true, | |
| "typo3/class-alias-loader": true | |
| }, | |
| "audit": { | |
| "block-insecure": false | |
| } | |
| } | |
| } | |
| EOF | |
| - name: Install TYPO3 12.0.0 | |
| run: | | |
| cd /tmp/typo3-test | |
| composer install --no-interaction | |
| - name: Install plugin | |
| run: | | |
| cd /tmp/typo3-test | |
| composer require plan2net/typo3-update-check:"@dev" --no-interaction | |
| - name: Test plugin during update | |
| run: | | |
| cd /tmp/typo3-test | |
| set +e | |
| OUTPUT=$(composer require typo3/cms-core:"12.4.20" --no-interaction --dry-run -W -v 2>&1) | |
| set -e | |
| echo "Plugin Output:" | |
| echo "$OUTPUT" | grep -E "(pre-pool-create|TYPO3 core will be updated|Fetching version information|Breaking changes|Security updates|Changes in version)" || echo "No plugin output found" | |
| if echo "$OUTPUT" | grep -q "pre-pool-create: Plan2net.*Plugin"; then | |
| echo "✓ Plugin triggered" | |
| else | |
| echo "✗ Plugin not triggered" | |
| exit 1 | |
| fi | |
| if echo "$OUTPUT" | grep -q "TYPO3 core will be updated from"; then | |
| echo "✓ Plugin detected update" | |
| if echo "$OUTPUT" | grep -q "Fetching version information"; then | |
| echo "✓ Plugin fetched version data" | |
| else | |
| echo "✗ Plugin did not fetch version data" | |
| exit 1 | |
| fi | |
| else | |
| echo "ℹ️ Plugin triggered but no update detected" | |
| fi | |
| - name: Test version range update | |
| run: | | |
| cd /tmp/typo3-test | |
| set +e | |
| OUTPUT=$(composer require typo3/cms-core:"^12.4.0" --no-interaction --dry-run -W -v 2>&1) | |
| set -e | |
| if echo "$OUTPUT" | grep -q "pre-pool-create: Plan2net.*Plugin"; then | |
| echo "✓ Plugin triggered for version range" | |
| else | |
| echo "✗ Plugin not triggered for version range" | |
| exit 1 | |
| fi | |
| - name: Test no update scenario | |
| run: | | |
| cd /tmp/typo3-test | |
| set +e | |
| OUTPUT=$(composer install --dry-run -v 2>&1) | |
| set -e | |
| if echo "$OUTPUT" | grep -q "TYPO3 core will be updated from"; then | |
| echo "✗ Plugin incorrectly detected update" | |
| exit 1 | |
| else | |
| echo "✓ Plugin correctly ignored no-update scenario" | |
| fi | |
| - name: Test manual check command | |
| run: | | |
| cd /tmp/typo3-test | |
| OUTPUT=$(composer typo3:check-updates 12.4.14 12.4.15 2>&1) | |
| echo "Command Output:" | |
| echo "$OUTPUT" | |
| if echo "$OUTPUT" | grep -q "Changes in version 12.4.15"; then | |
| echo "✓ Command showed version changes" | |
| else | |
| echo "✗ Command did not show version changes" | |
| exit 1 | |
| fi | |
| if echo "$OUTPUT" | grep -q "Security updates found"; then | |
| echo "✓ Command showed security updates" | |
| else | |
| echo "✗ Command did not show security updates" | |
| exit 1 | |
| fi | |
| if echo "$OUTPUT" | grep -qE "CVE-[0-9]+-[0-9]+ +\((critical|high|medium|low)\)"; then | |
| echo "✓ Command showed CVE with severity" | |
| else | |
| echo "✗ Command did not show CVE with severity" | |
| exit 1 | |
| fi | |
| php-cs-fixer: | |
| name: PHP CS Fixer | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| - if: steps.checkout.outcome == 'failure' | |
| uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: latest | |
| tools: composer:v2 | |
| coverage: none | |
| - uses: ramsey/composer-install@v4 | |
| - run: vendor/bin/php-cs-fixer fix --dry-run --diff | |
| phpstan: | |
| name: PHPStan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v6 | |
| - if: steps.checkout.outcome == 'failure' | |
| uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: latest | |
| tools: composer:v2 | |
| coverage: none | |
| - uses: ramsey/composer-install@v4 | |
| - run: vendor/bin/phpstan analyse |