Skip to content

Commit 4854ef4

Browse files
authored
Fix master CI / GHAction CI / CodeCov / PHP 8 / Drop PHP 7.2 / Codacy (#75)
1 parent 72c5008 commit 4854ef4

23 files changed

+623
-275
lines changed

.editorconfig

+16
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

+3
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

+5-5
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'CI - ComposerRequireChecker'
2+
on:
3+
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- requested
8+
9+
concurrency:
10+
group: "CI-${{ github.head_ref }}"
11+
cancel-in-progress: true
12+
13+
env:
14+
# Cache params
15+
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)
16+
17+
jobs:
18+
check:
19+
name: ComposerRequireChecker
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
php-version:
24+
- '8.1' # Latest supported
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Setup PHP ${{ matrix.php-version }}
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php-version }}
32+
tools: composer
33+
coverage: none
34+
env:
35+
# Always use latest available patch for the version
36+
update: true
37+
38+
- name: Setup cache
39+
id: cache
40+
uses: actions/cache@v2
41+
with:
42+
path: |
43+
~/.composer
44+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
45+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}
46+
47+
- name: Build
48+
run: make build
49+
50+
- name: ComposerRequireChecker
51+
uses: docker://webfactory/composer-require-checker:3.2.0

.github/workflows/CI-DepsChecker.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'CI - Dependencies check'
2+
on:
3+
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- requested
8+
9+
concurrency:
10+
group: "CI-${{ github.head_ref }}"
11+
cancel-in-progress: true
12+
13+
env:
14+
# Cache params
15+
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)
16+
17+
jobs:
18+
check:
19+
name: Dependencies check
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
php-version:
24+
- '8.1' # Latest supported
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Setup PHP ${{ matrix.php-version }}
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php-version }}
32+
tools: composer
33+
coverage: none
34+
env:
35+
# Always use latest available patch for the version
36+
update: true
37+
38+
- name: Setup cache
39+
id: cache
40+
uses: actions/cache@v2
41+
with:
42+
path: |
43+
~/.composer
44+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
45+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}
46+
47+
- name: Build
48+
run: make build
49+
50+
- name: Dependencies check
51+
uses: actions/dependency-review-action@v1

.github/workflows/CI-nightly.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: 'CI - Nightly'
2+
on:
3+
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
9+
concurrency:
10+
group: "CI-${{ github.head_ref }}"
11+
cancel-in-progress: true
12+
13+
env:
14+
# Cache params
15+
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)
16+
TEST_OUTPUT_STYLE: pretty
17+
COMPOSER_OPTIONS: --optimize-autoloader --ignore-platform-req=php+
18+
19+
jobs:
20+
tests:
21+
name: Nightly - Symfony ${{ matrix.symfony-version }}
22+
needs: [ static-tests, tests ]
23+
runs-on: ubuntu-latest
24+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
25+
strategy:
26+
fail-fast: false
27+
max-parallel: 4
28+
# Perform tests against:
29+
# - current php dev version with all supported symfony version
30+
# - next Symfony minor version to manage with latest supported php version
31+
matrix:
32+
php-version:
33+
- '8.2' # Current php dev version
34+
symfony-version:
35+
- '4.4' # Lowest LTS
36+
- '5.4' # Latest LTS
37+
include:
38+
- symfony-version: '6.0' # Next symfony minor version to manage with latest supported PHP version
39+
php-version: '8.1'
40+
41+
steps:
42+
- name: Check out code
43+
uses: actions/checkout@v2
44+
45+
- name: Setup PHP ${{ matrix.php-version }}
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: '${{ matrix.php-version }}'
49+
tools: composer
50+
coverage: none
51+
env:
52+
# Always use latest available patch for the version
53+
update: true
54+
55+
- name: Setup cache
56+
id: cache
57+
uses: actions/cache@v2
58+
with:
59+
path: |
60+
~/.composer
61+
./vendor
62+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
63+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
64+
65+
- name: Build
66+
run: |
67+
composer require -W ${{ env.COMPOSER_OPTIONS }} \
68+
symfony/http-foundation:^${{ matrix.symfony-version }} \
69+
symfony/http-kernel:^${{ matrix.symfony-version }} \
70+
symfony/config:^${{ matrix.symfony-version }} \
71+
symfony/dependency-injection:^${{ matrix.symfony-version }} \
72+
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
73+
symfony/routing:^${{ matrix.symfony-version }} \
74+
&& make build
75+
76+
- name: Test
77+
run: make test-unit && make test-functional

