-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (47 loc) · 1.62 KB
/
test.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
name: Test
on:
push:
branches: [ 'main' ]
pull_request:
types: [ 'opened', 'synchronize', 'reopened' ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
tools: composer:v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php-version }}-composer-
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
- name: Execute Static Code analysis
run: composer analyse
- name: Execute Unit, Integration and Acceptance Tests
run: composer test
- name: Fix coverage.xml for Sonar
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' test.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}