generated from digitalservicebund/java-application-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlefthook.yaml
84 lines (77 loc) · 2.48 KB
/
lefthook.yaml
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
min_version: 1.1.4
commit-msg:
commands:
lint-commit-msg:
run: npx --yes commitlint --edit
pre-commit:
parallel: true
commands:
format-backend:
tags: format backend
root: backend/
run: ./gradlew spotlessApply -DspotlessFiles=$(echo {staged_files} | sed 's/ /,/g') && git add {staged_files}
frontend-typecheck:
tags: format frontend
root: frontend/
glob: "*.{ts,vue}"
run: npm run --silent type:check
frontend-prettier:
tags: format frontend
root: frontend/
glob: "*.{vue,ts,js,json}"
run: npm run --silent prettier:fix {staged_files} && git add {staged_files}
frontend-eslint:
tags: frontend lint
root: frontend/
glob: "*.{vue,ts,js,json}"
run: npm run --silent eslint:fix {staged_files} && git add {staged_files}
frontend-stylelint:
tags: frontend lint
root: frontend/
run: npm run --silent stylelint:fix {staged_files} && git add {staged_files}
pre-push:
parallel: true
commands:
licenses-audit-backend:
tags: licenses audit backend
root: backend/
run: ./gradlew checkLicense
licenses-audit-frontend:
tags: licenses audit frontend
root: frontend/
run: npm run audit:licences > /dev/null;
check-pipeline-status:
run: |
which gh 2>&1 >/dev/null ||
(echo "You need to install and configure Github CLI."; exit 1)
# Check current brunch, skipping if not main.
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [[ "$current_branch" != "main" ]]; then
echo "Skipping pipeline status. Performs check only on main branch"
exit 0
fi
conclusion="$(
gh run list --branch main --workflow pipeline --json conclusion,status \
--jq '[.[] | select(.status=="completed")][0].conclusion' \
)"
if [[ "$conclusion" != "success" ]]; then
echo "The last completed pipeline run has failed!"
echo "If you intend to fix the pipeline use '--no-verify', BUT ONLY IF all other hooks are okay."
exit 1
fi
tests:
follow: true
parallel: true
commands:
frontend-tests:
tags: frontend tests
root: frontend/
run: npm run check 2>&1
backend-unit-tests:
tags: backend tests
root: backend/
run: ./gradlew test -x integrationTest 2>&1
backend-integration-tests:
tags: backend tests
root: backend/
run: ./gradlew integrationTest -x test 2>&1