-
-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (177 loc) · 6.5 KB
/
ci.yml
File metadata and controls
209 lines (177 loc) · 6.5 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: CI
on:
pull_request:
paths:
- 'plugins/**'
jobs:
phpunit:
name: PHPUnit (${{ matrix.plugin }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- plugin: fchub-p24
has_tests: true
- plugin: fchub-memberships
has_tests: true
- plugin: fchub-stream
has_tests: true
- plugin: fchub-wishlist
has_tests: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for changes
id: changes
run: |
CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..HEAD -- plugins/${{ matrix.plugin }}/ | wc -l)
echo "count=$CHANGED" >> "$GITHUB_OUTPUT"
- name: Setup PHP
if: steps.changes.outputs.count > 0
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
coverage: none
- name: Install dependencies
if: steps.changes.outputs.count > 0
working-directory: plugins/${{ matrix.plugin }}
run: composer install --no-interaction --prefer-dist
- name: Run PHPUnit
if: steps.changes.outputs.count > 0
working-directory: plugins/${{ matrix.plugin }}
run: ./vendor/bin/phpunit
- name: Run LOC budget check (fchub-wishlist)
if: steps.changes.outputs.count > 0 && matrix.plugin == 'fchub-wishlist'
working-directory: plugins/fchub-wishlist
run: bash scripts/check-loc.sh
vite-build-memberships:
name: Vite Build (fchub-memberships)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for changes
id: changes
run: |
CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..HEAD -- plugins/fchub-memberships/ | wc -l)
echo "count=$CHANGED" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
if: steps.changes.outputs.count > 0
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: plugins/fchub-memberships/package-lock.json
- name: Install and build
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-memberships
run: |
npm ci
npm run build
- name: Validate build output
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-memberships
run: |
if [ ! -d "assets/dist" ] || [ -z "$(ls -A assets/dist)" ]; then
echo "::error::Build produced no output in assets/dist/"
exit 1
fi
JS_COUNT=$(find assets/dist -name "*.js" | wc -l)
if [ "$JS_COUNT" -eq 0 ]; then
echo "::error::No JS files found in assets/dist/"
exit 1
fi
echo "Build validation passed: $JS_COUNT JS file(s) in assets/dist/"
vite-build-portal-extender:
name: Vite Build (fchub-portal-extender)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for changes
id: changes
run: |
CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..HEAD -- plugins/fchub-portal-extender/ | wc -l)
echo "count=$CHANGED" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
if: steps.changes.outputs.count > 0
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: plugins/fchub-portal-extender/package-lock.json
- name: Install and build
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-portal-extender
run: |
npm ci
npm run build
- name: Validate build output
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-portal-extender
run: |
if [ ! -d "assets/dist" ] || [ -z "$(ls -A assets/dist)" ]; then
echo "::error::Build produced no output in assets/dist/"
exit 1
fi
JS_COUNT=$(find assets/dist -name "*.js" | wc -l)
if [ "$JS_COUNT" -eq 0 ]; then
echo "::error::No JS files found in assets/dist/"
exit 1
fi
echo "Build validation passed: $JS_COUNT JS file(s) in assets/dist/"
vite-build-stream:
name: Vite Build (fchub-stream)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for changes
id: changes
run: |
CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..HEAD -- plugins/fchub-stream/ | wc -l)
echo "count=$CHANGED" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
if: steps.changes.outputs.count > 0
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build admin-app
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-stream/admin-app
run: |
npm ci
npm run build
- name: Validate admin-app build
if: steps.changes.outputs.count > 0
run: |
if [ ! -d "plugins/fchub-stream/admin/dist" ] || [ -z "$(ls -A plugins/fchub-stream/admin/dist)" ]; then
echo "::error::admin-app build produced no output in admin/dist/"
exit 1
fi
JS_COUNT=$(find plugins/fchub-stream/admin/dist -name "*.js" | wc -l)
if [ "$JS_COUNT" -eq 0 ]; then
echo "::error::No JS files found in admin/dist/"
exit 1
fi
echo "admin-app build validation passed: $JS_COUNT JS file(s)"
- name: Build portal-app
if: steps.changes.outputs.count > 0
working-directory: plugins/fchub-stream/portal-app
run: |
npm ci
npm run build
- name: Validate portal-app build
if: steps.changes.outputs.count > 0
run: |
if [ ! -d "plugins/fchub-stream/portal-app/dist" ] || [ -z "$(ls -A plugins/fchub-stream/portal-app/dist)" ]; then
echo "::error::portal-app build produced no output in portal-app/dist/"
exit 1
fi
JS_COUNT=$(find plugins/fchub-stream/portal-app/dist -name "*.js" | wc -l)
if [ "$JS_COUNT" -eq 0 ]; then
echo "::error::No JS files found in portal-app/dist/"
exit 1
fi
echo "portal-app build validation passed: $JS_COUNT JS file(s)"