Skip to content

Commit 827a78d

Browse files
authored
Merge pull request #63 from qiaoyuang/main
Optimize the processing of CI/CD
2 parents 4aeaa95 + af02810 commit 827a78d

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
4747

4848
- name: Build sqllin-driver
49-
run: ./gradlew :sqllin-driver:assemble
49+
run: ./gradlew :sqllin-driver:assemble -PonCICD
5050

5151
- name: Run sqllin-driver macOS X64 Tests
5252
run: ./test_driver_macos.sh
@@ -55,7 +55,7 @@ jobs:
5555
run: ./test_driver_jvm.sh
5656

5757
- name: Build sqllin-dsl
58-
run: ./gradlew :sqllin-dsl:assemble
58+
run: ./gradlew :sqllin-dsl:assemble -PonCICD
5959

6060
- name: Run sqllin-dsl macOS X64 Tests
6161
run: ./test_dsl_macos.sh
@@ -203,7 +203,7 @@ jobs:
203203
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
204204

205205
- name: Build sqllin-driver
206-
run: ./gradlew :sqllin-driver:assemble
206+
run: ./gradlew :sqllin-driver:assemble -PonCICD
207207

208208
- name: Run sqllin-driver Linux X64 Tests
209209
run: ./test_driver_linux.sh
@@ -215,7 +215,7 @@ jobs:
215215
run: ./gradlew :sqllin-processor:assemble
216216

217217
- name: Build sqllin-dsl
218-
run: ./gradlew :sqllin-dsl:assemble
218+
run: ./gradlew :sqllin-dsl:assemble -PonCICD
219219

220220
- name: Run sqllin-dsl Linux X64 Tests
221221
run: ./test_dsl_linux.sh

.github/workflows/publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
4242

4343
- name: Build sqllin-driver
44-
run: ./gradlew :sqllin-driver:assemble
44+
run: ./gradlew :sqllin-driver:assemble -PonCICD
4545

4646
- name: Run sqllin-driver macOS X64 Tests
4747
run: ./test_driver_macos.sh
@@ -50,7 +50,7 @@ jobs:
5050
run: ./test_driver_jvm.sh
5151

5252
- name: Build sqllin-dsl
53-
run: ./gradlew :sqllin-dsl:assemble
53+
run: ./gradlew :sqllin-dsl:assemble -PonCICD
5454

5555
- name: Run sqllin-dsl macOS X64 Tests
5656
run: ./test_dsl_macos.sh
@@ -110,7 +110,7 @@ jobs:
110110
if: always()
111111

112112
- name: Publish to MavenCentral
113-
run: ./publish_apple_android.sh
113+
run: ./publish_apple_android_jvm.sh
114114

115115
build-on-windows:
116116
runs-on: windows-latest
@@ -204,7 +204,7 @@ jobs:
204204
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
205205

206206
- name: Build sqllin-driver
207-
run: ./gradlew :sqllin-driver:assemble
207+
run: ./gradlew :sqllin-driver:assemble -PonCICD
208208

209209
- name: Run sqllin-driver Linux X64 Tests
210210
run: ./test_driver_linux.sh
@@ -216,7 +216,7 @@ jobs:
216216
run: ./gradlew :sqllin-processor:assemble
217217

218218
- name: Build sqllin-dsl
219-
run: ./gradlew :sqllin-dsl:assemble
219+
run: ./gradlew :sqllin-dsl:assemble -PonCICD
220220

221221
- name: Run sqllin-dsl Linux X64 Tests
222222
run: ./test_dsl_linux.sh
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Publish artifacts on macOS env
2-
./gradlew :sqllin-driver:publishAllPublicationsToMavenRepository
3-
./gradlew :sqllin-dsl:publishAllPublicationsToMavenRepository
2+
./gradlew :sqllin-driver:publishAllPublicationsToMavenRepository -PonCICD
3+
./gradlew :sqllin-dsl:publishAllPublicationsToMavenRepository -PonCICD

publish_linux_processor.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Publish artifacts on Linux env
22
./gradlew :sqllin-driver:publishLinuxX64PublicationToMavenRepository
3+
./gradlew :sqllin-driver:publishLinuxArm64PublicationToMavenRepository
34
./gradlew :sqllin-processor:publishProcessorPublicationToMavenRepository
4-
./gradlew :sqllin-dsl:publishLinuxX64PublicationToMavenRepository
5+
./gradlew :sqllin-dsl:publishLinuxX64PublicationToMavenRepository
6+
./gradlew :sqllin-dsl:publishLinuxArm64PublicationToMavenRepository

sqllin-driver/README_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
最初我们需要一个多平台可用的低阶 Kotlin API 来调用 SQLite。因为我们认为 _sqllin-dsl_ 应该是平台无关的。
66
所以我们需要 _sqllin-driver_ ,并且 _sqllin-dsl_ 要基于它。我们的目标是编写 Kotlin Multiplatform common
7-
source set 可用的通用的 API,并且它们在不同的平台有不同的实现。
7+
source set 可用的通用 API,并且它们在不同的平台有不同的实现。
88

99
在 Android 上,并没有太多的方法可供我们选择。如果我们使用 Android Framework SQLite JAVA
1010
API,事情将会变得非常简单,但是缺点是很多 SQLite 参数不能再 Android P 以下版本的系统上生效。如果我们自己编写

sqllin-driver/build.gradle.kts

+14-3
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,21 @@ kotlin {
9898
}
9999
}
100100
}
101+
}
101102

102-
tasks.findByName("publishLinuxX64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux
103-
tasks.findByName("publishLinuxArm64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux
104-
tasks.findByName("publishMingwX64PublicationToMavenRepository")?.enabled = HostManager.hostIsMingw
103+
gradle.taskGraph.whenReady {
104+
if (!project.hasProperty("onCICD"))
105+
return@whenReady
106+
tasks.forEach {
107+
when {
108+
it.name.contains("linux", true) -> {
109+
it.enabled = HostManager.hostIsLinux
110+
}
111+
it.name.contains("mingw", true) -> {
112+
it.enabled = HostManager.hostIsMingw
113+
}
114+
}
115+
}
105116
}
106117

107118
android {

sqllin-dsl/build.gradle.kts

+14-3
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,21 @@ kotlin {
100100
}
101101
}
102102
}
103+
}
103104

104-
tasks.findByName("publishLinuxX64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux
105-
tasks.findByName("publishLinuxArm64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux
106-
tasks.findByName("publishMingwX64PublicationToMavenRepository")?.enabled = HostManager.hostIsMingw
105+
gradle.taskGraph.whenReady {
106+
if (!project.hasProperty("onCICD"))
107+
return@whenReady
108+
tasks.forEach {
109+
when {
110+
it.name.contains("linux", true) -> {
111+
it.enabled = HostManager.hostIsLinux
112+
}
113+
it.name.contains("mingw", true) -> {
114+
it.enabled = HostManager.hostIsMingw
115+
}
116+
}
117+
}
107118
}
108119

109120
android {

0 commit comments

Comments
 (0)