|
| 1 | +name: Platforms and stable dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + workflow_dispatch: |
| 8 | + workflow_call: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + platforms: |
| 15 | + name: ${{ matrix.os }} / Composer ${{ matrix.composer }} |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + timeout-minutes: 15 |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [ubuntu-24.04, windows-2025, macos-15] |
| 22 | + composer: ['2.10.3', '2'] |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + shell: bash |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 28 | + with: |
| 29 | + persist-credentials: false |
| 30 | + - uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 |
| 31 | + with: |
| 32 | + php-version: '8.5' |
| 33 | + extensions: curl, dom, mbstring, mysqli |
| 34 | + tools: composer:${{ matrix.composer }} |
| 35 | + coverage: none |
| 36 | + - name: Resolve stable packages with the selected Composer library |
| 37 | + env: |
| 38 | + COMPOSER_LINE: ${{ matrix.composer }} |
| 39 | + run: | |
| 40 | + if [[ "$COMPOSER_LINE" == '2.10.3' ]]; then |
| 41 | + composer update --with composer/composer:2.10.3 --no-plugins --no-scripts --no-interaction --no-progress --prefer-dist |
| 42 | + else |
| 43 | + composer update --no-plugins --no-scripts --no-interaction --no-progress --prefer-dist |
| 44 | + fi |
| 45 | + composer validate --strict |
| 46 | + composer check-platform-reqs |
| 47 | + # shellcheck disable=SC2016 # PHP variables must not be expanded by Bash. |
| 48 | + php -r 'require "vendor/autoload.php"; $lock = json_decode(file_get_contents("composer.lock"), true, flags: JSON_THROW_ON_ERROR); foreach (array_merge($lock["packages"], $lock["packages-dev"] ?? []) as $package) { if (Composer\Semver\VersionParser::parseStability($package["version"]) !== "stable" || ($package["dist"]["type"] ?? "") === "path") { throw new RuntimeException("Unstable or local dependency: " . $package["name"]); } }' |
| 49 | + - name: Use an explicitly case-insensitive APFS fixture volume on macOS |
| 50 | + if: runner.os == 'macOS' |
| 51 | + run: | |
| 52 | + hdiutil create -size 256m -fs APFS -volname RuntimeCaseInsensitive "$RUNNER_TEMP/runtime-case.dmg" |
| 53 | + hdiutil attach -nobrowse -mountpoint "$RUNNER_TEMP/runtime-case" "$RUNNER_TEMP/runtime-case.dmg" |
| 54 | + mkdir -p "$RUNNER_TEMP/runtime-case/tmp" |
| 55 | + echo "TMPDIR=$RUNNER_TEMP/runtime-case/tmp" >> "$GITHUB_ENV" |
| 56 | + touch "$RUNNER_TEMP/runtime-case/tmp/CaseProbe" |
| 57 | + test -f "$RUNNER_TEMP/runtime-case/tmp/caseprobe" |
| 58 | + rm "$RUNNER_TEMP/runtime-case/tmp/CaseProbe" |
| 59 | + - name: Exercise portable filesystem and actual Composer relocation contracts |
| 60 | + run: php vendor/bin/phpunit --no-logging --fail-on-skipped --fail-on-warning tests/Platform tests/Unit/PackageDestinationTest.php |
| 61 | + - name: Detach the macOS fixture volume |
| 62 | + if: ${{ always() && runner.os == 'macOS' }} |
| 63 | + run: | |
| 64 | + echo "TMPDIR=$RUNNER_TEMP" >> "$GITHUB_ENV" |
| 65 | + if [[ -d "$RUNNER_TEMP/runtime-case" ]]; then |
| 66 | + hdiutil detach "$RUNNER_TEMP/runtime-case" |
| 67 | + fi |
| 68 | + - name: Record exact toolchain and dependency versions |
| 69 | + if: always() |
| 70 | + run: | |
| 71 | + mkdir -p build/platform-evidence |
| 72 | + php --version > build/platform-evidence/php.txt |
| 73 | + composer --version > build/platform-evidence/composer.txt |
| 74 | + composer show --format=json > build/platform-evidence/packages.json |
| 75 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 76 | + if: always() |
| 77 | + with: |
| 78 | + name: platform-${{ matrix.os }}-composer-${{ matrix.composer }} |
| 79 | + path: build/platform-evidence |
| 80 | + if-no-files-found: error |
| 81 | + |
| 82 | + lowest: |
| 83 | + name: Lowest stable Symfony 8.1 dependency set |
| 84 | + runs-on: ubuntu-24.04 |
| 85 | + timeout-minutes: 15 |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 88 | + with: |
| 89 | + persist-credentials: false |
| 90 | + - uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 |
| 91 | + with: |
| 92 | + php-version: '8.5' |
| 93 | + extensions: curl, dom, mbstring, mysqli |
| 94 | + tools: composer:2.10.3 |
| 95 | + coverage: none |
| 96 | + - name: Resolve current stable development tools and lowest production dependencies |
| 97 | + run: | |
| 98 | + composer update --no-interaction --no-progress --prefer-dist |
| 99 | + # Keep QA tool versions current; lower the production boundary and its dependencies. |
| 100 | + # shellcheck disable=SC2016 # PHP variables must not be expanded by Bash. |
| 101 | + mapfile -t packages < <(php -r '$manifest = json_decode(file_get_contents("composer.json"), true, flags: JSON_THROW_ON_ERROR); foreach (array_keys($manifest["require"]) as $name) { if (str_contains($name, "/")) { echo $name, PHP_EOL; } }') |
| 102 | + composer update "${packages[@]}" --prefer-lowest --prefer-stable --with-dependencies --no-interaction --no-progress --prefer-dist |
| 103 | + - name: Validate and run strict QA on the lower dependency boundary |
| 104 | + run: | |
| 105 | + composer validate --strict |
| 106 | + composer check-platform-reqs |
| 107 | + # shellcheck disable=SC2016 # PHP variables must not be expanded by Bash. |
| 108 | + php -r '$manifest = json_decode(file_get_contents("composer.json"), true, flags: JSON_THROW_ON_ERROR); $lock = json_decode(file_get_contents("composer.lock"), true, flags: JSON_THROW_ON_ERROR); $versions = array_column($lock["packages"], "version", "name"); foreach ($manifest["require"] as $name => $constraint) { if (str_starts_with($name, "symfony/") && !str_starts_with(ltrim($versions[$name], "v"), "8.1.")) { throw new RuntimeException("Lowest Symfony 8.1 boundary was not resolved: " . $name); } }' |
| 109 | + composer qa |
| 110 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 111 | + if: always() |
| 112 | + with: |
| 113 | + name: lowest-stable-lock |
| 114 | + path: composer.lock |
| 115 | + if-no-files-found: error |
0 commit comments