File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Unit Tests
2
+ on :
3
+ push :
4
+ paths :
5
+ - ' src/**'
6
+ - ' !**.md'
7
+ env :
8
+ NPM_REGISTRY_URL : npm.pkg.github.com
9
+ NPM_TOKEN : ${{ secrets.NODE_PACKAGE_REGISTRY_READ_TOKEN }}
10
+
11
+ jobs :
12
+ run-tests :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - uses : " actions/checkout@v4"
16
+ - uses : " actions/setup-node@v4"
17
+ with :
18
+ node-version : " 20"
19
+ - name : run tests
20
+ run : |
21
+ SRCS_HAVE_TEST_FOLDER="$(find src -type d -regex 'src/[^/]*/test')"
22
+ if [[ -z SRCS_HAVE_TEST_FOLDER ]]; then
23
+ echo "no test folder detected in the src folder."
24
+ exit 0
25
+ fi
26
+ for SRC_HAS_TEST_FOLDER in $SRCS_HAVE_TEST_FOLDER
27
+ do
28
+ pushd "${SRC_HAS_TEST_FOLDER%/test}"
29
+ if jq '.scripts | has("test")' package.json; then
30
+ npm clean-install
31
+ npm run test
32
+ popd
33
+ fi
34
+ done
You can’t perform that action at this time.
0 commit comments