Skip to content

Commit

Permalink
Enhancement: Split compiling and testing Phar
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Feb 4, 2024
1 parent d09ea05 commit 6159204
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
97 changes: 56 additions & 41 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand All @@ -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"

Expand All @@ -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"

Expand All @@ -239,7 +214,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"

dependencies:
- "locked"
Expand All @@ -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"

Expand All @@ -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"
Expand Down Expand Up @@ -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"

0 comments on commit 6159204

Please sign in to comment.