-
Notifications
You must be signed in to change notification settings - Fork 0
302 lines (241 loc) · 9.53 KB
/
project.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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# For more information see: https://docs.github.com/en/actions/
name: Project CI
on:
push:
branches: ['main']
paths: ['**.java', '**.ts', '**.vue', '.github/workflows/**', 'pom.xml', 'package.json', 'yarn.lock']
pull_request:
branches: ['main']
paths: ['**.java', '**.ts', '**.vue', '.github/workflows/**', 'pom.xml', 'package.json', 'yarn.lock']
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
name: Check diffs
outputs:
java: ${{ steps.check-java.outputs.changed }}
node: ${{ steps.check-node.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Java
id: check-java
run: |
if git diff --name-only HEAD^ HEAD | grep -qE '\.java$|pom\.xml'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: node
id: check-node
run: |
if git diff --name-only HEAD^ HEAD | grep -qE '\.ts$|\.vue$|package\.json|yarn\.lock'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Debug outputs
run: |
git diff --name-only HEAD^ HEAD
echo "Java changes: ${{ steps.check-java.outputs.changed }}"
echo "Node changes: ${{ steps.check-node.outputs.changed }}"
notice:
runs-on: ubuntu-latest
env:
JAVA_VERSION: '11'
name: Check notice
needs: changes
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.java == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: maven
- name: Check NOTICE
run: ./mvnw notice:check
license-headers:
runs-on: ubuntu-latest
name: Check and generate license headers
needs: changes
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check license headers
id: check
run: ./scripts/license.sh 1
- name: Generate license headers
if: ${{ github.event_name != 'pull_request' && (needs.changes.outputs.java == 'true' || needs.changes.outputs.node == 'true') && steps.check.conclusion == 'failure' }}
id: generate
run: ./scripts/license.sh 2
- name: Commit changes
if: ${{ github.event_name != 'pull_request' && steps.generate.conclusion == 'success' }}
run: |
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
./scripts/license.sh 3
frontend:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['22', 'latest']
name: Node ${{ matrix.node }}
needs: changes
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.node == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build frontend
run: yarn build
- name: Tests frontend (unit tests)
run: yarn test:unit
# - name: Tests frontend (e2e tests)
# run: yarn test:e2e
backend:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['11', '17']
mariadb: ['10.3', 'latest']
env:
LANG: 'fr_FR.UTF-8'
LC_ALL: 'fr_FR.UTF-8'
LANGUAGE: 'fr_FR.UTF-8'
LC_CTYPE: 'fr_FR.UTF-8'
TZ: 'Europe/Paris'
MARIADB_IMG: 'wodby/mariadb'
JACOCO_JAVA: '11'
JACOCO_MARIADB: '10.3'
name: Java ${{ matrix.java }} & mariadb ${{ matrix.mariadb }}
needs: changes
if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.java == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout badges branch to a badges directory nested inside first checkout
uses: actions/checkout@v4
with:
ref: badges
path: badges
- name: Set timezone
uses: szenius/[email protected]
with:
timezoneLinux: 'Europe/Paris'
- name: Set up locale ENV
run: |
sudo locale-gen $LANG
sudo update-locale LANG=$LANG
sudo apt install net-tools
- name: Check locales
run: locale -a
# - name: Pull ${{ env.MARIADB_IMG }}:${{ matrix.mariadb }} image
# run: docker pull ${{ env.MARIADB_IMG }}:${{ matrix.mariadb }}
# - name: Run MariaDB container
# run: |
# docker run --rm -t -d --name mariadb -v \
# --health-cmd="mysqladmin -uroot -proot ping" --health-interval=10s --health-timeout=10s --health-retries=10 \
# -p 3306:3306/tcp \
# -e "TZ=Europe/Paris" \
# -e "MYSQL_USER=root" \
# -e "MYSQL_ROOT_PASSWORD=root" \
# -e "MYSQL_DATABASE=glc" \
# -e "MYSQL_DEFAULT_STORAGE_ENGINE=InnoDB" \
# -e "MYSQL_CHARACTER_SET_SERVER=utf8mb4" \
# -e "MYSQL_COLLATION_SERVER=utf8mb4_unicode_520_ci" \
# -e "MYSQL_INNODB_BUFFER_POOL_SIZE=2G" \
# -e "MYSQL_INNODB_DEFAULT_ROW_FORMAT=dynamic" \
# -e "MYSQL_INNODB_DATA_FILE_PATH=ibdata1:100M:autoextend:max:10G" \
# -e "MYSQL_INNODB_FLUSH_LOG_AT_TRX_COMMIT=1" \
# -e "MYSQL_INNODB_LOG_BUFFER_SIZE=64M" \
# -e "MYSQL_INNODB_LOG_FILE_SIZE=256M" \
# -e "MYSQL_INNODB_STRICT_MODE=ON" \
# -e "MYSQL_LOWER_CASE_TABLE_NAMES=1" \
# -e "MYSQL_MAX_CONNECT_ERRORS=100" \
# -e "MYSQL_MAX_CONNECTIONS=1000" \
# -e "MYSQL_QUERY_CACHE_LIMIT=10M" \
# -e "MYSQL_QUERY_CACHE_SIZE=0" \
# -e "MYSQL_QUERY_CACHE_TYPE=OFF" \
# ${{ env.MARIADB_IMG }}:${{ matrix.mariadb }} &
# sleep 30
# - name: Test MariaDB
# run: docker exec mariadb /bin/bash -c "mysql -h127.0.0.1 -uroot -proot -e \"show variables like '%time_zone'; select now();\""
# - name: Check date
# run: |
# date
# mysql -h127.0.0.1 -uroot -proot -e "show variables like '%time_zone'; select now();"
# - name: DB connection test and conf checks
# run: |
# netstat -pnltu
# mysql -h127.0.0.1 -uroot -proot -e "show databases;"
# mysql -h127.0.0.1 -uroot -proot -e "show variables like 'char%'; show variables like 'collation%';show variables like 'innodb_default_row_format';"
# mysql -h127.0.0.1 -uroot -proot -e "use glc;show tables;"
# - name: Populate database
# run: mysql -h127.0.0.1 -uroot -proot < ./src/test/resources/glc.sql
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Build backend
run: ./mvnw -B clean package -Pprod -Dmaven.test.skip=true -Darguments="-DskipTests"
# - name: Tests backend
# run: ./mvnw test -Ptest
# - name: Generate JaCoCo badge
# id: jacoco
# uses: cicirello/jacoco-badge-generator@v2
# with:
# badges-directory: badges
# generate-branches-badge: true
# generate-summary: true
# - name: Log coverage percentages to workflow output
# run: |
# echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
# echo "branches = ${{ steps.jacoco.outputs.branches }}"
# - name: Upload JaCoCo coverage report as a workflow artifact
# if: ${{ matrix.mariadb == env.JACOCO_MARIADB }}
# uses: actions/upload-artifact@v4
# with:
# name: jacoco-report-java-${{ matrix.java }}
# path: target/site/jacoco/
# - name: Commit and push the coverage badges and summary file
# if: ${{ github.event_name != 'pull_request' && matrix.java == env.JACOCO_JAVA && matrix.mariadb == env.JACOCO_MARIADB }}
# run: |
# cd badges
# if [[ `git status --porcelain *.svg *.json` ]]; then
# git config --global user.name 'github-actions'
# git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
# git add *.svg *.json
# git commit -m "Autogenerated JaCoCo coverage badges" *.svg *.json
# git push
# fi
# - name: Comment on PR with coverage percentages
# if: ${{ github.event_name == 'pull_request' && matrix.java == env.JACOCO_JAVA && matrix.mariadb == env.JACOCO_MARIADB }}
# run: |
# REPORT=$(<badges/coverage-summary.json)
# COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
# BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
# NEWLINE=$'\n'
# BODY="## JaCoCo Test Coverage Summary Statistics${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
# gh pr comment ${{github.event.pull_request.number}} -b "${BODY}"
# continue-on-error: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}