Skip to content

Commit 742a68c

Browse files
committed
Feature/Update CI configurations for PHP 8.3 and add SonarCloud integration
1 parent 44006d7 commit 742a68c

File tree

5 files changed

+66
-21
lines changed

5 files changed

+66
-21
lines changed

.github/workflows/documentation.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,25 @@ on:
66

77
jobs:
88
publish:
9+
name: Publish Documentation
910
runs-on: ubuntu-latest
1011

11-
strategy:
12-
matrix:
13-
php-version: [ '8.2' ]
14-
1512
steps:
1613
- name: Checkout source code
17-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
1817

1918
- name: Install PHP
2019
uses: shivammathur/setup-php@v2
2120
with:
22-
php-version: ${{ matrix.php-version }}
21+
php-version: '8.3'
2322
extensions: mbstring
2423
coverage: xdebug
2524
tools: composer:v2
2625

2726
- name: Cache dependencies
28-
uses: actions/cache@v2
27+
uses: actions/cache@v4.3.0
2928
with:
3029
path: ~/.composer/cache
3130
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}

.github/workflows/sonar.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
types: [ 'opened', 'synchronize', 'reopened' ]
8+
9+
jobs:
10+
sonarcloud:
11+
name: SonarCloud Analysis
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout source code
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Install PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.3'
24+
coverage: xdebug
25+
tools: composer:v2
26+
27+
- name: Cache dependencies
28+
uses: actions/cache@v4.3.0
29+
with:
30+
path: ~/.composer/cache
31+
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
32+
restore-keys: php-${{ matrix.php-version }}-composer-
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate
36+
37+
- name: Install Dependencies
38+
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
39+
40+
- name: Execute Unit, Integration and Acceptance Tests
41+
run: composer test
42+
43+
- name: Fix paths in coverage reports for Sonar
44+
run: |
45+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
46+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
47+
48+
- name: Run SonarCloud Scan
49+
uses: SonarSource/sonarcloud-github-action@v2
50+
with:
51+
projectBaseDir: .
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/test.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ on:
88

99
jobs:
1010
test:
11+
name: Test on PHP ${{ matrix.php-version }}
1112
runs-on: ubuntu-latest
1213

1314
strategy:
1415
matrix:
15-
php-version: [ '8.2', '8.3' ]
16+
php-version: [ '8.2', '8.3', '8.4']
1617

1718
steps:
1819
- name: Checkout source code
@@ -28,7 +29,7 @@ jobs:
2829
tools: composer:v2
2930

3031
- name: Cache dependencies
31-
uses: actions/cache@v2
32+
uses: actions/cache@v4.3.0
3233
with:
3334
path: ~/.composer/cache
3435
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
@@ -37,7 +38,7 @@ jobs:
3738
- name: Validate composer.json and composer.lock
3839
run: composer validate
3940

40-
- name: Install dependencies
41+
- name: Install Dependencies
4142
if: steps.composer-cache.outputs.cache-hit != 'true'
4243
run: composer install --prefer-dist --no-progress --no-suggest
4344

@@ -46,14 +47,3 @@ jobs:
4647

4748
- name: Execute Unit, Integration and Acceptance Tests
4849
run: composer test
49-
50-
- name: Fix coverage.xml for Sonar
51-
run: |
52-
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
53-
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
54-
55-
- name: SonarCloud Scan
56-
uses: SonarSource/sonarcloud-github-action@master
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ composer.lock
1111
wiki/Home.md
1212
/.phpunit.cache
1313
.phpactor.json
14+
/.serena/

sonar-project.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ sonar.sources=src
66
sonar.tests=tests
77
sonar.php.coverage.reportPaths=coverage.xml
88
sonar.php.tests.reportPath=test.xml
9+
sonar.branch.name=main

0 commit comments

Comments
 (0)