-
-
Notifications
You must be signed in to change notification settings - Fork 10
160 lines (154 loc) · 3.87 KB
/
tests.yml
File metadata and controls
160 lines (154 loc) · 3.87 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Tests
env:
BUILD_CLDR_VERSION: "47"
on:
push:
branches:
- main
tags-ignore:
- "**"
paths-ignore:
- .github/workflows/gh-pages.yml
- "gh-pages/**"
pull_request:
branches:
- main
jobs:
php-coding-style:
name: Check PHP coding style
runs-on: ubuntu-latest
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.5"
extensions: mbstring, zip
tools: composer:2, php-cs-fixer:3
coverage: none
-
name: Checkout
uses: actions/checkout@v6
-
name: Check PHP coding style
run: php-cs-fixer fix --config=./.php-cs-fixer.dist.php --dry-run --using-cache=no --diff --show-progress=dots --verbose --no-interaction --ansi
php-syntax:
name: Check PHP syntax
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "5.3"
- "8.5"
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: opcache
tools: none
coverage: none
-
name: Checkout
uses: actions/checkout@v6
-
name: Check PHP syntax
uses: mlocati/check-php-syntax@v1
with:
include: |
bin/export-plural-rules
bin/import-cldr-data
exclude: |
.php-cs-fixer.dist.php
fail-on-warnings: true
phpunit:
name: Run PHPUnit tests
needs:
- php-coding-style
- php-syntax
strategy:
matrix:
os:
- ubuntu-latest
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"
include:
- os: windows-latest
php-version: "5.6"
- os: windows-latest
php-version: "7.4"
- os: windows-latest
php-version: "8.5"
runs-on: ${{ matrix.os }}
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
-
name: Checkout
uses: actions/checkout@v6
-
name: Install Composer dependencies
run: composer update --no-progress --no-suggest --optimize-autoloader --ansi --no-interaction
-
name: Build CLDR data
run: php ./bin/import-cldr-data ${{ env.BUILD_CLDR_VERSION }}
-
name: Run PHPUnit
run: composer --no-interaction run-script test
commit:
name: Commit CLDR data
runs-on: ubuntu-latest
needs: phpunit
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: none
coverage: none
-
name: Checkout
uses: actions/checkout@v6
-
name: Build CLDR data
run: php ./bin/import-cldr-data ${{ env.BUILD_CLDR_VERSION }}
-
name: Check changes
id: check-changes
run: |
git add --all src/cldr-data
if git diff-index --name-status --exit-code HEAD src/cldr-data; then
echo 'No changes detected.'
else
echo 'Changes detected.'
echo 'commit=yes' >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.check-changes.outputs.commit == 'yes'
run: |
git config --local user.name 'GitHub Actions'
git config --local user.email noreply@github.com
git commit -m 'Update CLDR data'
git push