Skip to content

Commit 9f46496

Browse files
committed
feat: hypermedia http client
0 parents  commit 9f46496

File tree

88 files changed

+18882
-0
lines changed

Some content is hidden

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

88 files changed

+18882
-0
lines changed

.commitlintrc

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"defaultIgnores": true,
3+
"extends": "@commitlint/config-conventional",
4+
"rules": {
5+
"body-leading-blank": [
6+
1,
7+
"always"
8+
],
9+
"body-max-line-length": [
10+
2,
11+
"always",
12+
100
13+
],
14+
"footer-leading-blank": [
15+
1,
16+
"always"
17+
],
18+
"footer-max-line-length": [
19+
2,
20+
"always",
21+
100
22+
],
23+
"header-max-length": [
24+
2,
25+
"always",
26+
100
27+
],
28+
"subject-case": [
29+
2,
30+
"never",
31+
[
32+
"sentence-case",
33+
"start-case",
34+
"pascal-case"
35+
]
36+
],
37+
"subject-empty": [
38+
2,
39+
"never"
40+
],
41+
"subject-full-stop": [
42+
2,
43+
"never",
44+
"."
45+
],
46+
"type-case": [
47+
2,
48+
"always",
49+
"lower-case"
50+
],
51+
"type-empty": [
52+
2,
53+
"never"
54+
],
55+
"type-enum": [
56+
2,
57+
"always",
58+
[
59+
"build",
60+
"chore",
61+
"ci",
62+
"doc",
63+
"feat",
64+
"fix",
65+
"perf",
66+
"refactor",
67+
"revert",
68+
"style",
69+
"test"
70+
]
71+
]
72+
}
73+
}

.github/workflows/ci.yml

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
env:
12+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
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+
35+
php-cs-fixer:
36+
name: PHP CS Fixer (PHP ${{ matrix.php }})
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 20
39+
strategy:
40+
matrix:
41+
php:
42+
- '8.3'
43+
fail-fast: false
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: ${{ matrix.php }}
51+
tools: php-cs-fixer
52+
coverage: none
53+
- name: Install project dependencies
54+
run: composer install
55+
- name: Run PHP-CS-Fixer fix
56+
run: php-cs-fixer fix --dry-run --diff --ansi
57+
58+
phpstan:
59+
name: PHPStan (PHP ${{ matrix.php }})
60+
runs-on: ubuntu-latest
61+
timeout-minutes: 20
62+
strategy:
63+
matrix:
64+
php:
65+
- '8.4'
66+
fail-fast: false
67+
env:
68+
APP_DEBUG: '1' # https://github.com/phpstan/phpstan-symfony/issues/37
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@v4
72+
- name: Setup PHP
73+
uses: shivammathur/setup-php@v2
74+
with:
75+
php-version: ${{ matrix.php }}
76+
tools: composer
77+
ini-values: memory_limit=-1
78+
- name: Get composer cache directory
79+
id: composercache
80+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
81+
- name: Cache dependencies
82+
uses: actions/cache@v4
83+
with:
84+
path: ${{ steps.composercache.outputs.dir }}
85+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
86+
restore-keys: ${{ runner.os }}-composer-
87+
- name: Install project dependencies
88+
run: composer install
89+
- name: Cache PHPStan results
90+
uses: actions/cache@v4
91+
with:
92+
path: /tmp/phpstan
93+
key: phpstan-php${{ matrix.php }}-${{ github.sha }}
94+
restore-keys: |
95+
phpstan-php${{ matrix.php }}-
96+
phpstan-
97+
continue-on-error: true
98+
- name: Run PHPStan analysis
99+
run: |
100+
./vendor/bin/phpstan --version
101+
./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
102+
103+
phpunit:
104+
name: PHPUnit (PHP ${{ matrix.php }})
105+
runs-on: ubuntu-latest
106+
timeout-minutes: 20
107+
strategy:
108+
matrix:
109+
php:
110+
- '8.4'
111+
include:
112+
- php: '8.4'
113+
coverage: true
114+
fail-fast: false
115+
steps:
116+
- name: Checkout
117+
uses: actions/checkout@v4
118+
- name: Setup PHP
119+
uses: shivammathur/setup-php@v2
120+
with:
121+
php-version: ${{ matrix.php }}
122+
tools: composer
123+
coverage: pcov
124+
- name: Get composer cache directory
125+
id: composercache
126+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
127+
- name: Cache dependencies
128+
uses: actions/cache@v4
129+
with:
130+
path: ${{ steps.composercache.outputs.dir }}
131+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
132+
restore-keys: ${{ runner.os }}-composer-
133+
- name: Install project dependencies
134+
run: composer install
135+
- name: Run test server
136+
run: |
137+
composer install
138+
php bin/console d:s:c
139+
php bin/console doctrine:fixtures:load -n
140+
php -S localhost:8080 public/index.php &
141+
working-directory: api
142+
- name: Run PHPUnit tests
143+
run: vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }}
144+
- name: Upload test artifacts
145+
if: always()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: phpunit-logs-php${{ matrix.php }}
149+
path: build/logs/phpunit
150+
continue-on-error: true
151+
- name: Upload coverage results to Codecov
152+
if: matrix.coverage
153+
uses: codecov/codecov-action@v3
154+
with:
155+
directory: build/logs/phpunit
156+
name: phpunit-php${{ matrix.php }}
157+
flags: phpunit
158+
fail_ci_if_error: true
159+
continue-on-error: true
160+
- name: Upload coverage results to Coveralls
161+
if: matrix.coverage
162+
env:
163+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
run: |
165+
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
166+
export PATH="$PATH:$HOME/.composer/vendor/bin"
167+
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml
168+
continue-on-error: true
169+
170+

.github/workflows/release.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
box:
10+
name: Box
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
timeout-minutes: 20
15+
strategy:
16+
matrix:
17+
php:
18+
- '8.4'
19+
fail-fast: false
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
tools: box
28+
- name: Get composer cache directory
29+
id: composercache
30+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
31+
- name: Cache dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ${{ steps.composercache.outputs.dir }}
35+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
36+
restore-keys: ${{ runner.os }}-composer-
37+
- name: Install project dependencies
38+
run: composer install
39+
continue-on-error: true
40+
- name: Run Box
41+
run: |
42+
box compile
43+
- name: Set output
44+
id: vars
45+
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
46+
- name: Release
47+
run: gh release create ${{ steps.vars.outputs.tag }} --generate-notes bin/fetch-docs.phar
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.php-cs-fixer.cache
2+
.phpunit.cache
3+
vendor
4+
var
5+
tools
6+
.phive
7+
bin/fetch-docs.phar

.php-cs-fixer.dist.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude([
6+
'api',
7+
'var',
8+
])
9+
;
10+
11+
$header = <<<'HEADER'
12+
This file is part of the API Platform project.
13+
14+
(c) Antoine Bluchet <[email protected]>, Kévin Dunglas <[email protected]>
15+
16+
For the full copyright and license information, please view the LICENSE
17+
file that was distributed with this source code.
18+
HEADER;
19+
20+
return (new PhpCsFixer\Config())
21+
->setRules([
22+
'@PER-CS' => true,
23+
'@PHP82Migration' => true,
24+
'@Symfony' => true,
25+
'fully_qualified_strict_types' => true,
26+
'header_comment' => [
27+
'header' => $header,
28+
'location' => 'after_open',
29+
],
30+
])
31+
->setFinder($finder)
32+
;

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT license
2+
3+
Copyright (c) 2015-present Antoine Bluchet
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is furnished
10+
to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)