-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (63 loc) · 1.95 KB
/
continuous-integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Continuous Integration
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
env:
fail-fast: true
jobs:
build:
name: PHPUnit
runs-on: ubuntu-22.04
strategy:
matrix:
php-version:
- 8.3
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
- name: Install Composer Dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-stable"
- name: Run PHPUnit
run: vendor/bin/phpunit --log-junit tests/.results/tests-junit.xml --coverage-clover tests/.results/tests-clover.xml
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.php-version }}-${{ matrix.dependencies }}-coverage
include-hidden-files: true
path: tests/.results/
sonarcloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: build-8.3-highest-coverage
path: tests/.results/
- name: Fix Code Coverage Paths
working-directory: tests/.results/
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-clover.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-junit.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}