File tree Expand file tree Collapse file tree 3 files changed +55
-6
lines changed
Expand file tree Collapse file tree 3 files changed +55
-6
lines changed Original file line number Diff line number Diff line change 1+ name : Canvas UI PR Pipeline
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+ paths :
8+ - " ui/**"
9+
10+ # Allows you to run this workflow manually from the Actions tab
11+ workflow_dispatch :
12+
13+ env :
14+ # Disable sending data to IBM telemetry
15+ IBM_TELEMETRY_DISABLED : true
16+ CARBON_TELEMETRY_DISABLED : 1
17+
18+ jobs :
19+ ui_code_check :
20+ runs-on : ubuntu-latest
21+ defaults :
22+ run :
23+ working-directory : ./ui
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+
28+ - name : Set up Node
29+ uses : actions/setup-node@v4
30+ with :
31+ node-version : 20
32+ cache : " npm"
33+ cache-dependency-path : " ./ui/package-lock.json"
34+
35+ - name : Install dependencies
36+ run : npm ci
37+
38+ - name : Run unit tests
39+ run : npm test
40+
41+ - name : Check Linting
42+ run : npm run lint
43+
44+ - name : Check Formatting
45+ run : npm run check-format
46+
47+ - name : Test Build
48+ run : npm run build -- --base /keip-canvas/
Original file line number Diff line number Diff line change 11#! /bin/sh
22#
33# An example hook script to verify what is about to be committed.
4- # Called by "git commit" with no arguments. The hook should
4+ # Called by "git commit" with no arguments. The hook should
55# exit with non-zero status after issuing an appropriate message if
66# it wants to stop the commit.
77#
8- # To enable this hook, rename this file to " pre-commit".
8+ # To enable this hook, create this file at ".git/hooks/ pre-commit" with execute permissions .
99
1010UI_DIR_PATTERN=' ^ui/src/'
1111
1212git diff --cached --name-only | grep ${UI_DIR_PATTERN} --quiet
1313IS_UI_CHANGED=$?
1414
1515if [ ${IS_UI_CHANGED} -ne 0 ]; then
16- echo " [pre-commit hook] No UI code changes detected. Skip linting ."
16+ echo " [pre-commit hook] No UI code changes detected. Skip precommit check ."
1717 exit 0
1818fi
1919
20- LINT_CMD =' npm --prefix ./ui run lint -- --color '
20+ PRECOMMIT_CMD =' npm --prefix ./ui run precommit '
2121
22- echo " [pre-commit hook] Linting ...\n"
22+ echo " [pre-commit hook] Lint and check formatting ...\n"
2323
24- if output=$( ${LINT_CMD } ) ; then
24+ if output=$( ${PRECOMMIT_CMD } ) ; then
2525 exit 0
2626else
2727 echo " $output " >&2
Original file line number Diff line number Diff line change 1111 "format" : " prettier --write ./src" ,
1212 "lint" : " eslint ." ,
1313 "preview" : " vite preview" ,
14+ "precommit" : " npm run lint -- --color && npm run check-format" ,
1415 "test" : " vitest run --silent"
1516 },
1617 "engines" : {
You can’t perform that action at this time.
0 commit comments