-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 2.24 KB
/
build.yml
File metadata and controls
65 lines (53 loc) · 2.24 KB
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
name: Build
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
strategy:
fail-fast: false
matrix:
php-versions: ['8.4', '8.5']
dependency-versions: ['lowest', 'highest']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- run: composer validate --strict
- uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
- name: Upgrade analysis tools to latest
if: ${{ matrix.dependency-versions == 'lowest' }}
run: composer update phpstan/phpstan rector/rector phpunit/phpunit squizlabs/php_codesniffer --with-all-dependencies --no-interaction
- run: vendor/bin/phpcs
if: ${{ failure() || success() }}
- run: vendor/bin/phpstan
if: ${{ failure() || success() }}
- run: vendor/bin/rector process --dry-run
if: ${{ failure() || success() }}
- run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover ./clover.xml --log-junit ./phpunit.report.xml
if: ${{ failure() || success() }}
# https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747
# $GITHUB_WORKSPACE contains a slash so @ is used as delimiter
- run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' clover.xml
- run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' phpunit.report.xml
- uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectName=php-date
-Dsonar.projectKey=assoconnect_php-date-bundle
-Dsonar.organization=assoconnect
-Dsonar.sources=src
-Dsonar.tests=tests
-Dsonar.php.coverage.reportPaths=clover.xml
-Dsonar.php.tests.reportPath=phpunit.report.xml