From 7d902170ebee3d3b8dd6d4efda72fc1e1bccb71c Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Thu, 16 Jul 2026 15:17:31 +0200 Subject: [PATCH] IBX-11778: [GHA] Updated GitHub Actions in workflows (#230) * [GHA] Updated actions/cache to v6 Co-Authored-By: Claude Fable 5 * [GHA] Updated actions/checkout to v7 Co-Authored-By: Codex * [GHA][REST integration] Configured explicitly generated GitHub App token * [GHA][REST integration] Bumped Node version for PHP 7.4 to 20 * [Tests] Fixed incorrect usage of `json_decode` Co-Authored-By: Codex * [CI][GHA][REST integration] Passed GitHub App token to setup PHP Co-Authored-By: Codex * [GHA][REST integration] Dropped Selenium from functional tests setup The selenium.yml compose file was only needed because it injects EZP_TEST_REST_HOST=$WEB_HOST into the app container, pointing the functional tests at the nginx "web" service instead of the default localhost. Passing the variable explicitly on docker compose exec makes the whole Selenium container redundant. Co-Authored-By: Claude Fable 5 * [Composer] Used branch-alias constraints instead of `@dev` stability flags `@dev` is only a stability flag: `~4.6.0@dev` still matches any tagged 4.6.* release, so the solver may resolve to old stable versions with different dependency sets. An explicit `~4.6.x-dev` branch-alias constraint is more predictable. Co-Authored-By: Claude Fable 5 * [Composer] Dropped `ibexa/ci-scripts` dev dependency ibexa/ci-scripts is a standalone project; CI workflows fetch its scripts directly from GitHub, so the Composer package was unused. Co-Authored-By: Claude Fable 5 * [GHA][REST integration] Applied Composer audit ignores inside tested package Audit ignores were only ever configured on the workflow checkout, which becomes vendor/ibexa/rest solely when this callable runs in ibexa/rest itself. For external callers (e.g. ibexa/http-cache) the checkout is the caller's package and vendor/ibexa/rest comes pristine from the 4.6 branch, so its composer update hit Composer 2.10's advisory blocking on PHP 7.4 (unsolvable twig/guzzle advisories on EOL PHP). Applying the ignores inside vendor/ibexa/rest covers every caller and makes the runner-side audit ignores step redundant, hence it's dropped. Co-Authored-By: Claude Fable 5 --------- Co-authored-by: Claude Fable 5 Co-authored-by: Codex --- .github/workflows/backend-ci.yaml | 5 +- .../workflows/integration-tests-callable.yaml | 46 ++++++++++++++----- composer.json | 5 +- tests/bundle/Functional/SessionTest.php | 6 +-- tests/bundle/Functional/TestCase.php | 2 +- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index c9d0b5f82..c810e7b5a 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -16,7 +16,7 @@ jobs: php: - '8.1' steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: ibexa/gh-workflows/actions/composer-install@main with: @@ -42,7 +42,7 @@ jobs: - '8.4' steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: ibexa/gh-workflows/actions/composer-install@main with: @@ -65,3 +65,4 @@ jobs: functional-tests: name: "REST functional tests" uses: ./.github/workflows/integration-tests-callable.yaml + secrets: inherit diff --git a/.github/workflows/integration-tests-callable.yaml b/.github/workflows/integration-tests-callable.yaml index 4372dc0a1..4071e743d 100644 --- a/.github/workflows/integration-tests-callable.yaml +++ b/.github/workflows/integration-tests-callable.yaml @@ -7,7 +7,7 @@ env: PHP_INI_ENV_memory_limit: 512M COMPOSER_CACHE_DIR: ~/.composer/cache PROJECT_EDITION: oss - SETUP: "doc/docker/base-dev.yml:doc/docker/selenium.yml" + SETUP: "doc/docker/base-dev.yml" WEB_HOST: web jobs: @@ -19,36 +19,47 @@ jobs: matrix: include: - php: '7.4' - node: 18 + node: 20 - php: '8.3' node: 22 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set project version run: | version=$(jq -r '.extra | ."branch-alias" | ."dev-main"' < composer.json) echo "version=$version" >> $GITHUB_ENV + - name: Generate token + id: generate_token + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + private-key: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + owner: ${{ github.repository_owner }} + - name: Setup PHP Action uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: none - - - name: Ignore unsolvable advisories for PHP versions past EOL - uses: ibexa/gh-workflows/actions/composer-audit-ignore@main - with: - php-version: '${{ matrix.php }}' + github-token: ${{ steps.generate_token.outputs.token }} - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: ${{ env.PROJECT_EDITION }}-${{ env.version }}-${{ github.sha }} restore-keys: | ${{ env.PROJECT_EDITION }}-${{ env.version }} + - name: Add composer key for GitHub App + if: ${{ steps.generate_token.outputs.token != '' }} + run: | + composer config github-oauth.github.com $GITHUB_TOKEN + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + - name: Set up whole project using the tested dependency run: | curl -L "https://raw.githubusercontent.com/ibexa/ci-scripts/main/bin/${{ env.version }}/prepare_project_edition.sh" > prepare_project_edition.sh @@ -60,7 +71,20 @@ jobs: cd "$HOME/build/project" docker compose --env-file=.env exec -T --user www-data app sh -c "APP_ENV=behat php bin/console ibexa:behat:create-language 'pol-PL' 'Polish (polski)'" - - name: Run tests + - name: Configure composer inside vendor/ibexa/rest + run: | + cd "$HOME/build/project" + docker compose --env-file=.env exec -T --user www-data app sh -c " + cd vendor/ibexa/rest && + curl -fsSLO https://raw.githubusercontent.com/ibexa/ci-scripts/main/bin/_common/configure_composer_audit_ignores.sh && + bash configure_composer_audit_ignores.sh && + composer update + " + + - name: Run tests inside vendor/ibexa/rest against configured instance run: | cd "$HOME/build/project" - docker compose --env-file=.env exec -T --user www-data app sh -c "cd vendor/ibexa/rest && composer update && composer test-functional" + docker compose --env-file=.env exec -T --user www-data -e EZP_TEST_REST_HOST=$WEB_HOST app sh -c " + cd vendor/ibexa/rest && + composer test-functional + " diff --git a/composer.json b/composer.json index 5390abc5f..c5bfb77f4 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "ext-libxml": "*", "ext-simplexml": "*", "ext-xmlwriter": "*", - "ibexa/core": "~4.6.0@dev", + "ibexa/core": "~4.6.x-dev", "symfony/http-kernel": "^5.3", "symfony/dependency-injection": "^5.3", "symfony/routing": "^5.3", @@ -46,8 +46,7 @@ "lexik/jwt-authentication-bundle": "^2.8" }, "require-dev": { - "ibexa/ci-scripts": "^0.2@dev", - "ibexa/doctrine-schema": "~4.6.0@dev", + "ibexa/doctrine-schema": "~4.6.x-dev", "ibexa/code-style": "^1.0", "ibexa/test-core": "^0.1.x-dev", "friendsofphp/php-cs-fixer": "^3.0", diff --git a/tests/bundle/Functional/SessionTest.php b/tests/bundle/Functional/SessionTest.php index 24942946c..9b1e971ca 100644 --- a/tests/bundle/Functional/SessionTest.php +++ b/tests/bundle/Functional/SessionTest.php @@ -159,7 +159,7 @@ public function testDeletedSessionCookieCannotReauthenticate(): void ); $currentSessionResponse = $this->sendHttpRequest($currentSessionRequest); self::assertHttpResponseCodeEquals($currentSessionResponse, 200); - $authenticatedData = json_decode($currentSessionResponse->getBody()->getContents(), true, JSON_THROW_ON_ERROR); + $authenticatedData = json_decode($currentSessionResponse->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); $authenticatedUserHref = $authenticatedData['Session']['User']['_href']; // Logout @@ -178,7 +178,7 @@ public function testDeletedSessionCookieCannotReauthenticate(): void ) ); - $reusedData = json_decode($reusedResponse->getBody()->getContents(), true, JSON_THROW_ON_ERROR); + $reusedData = json_decode($reusedResponse->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); self::assertNotEquals( $authenticatedUserHref, $reusedData['Session']['User']['_href'], @@ -220,7 +220,7 @@ public function testCheckSession(): void $response = $this->sendHttpRequest($request); self::assertHttpResponseCodeEquals($response, 200); $contents = $response->getBody()->getContents(); - $data = json_decode($contents, true, JSON_THROW_ON_ERROR); + $data = json_decode($contents, true, 512, JSON_THROW_ON_ERROR); self::assertArrayHasKey('Session', $data); } diff --git a/tests/bundle/Functional/TestCase.php b/tests/bundle/Functional/TestCase.php index 2c36a61d8..e22171da6 100644 --- a/tests/bundle/Functional/TestCase.php +++ b/tests/bundle/Functional/TestCase.php @@ -400,7 +400,7 @@ protected function login(): \stdClass $response = $this->sendHttpRequest($request); self::assertHttpResponseCodeEquals($response, 201); - return json_decode($response->getBody()->getContents(), false, JSON_THROW_ON_ERROR)->Session; + return json_decode($response->getBody()->getContents(), false, 512, JSON_THROW_ON_ERROR)->Session; } /**