-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (93 loc) · 3 KB
/
ci.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
name: "Continuous Integration"
on:
push:
branches:
- "hotfix/**"
- "release/**"
- "develop"
- "master"
pull_request:
branches:
- "hotfix/**"
- "release/**"
- "develop"
- "master"
jobs:
latest:
name: "Build & Verify"
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
command: update
--with silverstripe/framework:^5.0
php_version: 8.1
php_extensions: xdebug intl
- name: Generate Code Coverage
run: |
XDEBUG_MODE=coverage \
./vendor/bin/phpunit -c phpunit.xml.dist \
--coverage-clover ./coverage.xml
- name: Annotate with Metrics
run: |
find src -name "*.php" | xargs -n 1 ./vendor/bin/metrics annotate ./coverage.xml
- name: Refactor with Rector
run: |
./vendor/bin/rector process src
- name: Tidy Source Code
run: |
find tests -name "*.php" | xargs -n 1 ./vendor/bin/phptidy.php replace
find src -name "*.php" | xargs -n 1 ./vendor/bin/phptidy.php replace
- name: Push Back Changes
run: |
git diff --exit-code src || ( \
git config user.name github-actions && \
git config user.email github-actions@github.com && \
git add src && \
git commit -m "tidy" && \
git fetch --unshallow origin ${{ github.head_ref || github.ref_name }} && \
git push origin HEAD:${{ github.head_ref || github.ref_name }} \
)
matrix:
strategy:
fail-fast: false
matrix:
include:
- operating-system: 'ubuntu-latest'
silverstripe-version: '5.0'
php-version: '8.1'
- operating-system: 'ubuntu-latest'
silverstripe-version: '4.0'
php-version: '8.0'
- operating-system: 'ubuntu-latest'
silverstripe-version: '4.0'
php-version: '7.4'
name: "Matrix: SS ${{ matrix.silverstripe-version }}, PHP ${{ matrix.php-version }}"
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
command: update
--with silverstripe/framework:^${{ matrix.silverstripe-version }}
php_version: ${{ matrix.php-version }}
php_extensions: intl
- run: |
./vendor/bin/phpunit -c phpunit.xml.dist
merge:
name: "Merge Changes"
if: github.event_name == 'push'
needs: [latest,matrix]
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- run: |
false || ( \
git config user.name github-actions && \
git config user.email github-actions@github.com && \
git fetch --unshallow origin ${{ github.ref_name }} develop && \
git checkout develop && \
git merge origin/${{ github.ref_name }} && \
git push \
)