.github/workflows/CI.yml

+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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: "CI-${{ github.head_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+
jobs:
27+
tests:
28+
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
29+
runs-on: ubuntu-latest
30+
env:
31+
COVERAGE_TYPE: none
32+
strategy:
33+
fail-fast: true
34+
max-parallel: 4
35+
matrix:
36+
php-version:
37+
- '7.3' # Lowest supported
38+
- '7.4' # Latest php 7 version
39+
- '8.0' # First php 8 version
40+
- '8.1' # Latest supported
41+
symfony-version:
42+
- '4.4' # Lowest LTS
43+
- '5.4' # Latest LTS
44+
exclude:
45+
# Run all symfony version only on Lowest and Latest php versions, run it only one time for others
46+
- php-version: '8.0'
47+
symfony-version: '4.4'
48+
- php-version: '7.4'
49+
symfony-version: '5.4'
50+
steps:
51+
- name: Check out code
52+
uses: actions/checkout@v2
53+
54+
- name: Enable coverage
55+
if: ${{ matrix.php-version == '8.1' }}
56+
run: |
57+
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
58+
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
59+
60+
- name: Setup PHP ${{ matrix.php-version }}
61+
uses: shivammathur/setup-php@v2
62+
with:
63+
php-version: '${{ matrix.php-version }}'
64+
tools: composer
65+
coverage: ${{ env.COVERAGE_TYPE }}
66+
env:
67+
# Always use latest available patch for the version
68+
update: true
69+
70+
- name: Setup cache
71+
id: cache
72+
uses: actions/cache@v2
73+
with:
74+
path: |
75+
~/.composer
76+
./vendor
77+
${{ env.CODACY_CACHE_PATH }}
78+
build/behat-code-coverage-cache
79+
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
80+
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
81+
82+
- name: Download codacy binary
83+
if: steps.cache.outputs.cache-hit != 'true'
84+
run: |
85+
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
86+
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
87+
&& chmod +x ${{ env.CODACY_BIN }} \
88+
&& ${{ env.CODACY_BIN }} download
89+
90+
- name: Build
91+
run: |
92+
composer require -W \
93+
symfony/http-foundation:^${{ matrix.symfony-version }} \
94+
symfony/http-kernel:^${{ matrix.symfony-version }} \
95+
symfony/config:^${{ matrix.symfony-version }} \
96+
symfony/dependency-injection:^${{ matrix.symfony-version }} \
97+
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
98+
symfony/routing:^${{ matrix.symfony-version }} \
99+
&& make build
100+
101+
- name: Tests
102+
run: make test-unit && make test-functional
103+
104+
# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
105+
- name: Upload unit tests coverage to codecov
106+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
107+
uses: codecov/codecov-action@v3
108+
with:
109+
file: "build/coverage-phpunit/unit.clover"
110+
name: "unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
111+
flags: "unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
112+
fail_ci_if_error: true
113+
114+
- name: Upload functional tests coverage to codecov
115+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
116+
uses: codecov/codecov-action@v3
117+
with:
118+
files: "build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
119+
name: "functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
120+
flags: "functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
121+
fail_ci_if_error: true
122+
123+
- name: Upload coverages to Codacy
124+
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
125+
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
126+
127+
finalize-codacy-coverage-report:
128+
runs-on: ubuntu-latest
129+
name: Finalize Codacy coverage report
130+
needs: [ tests ]
131+
steps:
132+
- name: Setup cache
133+
id: cache
134+
uses: actions/cache@v2
135+
with:
136+
path: |
137+
${{ env.CODACY_CACHE_PATH }}
138+
key: ${{ env.CACHE_VERSION }}-codacy-final
139+
140+
- name: Download codacy binary
141+
if: steps.cache.outputs.cache-hit != 'true'
142+
run: |
143+
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
144+
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
145+
&& chmod +x ${{ env.CODACY_BIN }} \
146+
&& ${{ env.CODACY_BIN }} download
147+
148+
- name: Finalize reporting
149+
run: ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}

0 commit comments

Comments
 (0)