This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (89 loc) · 2.59 KB
/
main.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Lint & Test
on:
push:
branches:
- 1.0.x
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
include:
- drupal: "10"
php: "8.2"
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Cache dependencies
uses: wunderwerkio/cache-composer@main
with:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.spoons.lock') }}
- name: Install drupal
uses: wunderwerkio/setup-drupal-spoons@main
with:
drupal-core-constraint: "^${{ matrix.drupal }}"
- name: Lint
run: composer run-script phpcs
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- drupal: "9"
php: "8.1"
- drupal: "10"
php: "8.1"
- drupal: "10"
php: "8.2"
steps:
- uses: actions/checkout@v3
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Cache dependencies
uses: wunderwerkio/cache-composer@main
with:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.spoons.lock') }}
- name: Install drupal
uses: wunderwerkio/setup-drupal-spoons@main
with:
drupal-core-constraint: "^${{ matrix.drupal }}"
- name: Test
run: composer run-script unit -- --coverage-clover=coverage.xml --coverage-filter src --coverage-filter modules
- name: Adjust coverage
if: matrix.drupal == '10' && matrix.php == '8.1'
run: |
mv web/coverage.xml coverage.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: Upload coverage
if: matrix.drupal == '10' && matrix.php == '8.1'
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.xml
sonarcloud:
name: Sonar Cloud
runs-on: ubuntu-latest
needs: ['test']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download coverage
uses: actions/download-artifact@v3
with:
name: coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}