diff --git a/.github/workflows/check-files.yml b/.github/workflows/check-files.yml index e07b24b94f1..5c2ea97a0c2 100644 --- a/.github/workflows/check-files.yml +++ b/.github/workflows/check-files.yml @@ -34,10 +34,10 @@ on: description: "Count changed PHPStan files" value: ${{ jobs.check.outputs.phpstan }} phpunit-test: - description: "Count changed PhpUnit test files" + description: "Count changed PHPUnit test files" value: ${{ jobs.check.outputs.phpunit-test }} phpunit: - description: "Count changed PhpUnit files" + description: "Count changed PHPUnit files" value: ${{ jobs.check.outputs.phpunit }} # Allow manually triggering the workflow. workflow_dispatch: diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index 9da34839476..25221ba79c3 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -33,5 +33,20 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-* + - name: Restore result cache + uses: actions/cache/restore@v4 + with: + path: .php-cs-fixer.cache + key: php-cs-fixer-result-cache-${{ github.run_id }} + restore-keys: | + php-cs-fixer-result-cache- + - name: PHP-CS-Fixer run: php vendor/bin/php-cs-fixer fix --diff --dry-run + + - name: Save result cache + uses: actions/cache/save@v4 + if: always() + with: + path: .php-cs-fixer.cache + key: php-cs-fixer-result-cache-${{ github.run_id }} diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index b118cc8f66d..ef46645a889 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -33,5 +33,20 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-* + - name: Restore result cache + uses: actions/cache/restore@v4 + with: + path: .phpcs.result.cache + key: phpcs-result-cache-${{ github.run_id }} + restore-keys: | + phpcs-result-cache- + - name: PHPCodeSniffer - run: php vendor/bin/phpcs -s -p --report=full --standard=.phpcs.dist.xml + run: php vendor/bin/phpcs -s -p --cache=.phpcs.result.cache --report=full --standard=.phpcs.dist.xml + + - name: Save result cache + uses: actions/cache/save@v4 + if: always() + with: + path: .phpcs.result.cache + key: phpcs-result-cache-${{ github.run_id }} diff --git a/.github/workflows/phpmd.yml b/.github/workflows/phpmd.yml index c9ad879aaec..15fb8e2c70a 100644 --- a/.github/workflows/phpmd.yml +++ b/.github/workflows/phpmd.yml @@ -28,5 +28,20 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-* + - name: Restore result cache + uses: actions/cache/restore@v4 + with: + path: .phpmd.result-cache.php + key: phpmd-result-cache-${{ github.run_id }} + restore-keys: | + phpmd-result-cache- + - name: PHPMD - run: php vendor/bin/phpmd app/code/core/Mage/ github .phpmd.dist.xml --baseline-file .phpmd.dist.baseline.xml + run: php vendor/bin/phpmd app/code/core/Mage/ github .phpmd.dist.xml --cache --baseline-file .phpmd.dist.baseline.xml + + - name: Save result cache + uses: actions/cache/save@v4 + if: always() + with: + path: .phpmd.result-cache.php + key: phpmd-result-cache-${{ github.run_id }} diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 570bdc49075..e445925e1d8 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -48,4 +48,4 @@ jobs: if: always() with: path: .phpstan.cache - key: phpstan-result-cache-${{ github.run_id }} \ No newline at end of file + key: phpstan-result-cache-${{ github.run_id }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 19bca6b856c..52afa426f3f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -86,9 +86,24 @@ jobs: --enable_charts 'yes' \ --skip_url_validation 'yes' + - name: Restore result cache + uses: actions/cache/restore@v4 + with: + path: .phpunit.result.cache + key: phpunit-result-cache-${{ matrix.php-versions }}-${{ matrix.mysql-version }}-${{ github.run_id }} + restore-keys: | + phpunit-result-cache- + - name: Run phpUnit run: php vendor/bin/phpunit --configuration .phpunit.dist.xml + - name: Save result cache + uses: actions/cache/save@v4 + if: always() + with: + path: .phpunit.result.cache + key: phpunit-result-cache-${{ matrix.php-versions }}-${{ matrix.mysql-version }}-${{ github.run_id }} + - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v2 if: always() @@ -96,18 +111,10 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} files: tests/logging/*.xml - - name: prepare SonarCloud Scan Data - if: ${{ (matrix.php-versions == '7.4') && (matrix.mysql-version == '5.7') }} - run: | - head tests/coverage/clover.xml - sed -i 's@'$GITHUB_WORKSPACE'/@/github/workspace/@g' tests/logging/junit.xml - sed -i 's@'$GITHUB_WORKSPACE'/@/github/workspace/@g' tests/coverage/clover.xml - head ./tests/coverage/clover.xml - - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master continue-on-error: true - if: ${{ (matrix.php-versions == '7.4') && (matrix.mysql-version == '5.7') }} && SONAR_TOKEN + if: ${{ (matrix.php-versions == '8.1') && (matrix.mysql-version == '5.7') }} && SONAR_TOKEN with: args: > -Dproject.settings=tests/sonar-project.properties diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index f71000bb32d..131f5d19fa5 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -33,5 +33,20 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-* + - name: Restore result cache + uses: actions/cache/restore@v4 + with: + path: .rector.result.cache + key: rector-result-cache-${{ github.run_id }} + restore-keys: | + rector-result-cache- + - name: Rector run: php vendor/bin/rector process --config .rector.php --dry-run + + - name: Save result cache + uses: actions/cache/save@v4 + if: always() + with: + path: .rector.result.cache + key: rector-result-cache-${{ github.run_id }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f010016d2e0..33afae335e8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -121,16 +121,14 @@ jobs: rector: name: Rector - needs: [check, php-cs-fixer] + needs: [check, php-cs-fixer, phpstan] if: | needs.check.outputs.php > 0 || needs.check.outputs.workflow > 0 uses: ./.github/workflows/rector.yml - # DOES NOT run by default - # runs on schedule or when workflow or unit tests changed unit_tests: - name: Unit Tests (OpenMage) + name: PHPUnit Tests needs: [check, php-cs-fixer] if: | needs.check.outputs.php > 0 || diff --git a/.gitignore b/.gitignore index bdc74481e85..494442c9841 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,6 @@ app/etc/includes/ddev.xhgui.php # local development .localdev + +# rector +.rector.result.cache diff --git a/.rector.php b/.rector.php index f10315c5553..27f7c54cce6 100644 --- a/.rector.php +++ b/.rector.php @@ -1,6 +1,8 @@ withCache( + cacheDirectory: '.rector.result.cache', + cacheClass: FileCacheStorage::class, + ) ->withPhpSets( php74: true, )