-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (75 loc) · 2.45 KB
/
run_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
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Run Tests
on:
push:
branches: [master]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Validate composer.json and composer.lock
working-directory: .
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
working-directory: .
run: composer install --prefer-dist --no-progress
- name: Run Unit test suite
working-directory: .
run: ./vendor/bin/phpunit --testsuite "Project Test Suite" --do-not-cache-result
- name: Run phpstan
working-directory: .
run: ./vendor/bin/phpstan
- name: Run psalm
working-directory: .
run: ./vendor/bin/psalm
coverage:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
working-directory: .
run: composer install --prefer-dist --no-progress
- name: Run code coverage
working-directory: .
run: php -d xdebug.mode=coverage ./vendor/bin/phpunit --testsuite "Project Test Suite" --do-not-cache-result --coverage-clover clover.xml
- name: Make code coverage badge
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: output/coverage.svg
push_badge: false
- name: Git push to image-data branch
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
publish_branch: badges
github_token: ${{ secrets.PRIVATE_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'