Skip to content

Commit 04f2156

Browse files
authored
Merge branch 'api-platform:main' into doctrine_persistence_v4
2 parents 4a92120 + 828b62a commit 04f2156

File tree

503 files changed

+13605
-203029
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

503 files changed

+13605
-203029
lines changed

.commitlintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"elasticsearch",
1414
"mongodb",
1515
"jsonld",
16+
"httpcache",
1617
"hydra",
1718
"httpcache",
1819
"jsonapi",

.github/workflows/api_platform.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 166 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,9 @@ concurrency:
1010

1111
env:
1212
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
COMPOSER_ROOT_VERSION: "4.1.x-dev"
1314

1415
jobs:
15-
commitlint:
16-
if: github.event_name == 'pull_request'
17-
env:
18-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
fetch-depth: 0
24-
- name: Run commitlint
25-
run: |
26-
commit=$(gh api \
27-
/repos/${{ github.repository }}/pulls/${{github.event.number}}/commits \
28-
| jq -r '.[0].commit.message' \
29-
| head -n 1)
30-
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
31-
echo '{}' > package.json
32-
npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli
33-
echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc
34-
3516
architecture:
3617
name: Check components interdependencies
3718
runs-on: ubuntu-latest
@@ -264,7 +245,7 @@ jobs:
264245
continue-on-error: true
265246

266247
phpunit-components:
267-
name: PHPUnit ${{ matrix.component }} (PHP ${{ matrix.php.version }} ${{ matrix.php.coverage && 'coverage' || '' }}${{ matrix.php.deprecations && 'no deprecations' || '' }})
248+
name: PHPUnit ${{ matrix.component }} (PHP ${{ matrix.php.version }} ${{ matrix.php.coverage && 'coverage' || '' }}${{ matrix.php.lowest && 'lowest' || '' }})
268249
runs-on: ubuntu-latest
269250
timeout-minutes: 20
270251
strategy:
@@ -275,7 +256,7 @@ jobs:
275256
- version: '8.4'
276257
coverage: true
277258
- version: '8.4'
278-
deprecations: true
259+
lowest: true
279260
component:
280261
- api-platform/doctrine-common
281262
- api-platform/doctrine-orm
@@ -304,23 +285,24 @@ jobs:
304285
tools: pecl, composer
305286
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
306287
ini-values: memory_limit=-1
307-
- name: Linking
288+
- name: PMU
308289
run: |
309290
composer global require soyuka/pmu
310291
composer global config allow-plugins.soyuka/pmu true --no-interaction
311-
composer global link . --permanent
312-
- name: Allow unstable project dependencies
313-
if: matrix.php.deprecations == true
292+
- name: Linking
293+
if: ${{ !matrix.php.lowest }}
314294
run: |
315-
cd $(composer ${{matrix.component}} --cwd)
316-
composer config minimum-stability dev
295+
composer global link . --permanent
296+
composer ${{matrix.component}} update
317297
- name: Run ${{ matrix.component }} install
298+
if: ${{ matrix.php.lowest }}
318299
run: |
319-
composer ${{matrix.component}} update
300+
cd $(composer ${{matrix.component}} --cwd)
301+
composer update${{ matrix.php.lowest && ' --prefer-lowest --prefer-source' || '' }}
320302
- name: Run ${{ matrix.component }} tests
321303
run: |
322304
mkdir -p /tmp/build/logs/phpunit
323-
composer ${{matrix.component}} test --log-junit "/tmp/build/logs/phpunit/junit.xml" ${{ matrix.php.coverage && '--coverage-clover /tmp/build/logs/phpunit/clover.xml' || '' }} ${{ matrix.php.deprecations && '--fail-on-deprecation --display-deprecations' || '' }}
305+
composer ${{matrix.component}} test -- --log-junit "/tmp/build/logs/phpunit/junit.xml" ${{ matrix.php.coverage && '--coverage-clover /tmp/build/logs/phpunit/clover.xml' || '' }}${{ matrix.php.lowest && ' --ignore-baseline' || '' }}
324306
- name: Upload test artifacts
325307
if: always()
326308
uses: actions/upload-artifact@v4
@@ -347,6 +329,56 @@ jobs:
347329
php-coveralls --coverage_clover=/tmp/build/logs/phpunit/clover.xml
348330
continue-on-error: true
349331

