-
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (75 loc) · 2.91 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
73
74
75
76
77
78
79
name: Test
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
local:
name: Local (${{ matrix.php-version }})
runs-on: ubuntu-latest
permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
strategy:
fail-fast: false
matrix:
php-version: ["7.4", "8.1", "8.2"]
steps:
- uses: actions/checkout@v4
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHPStan
continue-on-error: true
run: vendor/bin/phpstan analyze --configuration=tests/phpstan.neon --error-format=sarif --xdebug "tests/" > local-results.sarif
- uses: actions/upload-artifact@v4
with:
name: local-${{ matrix.php-version }}
path: local-results.sarif
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: local-results.sarif
wait-for-processing: true
package:
name: Package ${{ matrix.version }} (${{ matrix.php-version }})
runs-on: ubuntu-latest
permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
strategy:
fail-fast: false
matrix:
php-version: ["7.4", "8.1", "8.2"]
version: ["dev-master", "1.0"]
steps:
- uses: actions/checkout@v4
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- run: rm composer.*
- name: Install PHPStan SARIF Formatter
run: composer require --dev --prefer-dist --no-progress phpstan/phpstan jbelien/phpstan-sarif-formatter:${{ matrix.version }}
- name: Run PHPStan
continue-on-error: true
run: vendor/bin/phpstan analyze --configuration=tests/phpstan.neon --error-format=sarif --xdebug "tests/" > package-results.sarif
- uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.version }}-${{ matrix.php-version }}
path: package-results.sarif
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: package-results.sarif
wait-for-processing: true