feat(scopes): remove hub usage in handler and middleware #2255
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - release/** | |
| permissions: | |
| contents: read | |
| env: | |
| FRANKENPHP_VERSION: v1.11.2 | |
| ROADRUNNER_VERSION: v2025.1.7 | |
| # Cancel in progress workflows on pull_requests. | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: Tests (${{ matrix.os }}, ${{ matrix.php.version }}, ${{ matrix.dependencies }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| php: | |
| - { version: '7.2', phpunit: '^8.5.52' } | |
| - { version: '7.3', phpunit: '^9.6.34' } | |
| - { version: '7.4', phpunit: '^9.6.34' } | |
| - { version: '8.0', phpunit: '^9.6.34' } | |
| - { version: '8.1', phpunit: '^9.6.34' } | |
| - { version: '8.2', phpunit: '^9.6.34' } | |
| - { version: '8.3', phpunit: '^9.6.34' } | |
| - { version: '8.4', phpunit: '^9.6.34' } | |
| - { version: '8.5', phpunit: '^9.6.34' } | |
| dependencies: | |
| - lowest | |
| - highest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2 | |
| with: | |
| php-version: ${{ matrix.php.version }} | |
| coverage: xdebug | |
| - name: Setup Problem Matchers for PHPUnit | |
| run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - name: Determine Composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-${{ matrix.php.version }}-${{ matrix.dependencies }}-composer- | |
| # These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests | |
| - name: Remove unused dependencies | |
| run: composer remove carthage-software/mago phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update | |
| - name: Remove RoadRunner dependencies on unsupported PHP versions | |
| if: ${{ matrix.os == 'windows-latest' || matrix.php.version == '7.2' || matrix.php.version == '7.3' || matrix.php.version == '7.4' || matrix.php.version == '8.0' }} | |
| run: composer remove spiral/roadrunner-http spiral/roadrunner-worker --dev --no-interaction --no-update | |
| - name: Remove OpenTelemetry dependencies on unsupported PHP versions | |
| if: ${{ matrix.php.version == '7.2' || matrix.php.version == '7.3' || matrix.php.version == '7.4' || matrix.php.version == '8.0' }} | |
| run: composer remove open-telemetry/api open-telemetry/exporter-otlp open-telemetry/sem-conv open-telemetry/sdk --dev --no-interaction --no-update | |
| - name: Set phpunit/phpunit version constraint | |
| run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update | |
| - name: Resolve highest dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-plugins --no-scripts --no-audit | |
| if: ${{ matrix.dependencies == 'highest' }} | |
| - name: Resolve lowest dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest --no-install --no-plugins --no-scripts --no-audit | |
| if: ${{ matrix.dependencies == 'lowest' }} | |
| - name: Audit highest dependencies | |
| run: composer audit --locked --no-interaction --format=table | |
| if: ${{ matrix.dependencies == 'highest' }} | |
| - name: Audit lowest dependencies | |
| run: composer audit --locked --no-interaction --format=table --abandoned=report | |
| if: ${{ matrix.dependencies == 'lowest' }} | |
| - name: Install dependencies | |
| run: composer install --no-progress --no-interaction --prefer-dist --no-plugins --no-scripts | |
| - name: Run unit tests | |
| run: vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml | |
| # The reason for running some OOM tests without coverage is that because the coverage information collector can cause another OOM event invalidating the test | |
| - name: Run out of memory tests (without coverage) | |
| run: vendor/bin/phpunit --testsuite oom --no-coverage | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| runtime-tests-frankenphp: | |
| name: Runtime tests (FrankenPHP) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2 | |
| with: | |
| php-version: '8.4' | |
| coverage: none | |
| - name: Determine Composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: ${{ runner.os }}-runtime-frankenphp-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-runtime-frankenphp-composer- | |
| - name: Resolve dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-plugins --no-scripts --no-audit | |
| - name: Audit dependencies | |
| run: composer audit --locked --no-interaction --format=table | |
| - name: Install dependencies | |
| run: composer install --no-progress --no-interaction --prefer-dist --no-plugins --no-scripts | |
| - name: Install FrankenPHP | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| case "$(uname -m)" in | |
| x86_64) asset="frankenphp-linux-x86_64" ;; | |
| aarch64|arm64) asset="frankenphp-linux-aarch64" ;; | |
| *) echo "Unsupported architecture: $(uname -m)"; exit 1 ;; | |
| esac | |
| digest="$(gh api "repos/php/frankenphp/releases/tags/${FRANKENPHP_VERSION}" --jq ".assets[] | select(.name == \"${asset}\") | .digest")" | |
| if [ -z "${digest}" ]; then | |
| echo "Unable to resolve digest for ${asset} (${FRANKENPHP_VERSION})." | |
| exit 1 | |
| fi | |
| gh release download "${FRANKENPHP_VERSION}" \ | |
| --repo php/frankenphp \ | |
| --pattern "${asset}" \ | |
| --output "${asset}" | |
| echo "${digest#sha256:} ${asset}" | sha256sum --check -- | |
| mkdir -p "${RUNNER_TEMP}/bin" | |
| install -m 0755 "${asset}" "${RUNNER_TEMP}/bin/frankenphp" | |
| echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}" | |
| "${RUNNER_TEMP}/bin/frankenphp" version | |
| shell: bash | |
| - name: Run PHPUnit tests (excluding PHPT) | |
| run: vendor/bin/phpunit tests --test-suffix Test.php --verbose | |
| runtime-tests-roadrunner: | |
| name: Runtime tests (RoadRunner) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2 | |
| with: | |
| php-version: '8.4' | |
| coverage: none | |
| - name: Determine Composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: ${{ runner.os }}-runtime-roadrunner-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-runtime-roadrunner-composer- | |
| - name: Resolve dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist --no-install --no-plugins --no-scripts --no-audit | |
| - name: Audit dependencies | |
| run: composer audit --locked --no-interaction --format=table | |
| - name: Install dependencies | |
| run: composer install --no-progress --no-interaction --prefer-dist --no-plugins --no-scripts | |
| - name: Install RoadRunner | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| case "$(uname -m)" in | |
| x86_64) arch="amd64" ;; | |
| aarch64|arm64) arch="arm64" ;; | |
| *) echo "Unsupported architecture: $(uname -m)"; exit 1 ;; | |
| esac | |
| version_no_prefix="${ROADRUNNER_VERSION#v}" | |
| asset="roadrunner-${version_no_prefix}-linux-${arch}.tar.gz" | |
| digest="$(gh api "repos/roadrunner-server/roadrunner/releases/tags/${ROADRUNNER_VERSION}" --jq ".assets[] | select(.name == \"${asset}\") | .digest")" | |
| if [ -z "${digest}" ]; then | |
| echo "Unable to resolve digest for ${asset} (${ROADRUNNER_VERSION})." | |
| exit 1 | |
| fi | |
| gh release download "${ROADRUNNER_VERSION}" \ | |
| --repo roadrunner-server/roadrunner \ | |
| --pattern "${asset}" \ | |
| --output "${asset}" | |
| echo "${digest#sha256:} ${asset}" | sha256sum --check -- | |
| tar -xzf "${asset}" --strip-components=1 "${asset%.tar.gz}/rr" | |
| mkdir -p "${RUNNER_TEMP}/bin" | |
| install -m 0755 rr "${RUNNER_TEMP}/bin/rr" | |
| echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}" | |
| "${RUNNER_TEMP}/bin/rr" --version | |
| shell: bash | |
| - name: Run PHPUnit tests (excluding PHPT) | |
| run: vendor/bin/phpunit tests --test-suffix Test.php --verbose |