From 6159204753be47825671e34d7bddf6b3ce9f7a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 4 Feb 2024 15:38:49 +0100 Subject: [PATCH] Enhancement: Split compiling and testing Phar --- .github/settings.yml | 2 +- .github/workflows/integrate.yaml | 97 ++++++++++++++++++-------------- 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index a79478b6..5dac1deb 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -16,8 +16,8 @@ branches: checks: - context: "Code Coverage (7.5.0, 7.4, highest)" - context: "Coding Standards (7.4, locked)" - - context: "Compile Phar (8.1, locked)" - context: "Dependency Analysis (7.4, locked)" + - context: "Phar (8.1, locked)" - context: "Refactoring (7.4, locked)" - context: "Security Analysis (7.4, locked)" - context: "Static Code Analysis (7.4, locked)" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 06c09ab6..5a7a6cea 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -148,8 +148,8 @@ jobs: - name: "Run friendsofphp/php-cs-fixer" run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --show-progress=dots --verbose" - compile-phar: - name: "Compile Phar" + dependency-analysis: + name: "Dependency Analysis" runs-on: "ubuntu-latest" @@ -158,14 +158,11 @@ jobs: strategy: matrix: php-version: - - "8.1" + - "7.4" dependencies: - "locked" - env: - PHPUNIT_SLOW_TEST_DETECTOR_PHAR: ".build/phar/phpunit-slow-test-detector.phar" - steps: - name: "Checkout" uses: "actions/checkout@v4.1.1" @@ -175,13 +172,15 @@ jobs: with: coverage: "none" extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" - ini-values: "memory_limit=-1, phar.readonly=0" php-version: "${{ matrix.php-version }}" tools: "phive" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.0" @@ -192,45 +191,21 @@ jobs: key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" - - name: "Remove incompatible dependencies with composer" - run: "composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress" - - - name: "Remove phpunit/phpunit with composer" - run: "composer remove phpunit/phpunit --ansi --no-interaction --ignore-platform-reqs --no-progress" - - name: "Install ${{ matrix.dependencies }} dependencies with composer" uses: "ergebnis/.github/actions/composer/install@1.9.0" with: dependencies: "${{ matrix.dependencies }}" - - name: "Remove git placeholder configuration with jq" - run: "echo $(cat box.json | jq 'del(.git)') > box.json" - - name: "Install dependencies with phive" uses: "ergebnis/.github/actions/phive/install@1.9.0" with: trust-gpg-keys: "0x2DF45277AEF09A2F,0x033E5F8D801A2F8D" - - name: "Validate configuration for humbug/box" - run: ".phive/box validate box.json --ansi" - - - name: "Compile phpunit-slow-test-detector.phar with humbug/box" - run: ".phive/box compile --ansi --config=box.json" - - - name: "Show info about phpunit-slow-test-detector.phar with humbug/box" - run: ".phive/box info ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }} --ansi --list" - - - name: "Install ${{ matrix.dependencies }} dependencies for running phar tests with composer" - uses: "ergebnis/.github/actions/composer/install@1.9.0" - with: - dependencies: "${{ matrix.dependencies }}" - working-directory: "test/Phar/Version10/" - - - name: "Run phar tests with phpunit/phpunit" - run: "test/Phar/Version10/vendor/bin/phpunit --colors=always --configuration=test/Phar/Version10/phpunit.xml" + - name: "Run maglnet/composer-require-checker" + run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose" - dependency-analysis: - name: "Dependency Analysis" + phar: + name: "Phar" runs-on: "ubuntu-latest" @@ -239,7 +214,7 @@ jobs: strategy: matrix: php-version: - - "7.4" + - "8.1" dependencies: - "locked" @@ -253,15 +228,13 @@ jobs: with: coverage: "none" extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + ini-values: "memory_limit=-1, phar.readonly=0" php-version: "${{ matrix.php-version }}" tools: "phive" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" - - name: "Validate composer.json and composer.lock" - run: "composer validate --ansi --strict" - - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.0" @@ -272,18 +245,41 @@ jobs: key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + - name: "Remove incompatible dependencies with composer" + run: "composer remove ergebnis/php-cs-fixer-config psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress" + + - name: "Remove phpunit/phpunit with composer" + run: "composer remove phpunit/phpunit --ansi --no-interaction --ignore-platform-reqs --no-progress" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" uses: "ergebnis/.github/actions/composer/install@1.9.0" with: dependencies: "${{ matrix.dependencies }}" + - name: "Remove git placeholder configuration with jq" + run: "echo $(cat box.json | jq 'del(.git)') > box.json" + - name: "Install dependencies with phive" uses: "ergebnis/.github/actions/phive/install@1.9.0" with: trust-gpg-keys: "0x2DF45277AEF09A2F,0x033E5F8D801A2F8D" - - name: "Run maglnet/composer-require-checker" - run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose" + - name: "Validate configuration for humbug/box" + run: ".phive/box validate box.json --ansi" + + - name: "Compile phpunit-slow-test-detector.phar with humbug/box" + run: ".phive/box compile --ansi --config=box.json" + + - name: "Show info about phpunit-slow-test-detector.phar with humbug/box" + run: ".phive/box info .build/phar/phpunit-slow-test-detector.phar --ansi --list" + + - name: "Upload Phar" + uses: "actions/upload-artifact@4.3.0" + with: + name: "phpunit-slow-test-detector-phar" + overwrite: true + path: ".build/phar/phpunit-slow-test-detector.phar" + retention-days: 1 refactoring: name: "Refactoring" @@ -591,3 +587,22 @@ jobs: - name: "Run end-to-end tests with phpunit/phpunit:11.0.x-dev" if: "matrix.phpunit-version == '11.0.x-dev'" run: "vendor/bin/phpunit --colors=always --configuration=test/EndToEnd/Version11/phpunit.xml" + + - name: "Download Phar" + if: "matrix.phpunit-version == '10.0.0'" + uses: "actions/download-artifact@4.3.0" + with: + name: "phpunit-slow-test-detector-phar" + path: ".build/phar/phpunit-slow-test-detector.phar" + + - name: "Install ${{ matrix.dependencies }} dependencies for running phar tests with composer" + if: "matrix.phpunit-version == '10.0.0'" + uses: "ergebnis/.github/actions/composer/install@1.9.0" + with: + dependencies: "${{ matrix.dependencies }}" + working-directory: "test/Phar/Version10/" + + - name: "Run phar tests with phpunit/phpunit" + if: "matrix.phpunit-version == '10.0.0'" + run: "test/Phar/Version10/vendor/bin/phpunit --colors=always --configuration=test/Phar/Version10/phpunit.xml" +