-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (63 loc) · 2.32 KB
/
php.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
name: PHP Composer
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.1', '8.2']
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
- name: Setup PHP
id: php-setup
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: post_max_size=256M, log_errors=1
coverage: xdebug
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --ignore-platform-reqs --prefer-dist --no-progress --no-suggest
- name: Scan with PHP CS Fixer
run: PHP_CS_FIXER_IGNORE_ENV=1 composer run-script fixer
- name: Scan with test PHP Code Sniffer
run: composer run-script cs
- name: Run static analysis
run: composer run-script analyze
- name: Run test suite
run: composer run-script test -- --coverage-clover=clover.xml --log-junit=junit.xml
- name: Estimate coverage
if: ${{ matrix.php-version == '7.4' }}
run: composer run-script infection
- name: Process clover file
if: ${{ matrix.php-version == '7.4' }}
run: sed 's~/home/runner/work/php-etl-google-analytics-extractor/php-etl-google-analytics-extractor/~~' clover.xml > coverage.xml
- name: SonarCloud Scan
if: ${{ matrix.php-version == '7.4' }}
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.projectVersion=${{ steps.previoustag.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}