CPS-IT/project-builder

View on GitHub
.github/workflows/cgl.yaml

Summary

Maintainability
Test Coverage
name: CGL
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  cgl:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # Prepare environment
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.2
          tools: composer:v2, composer-require-checker, composer-unused, cs2pr
          coverage: none

      # Validation
      - name: Validate composer.json
        run: composer validate

      # Install dependencies
      - name: Install Composer dependencies
        run: composer require --no-progress composer/composer:"^2.1" composer/semver:"^3.0" composer/xdebug-handler:"^3.0"

      # Check Composer dependencies
      - name: Check dependencies
        run: composer-require-checker check --config-file dependency-checker.json
      - name: Reset composer.json
        run: git checkout composer.json composer.lock
      - name: Re-install Composer dependencies
        uses: ramsey/composer-install@v2
      - name: Check for unused dependencies
        run: composer-unused --excludePackage=nyholm/psr7

      # Linting
      - name: Lint composer.json
        run: composer lint:composer
      - name: Lint Editorconfig
        run: composer lint:editorconfig
      - name: Lint JSON
        run: composer lint:json
      - name: Lint PHP
        run: composer lint:php -- --format=checkstyle | cs2pr

      # SCA
      - name: SCA PHP
        run: composer sca:php -- --error-format github

      # Migration
      - name: Rector migration
        run: composer migration:rector -- --dry-run

      # Schema
      - name: Validate JSON schema
        run: composer validate-schema