332+
phpunit-components-fail-deprecation:
333+
name: PHPUnit no deprecations ${{ matrix.component }} (PHP ${{ matrix.php.version }}
334+
runs-on: ubuntu-latest
335+
timeout-minutes: 20
336+
strategy:
337+
matrix:
338+
php:
339+
- version: '8.4'
340+
component:
341+
- api-platform/doctrine-common
342+
- api-platform/doctrine-orm
343+
- api-platform/doctrine-odm
344+
- api-platform/metadata
345+
- api-platform/hydra
346+
- api-platform/json-api
347+
- api-platform/json-schema
348+
- api-platform/elasticsearch
349+
- api-platform/openapi
350+
- api-platform/graphql
351+
- api-platform/http-cache
352+
- api-platform/ramsey-uuid
353+
- api-platform/serializer
354+
- api-platform/state
355+
- api-platform/symfony
356+
- api-platform/validator
357+
fail-fast: false
358+
steps:
359+
- name: Checkout
360+
uses: actions/checkout@v4
361+
- name: Setup PHP
362+
uses: shivammathur/setup-php@v2
363+
with:
364+
php-version: ${{ matrix.php.version }}
365+
tools: pecl, composer
366+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
367+
ini-values: memory_limit=-1
368+
- name: Linking
369+
run: |
370+
composer global require soyuka/pmu
371+
composer global config allow-plugins.soyuka/pmu true --no-interaction
372+
composer global link . --permanent
373+
- name: Run ${{ matrix.component }} install
374+
run: |
375+
composer ${{matrix.component}} update
376+
- name: Run ${{ matrix.component }} tests
377+
run: |
378+
mkdir -p /tmp/build/logs/phpunit
379+
cd $(composer ${{matrix.component}} --cwd)
380+
./vendor/bin/phpunit --fail-on-deprecation --display-deprecations --log-junit "/tmp/build/logs/phpunit/junit.xml"
381+
350382
behat:
351383
name: Behat (PHP ${{ matrix.php }})
352384
runs-on: ubuntu-latest
@@ -427,26 +459,6 @@ jobs:
427459
export PATH="$PATH:$HOME/.composer/vendor/bin"
428460
php-coveralls --coverage_clover=build/logs/behat/clover.xml
429461
continue-on-error: true
430-
- name: Export OpenAPI documents
431-
run: |
432-
mkdir -p build/out/openapi
433-
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
434-
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml
435-
- name: Setup node
436-
uses: actions/setup-node@v4
437-
with:
438-
node-version: '14'
439-
- name: Validate OpenAPI documents
440-
run: |
441-
npx swagger-cli validate build/out/openapi/openapi_v3.json
442-
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
443-
- name: Upload OpenAPI artifacts
444-
if: always()
445-
uses: actions/upload-artifact@v4
446-
with:
447-
name: openapi-docs-php${{ matrix.php }}
448-
path: build/out/openapi
449-
continue-on-error: true
450462

451463
postgresql:
452464
name: Behat (PHP ${{ matrix.php }}) (PostgreSQL)
@@ -726,8 +738,60 @@ jobs:
726738
php-coveralls --coverage_clover=build/logs/behat/clover.xml
727739
continue-on-error: true
728740

729-
elasticsearch:
730-
name: Behat (PHP ${{ matrix.php }}) (Elasticsearch)
741+
elasticsearch-v9:
742+
name: Behat (PHP ${{ matrix.php }}) (Elasticsearch v9)
743+
runs-on: ubuntu-latest
744+
timeout-minutes: 20
745+
strategy:
746+
matrix:
747+
php:
748+
- '8.4'
749+
fail-fast: false
750+
env:
751+
APP_ENV: elasticsearch
752+
steps:
753+
- name: Checkout
754+
uses: actions/checkout@v4
755+
- name: Configure sysctl limits
756+
run: |
757+
sudo swapoff -a
758+
sudo sysctl -w vm.swappiness=1
759+
sudo sysctl -w fs.file-max=262144
760+
sudo sysctl -w vm.max_map_count=262144
761+
- name: Runs Elasticsearch
762+
uses: elastic/elastic-github-actions/elasticsearch@master
763+
with:
764+
stack-version: '9.0.0'
765+
security-enabled: false
766+
- name: Setup PHP
767+
uses: shivammathur/setup-php@v2
768+
with:
769+
php-version: ${{ matrix.php }}
770+
tools: pecl, composer
771+
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
772+
coverage: none
773+
ini-values: memory_limit=-1
774+
- name: Get composer cache directory
775+
id: composercache
776+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
777+
- name: Cache dependencies
778+
uses: actions/cache@v4
779+
with:
780+
path: ${{ steps.composercache.outputs.dir }}
781+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
782+
restore-keys: ${{ runner.os }}-composer-
783+
- name: Update project dependencies
784+
run: |
785+
composer global require soyuka/pmu
786+
composer global config allow-plugins.soyuka/pmu true --no-interaction
787+
composer global link .
788+
- name: Clear test app cache
789+
run: tests/Fixtures/app/console cache:clear --ansi
790+
- name: Run Behat tests
791+
run: vendor/bin/behat --out=std --format=progress --profile=elasticsearch --no-interaction
792+
793+
elasticsearch-v8:
794+
name: Behat (PHP ${{ matrix.php }}) (Elasticsearch v8)
731795
runs-on: ubuntu-latest
732796
timeout-minutes: 20
733797
strategy:
@@ -773,6 +837,7 @@ jobs:
773837
composer global require soyuka/pmu
774838
composer global config allow-plugins.soyuka/pmu true --no-interaction
775839
composer global link .
840+
composer require elasticsearch/elasticsearch "^8.4" -W
776841
- name: Clear test app cache
777842
run: tests/Fixtures/app/console cache:clear --ansi
778843
- name: Run Behat tests
@@ -965,7 +1030,7 @@ jobs:
9651030
strategy:
9661031
matrix:
9671032
php:
968-
- '8.3'
1033+
- '8.4'
9691034
fail-fast: false
9701035
env:
9711036
APP_ENV: sqlite
@@ -978,20 +1043,13 @@ jobs:
9781043
with:
9791044
php-version: ${{ matrix.php }}
9801045
tools: pecl, composer
981-
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo
1046+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, fileinfo, mongodb
9821047
coverage: none
9831048
ini-values: memory_limit=-1
984-
# Not in pecl
985-
- name: Setup mongodb
986-
run: |
987-
curl -sLO https://github.com/mongodb/mongo-php-driver/releases/download/1.17.2/php_mongodb-1.17.2-8.3-nts-x64.zip
988-
unzip -q php_mongodb-1.17.2-8.3-nts-x64.zip php_mongodb.dll
989-
mv php_mongodb.dll C:\tools\php\ext
990-
echo "extension=php_mongodb.dll" >> C:\tools\php\php.ini
9911049
- name: Get composer cache directory
9921050
id: composercache
993-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
9941051
shell: bash
1052+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
9951053
- name: Cache dependencies
9961054
uses: actions/cache@v4
9971055
with:
@@ -1000,18 +1058,22 @@ jobs:
10001058
restore-keys: ${{ runner.os }}-composer-
10011059
- name: Keep windows path
10021060
id: get-cwd
1061+
shell: bash
10031062
run: |
10041063
cwd=$(php -r 'echo(str_replace("\\", "\\\\", $_SERVER["argv"][1]));' '${{ github.workspace }}')
10051064
echo cwd=$cwd >> $GITHUB_OUTPUT
1006-
shell: bash
10071065
- name: Update project dependencies
1066+
shell: bash
10081067
run: |
1068+
php -m
10091069
composer global require soyuka/pmu
10101070
composer global config allow-plugins.soyuka/pmu true --no-interaction
10111071
composer global link . --working-directory='${{ steps.get-cwd.outputs.cwd }}'
10121072
- name: Clear test app cache
1073+
shell: bash
10131074
run: tests/Fixtures/app/console cache:clear --ansi
10141075
- name: Run Behat tests
1076+
shell: bash
10151077
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction
10161078

10171079
phpunit-symfony-lowest:
@@ -1229,26 +1291,53 @@ jobs:
12291291
name: behat-logs-php${{ matrix.php }}
12301292
path: build/logs/behat
12311293
continue-on-error: true
1294+
1295+
openapi:
1296+
name: OpenAPI
1297+
runs-on: ubuntu-latest
1298+
timeout-minutes: 20
1299+
strategy:
1300+
matrix:
1301+
php:
1302+
- '8.4'
1303+
fail-fast: false
1304+
steps:
1305+
- name: Checkout
1306+
uses: actions/checkout@v4
1307+
- name: Setup PHP
1308+
uses: shivammathur/setup-php@v2
1309+
with:
1310+
php-version: ${{ matrix.php }}
1311+
tools: pecl, composer
1312+
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb
1313+
ini-values: memory_limit=-1
1314+
- name: Setup node
1315+
uses: actions/setup-node@v4
1316+
with:
1317+
node-version: '22'
1318+
- name: Get composer cache directory
1319+
id: composercache
1320+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
1321+
- name: Cache dependencies
1322+
uses: actions/cache@v4
1323+
with:
1324+
path: ${{ steps.composercache.outputs.dir }}
1325+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
1326+
restore-keys: ${{ runner.os }}-composer-
1327+
- name: Update project dependencies
1328+
run: |
1329+
composer global require soyuka/pmu
1330+
composer global config allow-plugins.soyuka/pmu true --no-interaction
1331+
composer global link .
1332+
- name: Clear test app cache
1333+
run: tests/Fixtures/app/console cache:clear --ansi
12321334
- name: Export OpenAPI documents
12331335
run: |
12341336
mkdir -p build/out/openapi
1235-
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json
12361337
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml
1237-
- name: Setup node
1238-
uses: actions/setup-node@v4
1239-
with:
1240-
node-version: '14'
12411338
- name: Validate OpenAPI documents
12421339
run: |
1243-
npx swagger-cli validate build/out/openapi/openapi_v3.json
1244-
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
1245-
- name: Upload OpenAPI artifacts
1246-
if: always()
1247-
uses: actions/upload-artifact@v4
1248-
with:
1249-
name: openapi-docs-php${{ matrix.php }}
1250-
path: build/out/openapi
1251-
continue-on-error: true
1340+
npx @quobix/vacuum lint -r tests/Fixtures/app/ruleset.yaml build/out/openapi/openapi_v3.yaml -d --ignore-array-circle-ref --ignore-polymorph-circle-ref -b --no-clip
12521341
12531342
laravel:
12541343
name: Laravel (PHP ${{ matrix.php }})

0 commit comments

Comments
 (0)