diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index c9d0b5f8..c810e7b5 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 4372dc0a..4071e743 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 5390abc5..c5bfb77f 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 24942946..9b1e971c 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 2c36a61d..e22171da 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; } /**