Skip to content

[TASK] Update eslint to v9.34.0 #726

[TASK] Update eslint to v9.34.0

[TASK] Update eslint to v9.34.0 #726

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- main
permissions: read-all
jobs:
prepare:
name: Prepare workflow
uses: eliashaeussler/.github/.github/workflows/pull-request.yaml@main
assets:
name: Verify asset integrity
runs-on: ubuntu-latest
needs: prepare
if: needs.prepare.outputs.continue == 'true'
outputs:
modified: ${{ steps.commit.outputs.changes_detected || 'false' }}
steps:
- uses: actions/checkout@v5
with:
token: ${{ secrets.REBUILD_ASSETS_TOKEN }}
fetch-depth: 0
# Preconditions
- name: Check modified assets
id: check
run: |
if git diff --name-only ${{ github.sha }}~1 ${{ github.sha }} | grep -q '^Resources/Private/Frontend/'; then
echo "skip_assets=false" >> $GITHUB_OUTPUT
else
echo "skip_assets=true" >> $GITHUB_OUTPUT
fi
# Prepare environment
- name: Setup Node
uses: actions/setup-node@v4
if: ${{ steps.check.outputs.skip_assets != 'true' }}
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'Resources/Private/Frontend/package-lock.json'
# Install Frontend dependencies
- name: Install Frontend dependencies
if: ${{ steps.check.outputs.skip_assets != 'true' }}
run: npm --prefix Resources/Private/Frontend ci
# Re-create Frontend dist files
- name: Re-create dist files
if: ${{ steps.check.outputs.skip_assets != 'true' }}
run: npm --prefix Resources/Private/Frontend run build
- name: Fail on integrity mismatch
if: ${{ github.actor != 'renovate[bot]' && steps.check.outputs.skip_assets != 'true' }}
run: |
git add Resources/Public
git diff --exit-code --staged Resources/Public
# Update PR
- uses: stefanzweifel/git-auto-commit-action@v6
if: ${{ github.actor == 'renovate[bot]' && steps.check.outputs.skip_assets != 'true' }}
id: commit
with:
commit_message: '[TASK] Automatically rebuild frontend assets'
commit_author: 'Elias Häußler <elias@haeussler.dev>'
commit_user_name: 'Elias Häußler'
commit_user_email: 'elias@haeussler.dev'
cgl:
name: CGL
runs-on: ubuntu-latest
if: ${{ needs.assets.outputs.modified == 'false' }}
needs: assets
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2, cs2pr
coverage: none
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'Resources/Private/Frontend/package-lock.json'
# Validation
- name: Validate composer.json
run: composer validate --strict
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
# Analyze
- name: Analyze dependencies
run: composer cgl analyze:dependencies
# Linting
- name: Lint composer.json
run: composer cgl lint:composer
- name: Lint Editorconfig
run: composer cgl lint:editorconfig
- name: Lint PHP
run: composer cgl lint:php -- --format=checkstyle | cs2pr
- name: Lint TypoScript
run: composer cgl lint:typoscript
# SCA
- name: SCA PHP
run: composer cgl sca:php -- --error-format github
# Install Frontend dependencies
- name: Install Frontend dependencies
run: npm --prefix Resources/Private/Frontend ci
# Frontend linting
- name: Lint SCSS
run: npm --prefix Resources/Private/Frontend run lint:scss
- name: Lint TypeScript
run: npm --prefix Resources/Private/Frontend run lint:ts
# Migration
- name: Rector migration
run: composer cgl migration:rector -- --dry-run
# Documentation
- name: Check documentation build
run: |
mkdir -p .Build/docs
composer docs:build -- --no-progress --fail-on-log
crowdin:
name: Synchronize with Crowdin
runs-on: ubuntu-latest
if: ${{ needs.assets.outputs.modified == 'false' && github.ref_name == 'main' }}
needs: assets
steps:
- uses: actions/checkout@v5
- name: Upload sources
uses: crowdin/github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: '.crowdin.yaml'
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
crowdin_branch_name: 'main'
tests:
name: Tests (PHP ${{ matrix.php-version }}, TYPO3 ${{ matrix.typo3-version }} & ${{ matrix.dependencies }} dependencies)
if: ${{ needs.assets.outputs.modified == 'false' }}
needs: assets
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.2", "8.3", "8.4"]
typo3-version: ["12.4", "13.4"]
dependencies: ["highest", "lowest"]
# Enforce PHPUnit ^11.5 for TYPO3 13.4 & lowest dependencies
# since it adds support for doubling readonly classes (SiteFinder in our case)
include:
- php-version: "8.2"
typo3-version: "13.4"
dependencies: "lowest"
composer-options: "--with=phpunit/phpunit:^11.5"
- php-version: "8.3"
typo3-version: "13.4"
dependencies: "lowest"
composer-options: "--with=phpunit/phpunit:^11.5"
- php-version: "8.4"
typo3-version: "13.4"
dependencies: "lowest"
composer-options: "--with=phpunit/phpunit:^11.5"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
# Setup DDEV
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
with:
version: '1.24.7'
autostart: false
- name: Configure and start DDEV
run: |
ddev config --project-type=typo3 --php-version=${{ matrix.php-version }} --webimage-extra-packages=
ddev start
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --with=typo3/cms-core:"^${{ matrix.typo3-version }}" ${{ matrix.composer-options }}
# Run tests
- name: Run functional and unit tests
run: |
ddev composer test:functional
ddev composer test:unit
- name: Run acceptance tests
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 10
command: ddev composer test:acceptance
new_command_on_retry: ddev composer test:acceptance -- -g failed
# Save acceptance reports
- uses: actions/upload-artifact@v4
with:
name: acceptance-reports-${{ matrix.php-version }}-${{ matrix.typo3-version }}-${{ matrix.dependencies }}
path: |
.Build/log/acceptance-reports
var/log/typo3_*.log
if: failure()
test-coverage:
name: Test coverage
if: ${{ needs.assets.outputs.modified == 'false' }}
needs: assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
coverage: none
# Setup DDEV
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
with:
version: '1.24.7'
autostart: false
- name: Configure and start DDEV
run: |
ddev config --project-type=typo3
ddev start
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
# Run tests
- name: Run functional and unit tests
run: |
ddev composer test:coverage:functional
ddev composer test:coverage:unit
- name: Run acceptance tests
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 10
command: ddev composer test:coverage:acceptance
- name: Merge coverage reports
run: ddev composer test:coverage:merge
# Upload artifact
- name: Fix coverage path
working-directory: .Build/coverage
run: sed -i 's#/var/www/html#${{ github.workspace }}#g' clover.xml
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: .Build/coverage/clover.xml
retention-days: 7
# Save acceptance reports
- uses: actions/upload-artifact@v4
if: failure()
with:
name: acceptance-reports-coverage
path: |
.Build/log/acceptance-reports
var/log/typo3_*.log
report-coverage:
name: Report test coverage
needs: test-coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
# Download artifact
- name: Download coverage artifact
id: download
uses: actions/download-artifact@v5
with:
name: coverage
# qlty
- name: qlty report
uses: qltysh/qlty-action/coverage@v2
if: env.QLTY_COVERAGE_TOKEN
env:
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: ${{ steps.download.outputs.download-path }}/clover.xml
# Coveralls
- name: Coveralls report
uses: coverallsapp/github-action@v2
with:
file: ${{ steps.download.outputs.download-path }}/clover.xml