Skip to content

Commit be523c9

Browse files
committed
Merge branch 'master' of github.com:yoanm/symfony-jsonrpc-http-server into feature/perf-improvements
2 parents a9ae576 + 76b1eb1 commit be523c9

24 files changed

+675
-354
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 4
9+
10+
[Makefile]
11+
indent_style = tab
12+
indent_size = 8
13+
14+
[{*.yml,*.yaml}]
15+
indent_style = space
16+
indent_size = 2

.github/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.yml]
2+
indent_style = space
3+
indent_size = 2

.github/dependabot.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
3-
- package-ecosystem: composer
4-
directory: "/"
5-
schedule:
6-
interval: monthly
7-
open-pull-requests-limit: 10
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 10

.github/workflows/CI.yml

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
name: 'CI'
2+
on: # Build any PRs and main branch changes
3+
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
push:
10+
branches: [ master ]
11+
schedule:
12+
- cron: '0 0 1 * *' # Every month
13+
14+
concurrency:
15+
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
16+
cancel-in-progress: true
17+
18+
env:
19+
# Cache params
20+
CACHE_VERSION: 2022061905 # To be able to create a new cache (YYYYMMDDXX)
21+
TEST_OUTPUT_STYLE: pretty
22+
COMPOSER_OPTIONS: --optimize-autoloader
23+
CODACY_CACHE_PATH: ~/.cache/codacy
24+
CODACY_BIN: ~/.cache/codacy/codacy.sh
25+
26+
27+
#permissions:
28+
# actions: write # Required to be able to trigger sub CI workflows
29+
30+
jobs:
31+
tests:
32+
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
33+
runs-on: ubuntu-latest
34+
env:
35+
COVERAGE_TYPE: none
36+
strategy:
37+
fail-fast: true
38+
max-parallel: 4
39+
matrix:
40+
php-version:
41+
- '8.1' # Latest supported
42+
- '8.0' # First php 8 version
43+
- '7.4' # Latest php 7 version
44+
- '7.3' # Lowest supported
45+
symfony-version:
46+
- '4.4' # Lowest LTS
47+
- '5.4' # Latest LTS
48+
exclude:
49+
# Run all symfony version only on Lowest and Latest php versions, run it only one time for others
50+
- php-version: '8.0'
51+
symfony-version: '4.4'
52+
- php-version: '7.4'
53+
symfony-version: '5.4'
54+
steps:
55+
- name: Check out code
56+
uses: actions/checkout@v2
57+
58+
- name: Enable coverage
59+
if: ${{ matrix.php-version == '8.1' }}
60+
run: |
61+
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
62+
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
63+
64+
- name: Setup PHP ${{ matrix.php-version }}
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: '${{ matrix.php-version }}'
68+
tools: composer
69+
coverage: ${{ env.COVERAGE_TYPE }}
70+
env:
71+
# Always use latest available patch for the version
72+
update: true
73+
74+
- name: Setup cache
75+
id: cache
76+
uses: actions/cache@v2
77+
with:
78+
path: |
79+
~/.composer
80+
./vendor
81+
${{ env.CODACY_CACHE_PATH }}
82+
build/behat-code-coverage-cache
83+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
84+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
85+
86+
- name: Download codacy binary
87+
if: steps.cache.outputs.cache-hit != 'true'
88+
run: |
89+
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
90+
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
91+
&& chmod +x ${{ env.CODACY_BIN }} \
92+
&& ${{ env.CODACY_BIN }} download
93+
94+
- name: Build
95+
run: |
96+
composer require -W \
97+
symfony/http-foundation:^${{ matrix.symfony-version }} \
98+
symfony/http-kernel:^${{ matrix.symfony-version }} \
99+
symfony/config:^${{ matrix.symfony-version }} \
100+
symfony/dependency-injection:^${{ matrix.symfony-version }} \
101+
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
102+
symfony/routing:^${{ matrix.symfony-version }} \
103+
&& make build
104+
105+
- name: Tests
106+
run: make test-unit && make test-functional
107+
108+
# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
109+
- name: Upload unit tests coverage to codecov
110+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
111+
uses: codecov/codecov-action@v3
112+
with:
113+
file: "build/coverage-phpunit/unit.clover"
114+
name: "unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
115+
flags: "unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
116+
fail_ci_if_error: true
117+
118+
- name: Upload functional tests coverage to codecov
119+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
120+
uses: codecov/codecov-action@v3
121+
with:
122+
files: "build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
123+
name: "functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
124+
flags: "functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
125+
fail_ci_if_error: true
126+
127+
- name: Upload coverages to Codacy
128+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
129+
run: ${{ env.CODACY_BIN }} report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial
130+
131+
static-checks:
132+
name: Static checks
133+
runs-on: ubuntu-latest
134+
needs: [ tests ]
135+
steps:
136+
- uses: actions/checkout@v2
137+
138+
- name: Setup PHP 8.1
139+
uses: shivammathur/setup-php@v2
140+
with:
141+
php-version: 8.1 # Latest supported
142+
tools: composer
143+
coverage: none
144+
env:
145+
# Always use latest available patch for the version
146+
update: true
147+
148+
- name: Setup cache
149+
id: cache
150+
uses: actions/cache@v2
151+
with:
152+
path: |
153+
~/.composer
154+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
155+
key: ${{ env.CACHE_VERSION }}-tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
156+
157+
- name: Build
158+
run: make build
159+
160+
- name: ComposerRequireChecker
161+
uses: docker://webfactory/composer-require-checker:3.2.0
162+
163+
- name: Dependencies check
164+
if: ${{ github.event_name == 'pull_request' }}
165+
uses: actions/dependency-review-action@v1
166+
167+
finalize-codacy-coverage-report:
168+
runs-on: ubuntu-latest
169+
name: Finalize Codacy coverage report
170+
needs: [ tests ]
171+
steps:
172+
- name: Setup cache
173+
id: cache
174+
uses: actions/cache@v2
175+
with:
176+
path: |
177+
${{ env.CODACY_CACHE_PATH }}
178+
key: ${{ env.CACHE_VERSION }}-codacy-final
179+
180+
- name: Download codacy binary
181+
if: steps.cache.outputs.cache-hit != 'true'
182+
run: |
183+
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
184+
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
185+
&& chmod +x ${{ env.CODACY_BIN }} \
186+
&& ${{ env.CODACY_BIN }} download
187+
188+
- name: Finalize reporting
189+
run: ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
190+
191+
nightly-tests:
192+
name: Nightly - Symfony ${{ matrix.symfony-version }}
193+
runs-on: ubuntu-latest
194+
env:
195+
COMPOSER_OPTIONS: '--optimize-autoloader --ignore-platform-req=php+'
196+
continue-on-error: true
197+
needs: [ static-checks, finalize-codacy-coverage-report ]
198+
strategy:
199+
fail-fast: false
200+
max-parallel: 4
201+
# Perform tests against:
202+
# - current php dev version with all supported symfony version
203+
# - next Symfony minor version to manage with latest supported php version
204+
matrix:
205+
php-version:
206+
- '8.2' # Current php dev version
207+
symfony-version:
208+
- '4.4' # Lowest LTS
209+
- '5.4' # Latest LTS
210+
include:
211+
- symfony-version: '6.0' # Next symfony minor version to manage with latest supported PHP version
212+
php-version: '8.1'
213+
214+
steps:
215+
- name: Check out code
216+
uses: actions/checkout@v2
217+
218+
- name: Setup PHP ${{ matrix.php-version }}
219+
uses: shivammathur/setup-php@v2
220+
with:
221+
php-version: '${{ matrix.php-version }}'
222+
tools: composer
223+
coverage: none
224+
env:
225+
# Always use latest available patch for the version
226+
update: true
227+
228+
- name: Setup cache
229+
id: cache
230+
uses: actions/cache@v2
231+
with:
232+
path: |
233+
~/.composer
234+
./vendor
235+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
236+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
237+
238+
- name: Build
239+
run: |
240+
composer require -W ${{ env.COMPOSER_OPTIONS }} \
241+
symfony/http-foundation:^${{ matrix.symfony-version }} \
242+
symfony/http-kernel:^${{ matrix.symfony-version }} \
243+
symfony/config:^${{ matrix.symfony-version }} \
244+
symfony/dependency-injection:^${{ matrix.symfony-version }} \
245+
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
246+
symfony/routing:^${{ matrix.symfony-version }} \
247+
&& make build
248+
249+
- name: Test
250+
run: make test-unit && make test-functional

.remarkignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

.remarkrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": [
3+
"remark-preset-lint-consistent",
4+
"remark-preset-lint-recommended"
5+
]
6+
}

0 commit comments

Comments
 (0)