Skip to content

Commit 2819fc4

Browse files
committed
fix test in CI
1 parent 1ba898c commit 2819fc4

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

.github/workflows/publish-v4-release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
JAVA_VERSION: 21
99
JAVA_DISTRIBUTION: zulu
1010
GRADLE_VERSION: 8.5
11+
NODE_VERSION: 22
1112
IS_CI: true
1213
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
1314
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
@@ -30,6 +31,10 @@ jobs:
3031
distribution: ${{ env.JAVA_DISTRIBUTION }}
3132
java-version: ${{ env.JAVA_VERSION }}
3233
cache: 'gradle'
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ env.NODE_VERSION }}
3338
- name: Run All Tests pre release
3439
uses: gradle/actions/setup-gradle@v3
3540
with:
@@ -56,7 +61,9 @@ jobs:
5661
distribution: ${{ env.JAVA_DISTRIBUTION }}
5762
java-version: ${{ env.JAVA_VERSION }}
5863
cache: 'gradle'
59-
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: ${{ env.NODE_VERSION }}
6067
# setup Gradle
6168
- name: Gradle Publish Release
6269
uses: gradle/actions/setup-gradle@v3

.github/workflows/publish-v4-snapshot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env:
2121
JAVA_VERSION: 21
2222
JAVA_DISTRIBUTION: zulu
2323
GRADLE_VERSION: 8.5
24+
NODE_VERSION: 22
2425
IS_CI: true
2526
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
2627
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
@@ -49,7 +50,7 @@ jobs:
4950

5051
- uses: actions/setup-node@v4
5152
with:
52-
node-version: 20
53+
node-version: ${{ env.NODE_VERSION }}
5354

5455
- name: Setup Gradle
5556
uses: gradle/actions/setup-gradle@v3
@@ -79,10 +80,9 @@ jobs:
7980
java-version: ${{ env.JAVA_VERSION }}
8081
cache: 'gradle'
8182

82-
# setup Node
8383
- uses: actions/setup-node@v4
8484
with:
85-
node-version: 20
85+
node-version: ${{ env.NODE_VERSION }}
8686

8787
- name: Publish snapshots
8888
uses: gradle/actions/setup-gradle@v3

build.gradle.kts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,13 @@ idea {
171171
}
172172
}
173173

174-
174+
// https://kotlinlang.org/docs/js-project-setup.html#node-js
175+
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
176+
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().apply {
177+
// CI 中配置环境,不再单独下载
178+
if (isCi) {
179+
download = false
180+
}
181+
}
182+
// "true" for default behavior
183+
}

buildSrc/src/main/kotlin/JsConfig.kt

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@
2222
*/
2323

2424
import org.gradle.api.Project
25-
import org.gradle.kotlin.dsl.the
26-
import org.gradle.kotlin.dsl.withType
2725
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
2826
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
29-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
3027

3128

3229
inline fun KotlinJsTargetDsl.configJs(
@@ -77,7 +74,8 @@ inline fun KotlinWasmJsTargetDsl.configWasmJs(
7774
block: () -> Unit = {}
7875
) {
7976
if (nodeJs) {
80-
nodejs()
77+
nodejs {
78+
}
8179
}
8280
// if (nodeJs && isLinux) {
8381
// // win in candy node `21.0.0-v8-canary202309143a48826a08` is not supported
@@ -100,18 +98,18 @@ inline fun KotlinWasmJsTargetDsl.configWasmJs(
10098
}
10199

102100
inline fun Project.configWasmJsTest(block: () -> Unit = {}) {
103-
if (false) {
104-
// see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
105-
rootProject.the<NodeJsRootExtension>().apply {
106-
// nodeVersion = "21.0.0-v8-canary202309143a48826a08"
107-
version = "21.0.0-v8-canary202309143a48826a08"
108-
downloadBaseUrl = "https://nodejs.org/download/v8-canary"
109-
}
110-
111-
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
112-
args.add("--ignore-engines")
113-
}
114-
}
101+
// if (false) {
102+
// // see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
103+
// rootProject.the<NodeJsRootExtension>().apply {
104+
// // nodeVersion = "21.0.0-v8-canary202309143a48826a08"
105+
// version = "21.0.0-v8-canary202309143a48826a08"
106+
// downloadBaseUrl = "https://nodejs.org/download/v8-canary"
107+
// }
108+
//
109+
// tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
110+
// args.add("--ignore-engines")
111+
// }
112+
// }
115113

116114
block()
117115
}

0 commit comments

Comments
 (0)