Skip to content

Commit ea88b06

Browse files
committedJan 22, 2025·
Update CI tests and add shadow-cljs to run cljs tests
1 parent ada41ec commit ea88b06

File tree

8 files changed

+1950
-2625
lines changed

8 files changed

+1950
-2625
lines changed
 

‎.github/workflows/testsuite.yml

+36-23
Original file line numberDiff line numberDiff line change
@@ -16,81 +16,94 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
20+
2021
- name: Cache dependencies
21-
uses: actions/cache@v2
22+
uses: actions/cache@v4
2223
with:
2324
path: ~/.m2/repository
2425
key: ${{ runner.os }}-clj-${{ hashFiles('**/project.clj') }}
2526
restore-keys: |
2627
${{ runner.os }}-clj-
28+
2729
- name: Setup Java ${{ matrix.jdk }}
28-
uses: actions/setup-java@v1.4.3
30+
uses: actions/setup-java@v4
2931
with:
32+
distribution: temurin
3033
java-version: ${{ matrix.jdk }}
34+
3135
- name: Setup Clojure
32-
uses: DeLaGuardo/setup-clojure@3.1
36+
uses: DeLaGuardo/setup-clojure@13.1
3337
with:
3438
lein: 2.9.5
35-
- name: Install dependencies
36-
run: |
37-
npm ci
39+
3840
- name: Run tests
3941
run: ./scripts/test.sh clj
4042

4143
build-cljs:
4244
name: ClojureScript
4345
runs-on: ubuntu-latest
4446
steps:
45-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
48+
4649
- name: Cache dependencies
4750
uses: actions/cache@v2
4851
with:
4952
path: |
5053
~/.m2/repository
51-
**/node_modules
52-
key: ${{ runner.os }}-cljs-${{ hashFiles('**/project.clj', '**/package-lock.json') }}
54+
key: ${{ runner.os }}-cljs-${{ hashFiles('**/project.clj') }}
5355
restore-keys: |
5456
${{ runner.os }}-cljs-
55-
- name: Setup Java 11
56-
uses: actions/setup-java@v1.4.3
57+
58+
- name: Setup Java
59+
uses: actions/setup-java@v4
5760
with:
58-
java-version: 11
61+
distribution: temurin
62+
java-version: 21
63+
5964
- name: Setup Clojure
60-
uses: DeLaGuardo/setup-clojure@3.1
65+
uses: DeLaGuardo/setup-clojure@13.1
6166
with:
6267
lein: 2.9.5
68+
6369
- name: Setup Node.js
64-
uses: actions/setup-node@v2.1.2
70+
uses: actions/setup-node@v4
6571
with:
66-
node-version: 18
72+
node-version: 22
73+
cache: npm
74+
6775
- name: Install dependencies
68-
run: |
69-
npm ci
70-
- name: Install modules
71-
run: ./scripts/lein-modules install
76+
run: npm ci
77+
78+
# - name: Install modules
79+
# run: ./scripts/lein-modules install
80+
7281
- name: Run tests
7382
run: ./scripts/test.sh cljs
7483

7584
lint:
7685
name: Lint cljdoc.edn
7786
runs-on: ubuntu-latest
7887
steps:
79-
- uses: actions/checkout@v2
88+
- uses: actions/checkout@v4
89+
8090
- name: Verify cljdoc.edn
8191
run: curl -fsSL https://raw.githubusercontent.com/cljdoc/cljdoc/master/script/verify-cljdoc-edn | bash -s doc/cljdoc.edn
8292

8393
check-cljdoc:
8494
name: Check cljdoc analysis
8595
runs-on: ubuntu-latest
8696
steps:
87-
- uses: actions/checkout@v1
97+
- uses: actions/checkout@v4
98+
8899
- name: Setup Clojure
89-
uses: DeLaGuardo/setup-clojure@11.0
100+
uses: DeLaGuardo/setup-clojure@13.1
90101
with:
91102
lein: 2.9.5
92103
cli: 1.11.0.1100
104+
93105
- name: Install cljdoc analyzer
94106
run: clojure -Ttools install io.github.cljdoc/cljdoc-analyzer '{:git/tag "RELEASE"}' :as cljdoc-analyzer
107+
95108
- name: CljDoc Check
96109
run: ./scripts/cljdoc-check.sh

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ pom.xml.asc
1414
figwheel_server.log
1515
/.idea
1616
.clj-kondo
17+
.shadow-cljs

‎karma.conf.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = function (config) {
2+
config.set({
3+
browsers: ['ChromeHeadless'],
4+
// The directory where the output file lives
5+
basePath: 'target/karma',
6+
// The file itself
7+
files: ['ci.js'],
8+
frameworks: ['cljs-test'],
9+
plugins: ['karma-cljs-test', 'karma-chrome-launcher'],
10+
colors: true,
11+
logLevel: config.LOG_INFO,
12+
client: {
13+
args: ["shadow.test.karma.init"],
14+
singleRun: true
15+
},
16+
junitReporter: {
17+
outputDir: "target/results/cljs"
18+
}
19+
})
20+
};

‎package-lock.json

+1,859-2,597
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
"name": "reitit",
33
"private": true,
44
"devDependencies": {
5-
"@seriousme/openapi-schema-validator": "^2.2.1",
6-
"karma": "^4.1.0",
7-
"karma-chrome-launcher": "^2.2.0",
5+
"@seriousme/openapi-schema-validator": "^2.3.1",
6+
"karma": "^6.4.4",
7+
"karma-chrome-launcher": "^3.2.0",
88
"karma-cli": "^2.0.0",
99
"karma-cljs-test": "^0.1.0",
10-
"karma-junit-reporter": "^1.2.0"
10+
"karma-junit-reporter": "^2.0.1"
11+
},
12+
"dependencies": {
13+
"shadow-cljs": "^2.28.20"
1114
}
1215
}

‎project.clj

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
:java-source-paths ["modules/reitit-core/java-src"]
9090

9191
:dependencies [[org.clojure/clojure "1.11.4"]
92+
[thheller/shadow-cljs "2.28.20"]
9293
[org.clojure/clojurescript "1.11.132"]
9394

9495
;; modules dependencies
@@ -128,6 +129,7 @@
128129
[ring-cors "0.1.13"]
129130

130131
[com.bhauman/rebel-readline "0.1.4"]]}
132+
:shadow {:test-paths ["test/cljs"]}
131133
:perf {:jvm-opts ^:replace ["-server"
132134
"-Xmx4096m"
133135
"-Dclojure.compiler.direct-linking=true"]

‎scripts/test.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
set -e
33
case $1 in
44
cljs)
5-
lein "do" test-browser once, test-node once, test-advanced once
5+
npx shadow-cljs compile node-test
6+
node target/shadow-node-test/node-tests.js
7+
8+
npx shadow-cljs compile karma
9+
npx karma start --single-run
610
;;
711
clj)
812
lein test-clj

‎shadow-cljs.edn

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{:lein {:profile "+shadow"}
2+
;; tests are served via http://localhost:8021
3+
:dev-http {8021 "target/shadow-browser-test"}
4+
5+
:builds
6+
{:node-test
7+
{:target :node-test
8+
:output-to "target/shadow-node-test/node-tests.js"
9+
:ns-regexp "-test"
10+
;; Watch will also run the tests
11+
:autorun true}
12+
13+
:browser-test
14+
{:target :browser-test
15+
:test-dir "target/shadow-browser-test"}
16+
17+
:karma
18+
{:target :karma
19+
:output-to "target/karma/ci.js"
20+
:ns-regexp "-test$"}}}

0 commit comments

Comments
 (0)
Please sign in to comment.