From 07bdd70f2459de22ac2aaad94133ffee810c9f0e Mon Sep 17 00:00:00 2001 From: HorstOeko Date: Tue, 15 Oct 2024 18:08:21 +0200 Subject: [PATCH] Added PHP Lint in build.ci.yml --- .github/workflows/build.ci.yml | 224 +++++++++++++++++---------------- 1 file changed, 115 insertions(+), 109 deletions(-) diff --git a/.github/workflows/build.ci.yml b/.github/workflows/build.ci.yml index f882944..204a6b2 100644 --- a/.github/workflows/build.ci.yml +++ b/.github/workflows/build.ci.yml @@ -1,109 +1,115 @@ -name: Continuous Integration - -on: - push: - tags-ignore: - - "**" - branches: - - "**" - paths-ignore: - - "**.md" - - ".github/**" - - "examples/**" - pull_request: - types: - - opened - branches: - - "master" - workflow_dispatch: - -jobs: - build: - permissions: write-all - runs-on: ${{ matrix.operating-system }} - strategy: - matrix: - operating-system: ["ubuntu-22.04", "ubuntu-24.04"] - phpversion: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] - - steps: - - name: Checkout Sources - uses: actions/checkout@v4 - - - name: Setup PHP with PECL extension - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.phpversion }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick, json, xdebug - coverage: xdebug - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.phpversion }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.phpversion }}-composer- - - - name: Install composer dependencies - run: | - composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - composer install - - - name: Prepare Directories - run: | - mkdir build/builddoc - mkdir build/doc - mkdir build/coverage - mkdir build/coverage-html - mkdir build/logs - mkdir build/pdepend - mkdir build/dist - mkdir build/phpdoc - - - name: Run PHPLOC - continue-on-error: true - run: | - vendor/bin/phploc --count-tests --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src tests - - - name: Run PDEPEND - continue-on-error: true - run: | - vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --jdepend-chart=build/pdepend/dependencies.svg --overview-pyramid=build/pdepend/overview-pyramid.svg src - - - name: Run PHPMD - continue-on-error: true - run: | - vendor/bin/phpmd src xml build/phpmd.xml --reportfile build/logs/pmd.xml --exclude src/entities/ - vendor/bin/phpmd src github build/phpmd.xml --exclude src/entities/ - - - name: Run PHPCS - continue-on-error: true - run: | - vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=build/phpcsrules.xml --extensions=php --ignore=autoload.php src tests - - - name: Run PHPSTAN - continue-on-error: true - run: | - vendor/bin/phpstan analyze -c build/phpstan.neon --autoload-file=vendor/autoload.php --no-interaction --no-progress --error-format=checkstyle > build/logs/checkstyle_phpstan.xml - - - name: Run PHPCPD - continue-on-error: true - run: | - vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude src/entities/ src - - - name: Run Tests (PHPUnit) - run: | - vendor/bin/phpunit --stop-on-failure --configuration build/phpunit.xml - env: - XDEBUG_MODE: coverage - - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: github.event_name != 'pull_request' - with: - files: "build/logs/junit.xml" +name: Continuous Integration + +on: + push: + tags-ignore: + - "**" + branches: + - "**" + paths-ignore: + - "**.md" + - ".github/**" + - "examples/**" + pull_request: + types: + - opened + branches: + - "master" + workflow_dispatch: + +jobs: + build: + permissions: write-all + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ["ubuntu-22.04", "ubuntu-24.04"] + phpversion: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] + + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + + - name: Setup PHP with PECL extension + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.phpversion }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick, json, xdebug + coverage: xdebug + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.phpversion }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.phpversion }}-composer- + + - name: Install composer dependencies + run: | + composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + composer install + + - name: Prepare Directories + run: | + mkdir build/builddoc + mkdir build/doc + mkdir build/coverage + mkdir build/coverage-html + mkdir build/logs + mkdir build/pdepend + mkdir build/dist + mkdir build/phpdoc + + - name: Run Lint + run: | + for afile in $(find . -type f -name '*.php' -path './src*/*' -print); do + php -l $afile + done + + - name: Run PHPLOC + continue-on-error: true + run: | + vendor/bin/phploc --count-tests --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src tests + + - name: Run PDEPEND + continue-on-error: true + run: | + vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --jdepend-chart=build/pdepend/dependencies.svg --overview-pyramid=build/pdepend/overview-pyramid.svg src + + - name: Run PHPMD + continue-on-error: true + run: | + vendor/bin/phpmd src xml build/phpmd.xml --reportfile build/logs/pmd.xml --exclude src/entities/ + vendor/bin/phpmd src github build/phpmd.xml --exclude src/entities/ + + - name: Run PHPCS + continue-on-error: true + run: | + vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=build/phpcsrules.xml --extensions=php --ignore=autoload.php src tests + + - name: Run PHPSTAN + continue-on-error: true + run: | + vendor/bin/phpstan analyze -c build/phpstan.neon --autoload-file=vendor/autoload.php --no-interaction --no-progress --error-format=checkstyle > build/logs/checkstyle_phpstan.xml + + - name: Run PHPCPD + continue-on-error: true + run: | + vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude src/entities/ src + + - name: Run Tests (PHPUnit) + run: | + vendor/bin/phpunit --stop-on-failure --configuration build/phpunit.xml + env: + XDEBUG_MODE: coverage + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: github.event_name != 'pull_request' + with: + files: "build/logs/junit.xml"