-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (92 loc) · 3.16 KB
/
continuous_integration.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
106
107
108
109
110
111
112
name: Continuous Integration Workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.2', '8.3' ]
include:
- php-version: '8.3'
latest: true
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Validate composer.lock is up to date
run: composer validate --no-check-all --strict
- name: Get Composer Cache Directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Check code style with Pint
if: matrix.latest == true
id: pint-check
run: composer run pint -- --test
continue-on-error: true
- name: Apply Pint fixes
if: matrix.latest == true && steps.pint-check.outcome == 'failure'
run: |
composer run pint
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git add .
git diff --staged --quiet || {
git commit -m "Apply Pint fixes"
git pull --rebase origin ${{ github.head_ref || github.ref_name }}
git push origin HEAD:${{ github.head_ref || github.ref_name }}
}
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- run: composer install --prefer-dist --no-progress
- run: composer run stan
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Get Composer Cache Directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run coverage-min (with 80% minimum coverage requirement)
run: composer run coverage-min
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage