-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 2.17 KB
/
tests.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
name: tests
on: [ push, pull_request ]
jobs:
tests:
strategy:
matrix:
php-versions: [ '8.1', '8.2', '8.3' ]
runs-on: ubuntu-latest
name: Test on PHP ${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo_mysql
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-progress --no-interaction --ignore-platform-req=php
- name: Start MySQL
run: sudo /etc/init.d/mysql start
- name: Test
if: matrix.php-versions != '8.2'
run: composer test
continue-on-error: true
- name: Test with Coverage
if: matrix.php-versions == '8.2'
working-directory: ./
run: |
composer test-coverage
sed -i 's/\/home\/runner\/work\/testutils\/testutils\//\/github\/workspace\//g' report.xml
sed -i 's/\/home\/runner\/work\/testutils\/testutils\//\/github\/workspace\//g' clover.xml
- name: Scan code with SonarCloud
if: matrix.php-versions == '8.2'
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=mobicms
-Dsonar.projectName=testutils
-Dsonar.projectKey=mobicms_testutils
-Dsonar.sources=./src
-Dsonar.tests=./tests
-Dsonar.sourceEncoding=UTF-8
-Dsonar.php.tests.reportPath=report.xml
-Dsonar.php.coverage.reportPaths=clover.xml