From 2d2e81997cf9a14d934181bb022db2a57efcfa45 Mon Sep 17 00:00:00 2001 From: qiaoyuang Date: Thu, 9 Nov 2023 15:45:29 +0800 Subject: [PATCH 1/2] Optimize the CI/CD processing --- .github/workflows/build.yml | 8 ++++---- .github/workflows/publish.yml | 8 ++++---- publish_linux_processor.sh | 4 +++- sqllin-driver/README_CN.md | 2 +- sqllin-driver/build.gradle.kts | 17 ++++++++++++++--- sqllin-dsl/build.gradle.kts | 17 ++++++++++++++--- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 703f511..bb1c4a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - name: Build sqllin-driver - run: ./gradlew :sqllin-driver:assemble + run: ./gradlew :sqllin-driver:assemble -PonCICD - name: Run sqllin-driver macOS X64 Tests run: ./test_driver_macos.sh @@ -55,7 +55,7 @@ jobs: run: ./test_driver_jvm.sh - name: Build sqllin-dsl - run: ./gradlew :sqllin-dsl:assemble + run: ./gradlew :sqllin-dsl:assemble -PonCICD - name: Run sqllin-dsl macOS X64 Tests run: ./test_dsl_macos.sh @@ -203,7 +203,7 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - name: Build sqllin-driver - run: ./gradlew :sqllin-driver:assemble + run: ./gradlew :sqllin-driver:assemble -PonCICD - name: Run sqllin-driver Linux X64 Tests run: ./test_driver_linux.sh @@ -215,7 +215,7 @@ jobs: run: ./gradlew :sqllin-processor:assemble - name: Build sqllin-dsl - run: ./gradlew :sqllin-dsl:assemble + run: ./gradlew :sqllin-dsl:assemble -PonCICD - name: Run sqllin-dsl Linux X64 Tests run: ./test_dsl_linux.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3dc85f9..2e32f97 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,7 +41,7 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - name: Build sqllin-driver - run: ./gradlew :sqllin-driver:assemble + run: ./gradlew :sqllin-driver:assemble -PonCICD - name: Run sqllin-driver macOS X64 Tests run: ./test_driver_macos.sh @@ -50,7 +50,7 @@ jobs: run: ./test_driver_jvm.sh - name: Build sqllin-dsl - run: ./gradlew :sqllin-dsl:assemble + run: ./gradlew :sqllin-dsl:assemble -PonCICD - name: Run sqllin-dsl macOS X64 Tests run: ./test_dsl_macos.sh @@ -204,7 +204,7 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - name: Build sqllin-driver - run: ./gradlew :sqllin-driver:assemble + run: ./gradlew :sqllin-driver:assemble -PonCICD - name: Run sqllin-driver Linux X64 Tests run: ./test_driver_linux.sh @@ -216,7 +216,7 @@ jobs: run: ./gradlew :sqllin-processor:assemble - name: Build sqllin-dsl - run: ./gradlew :sqllin-dsl:assemble + run: ./gradlew :sqllin-dsl:assemble -PonCICD - name: Run sqllin-dsl Linux X64 Tests run: ./test_dsl_linux.sh diff --git a/publish_linux_processor.sh b/publish_linux_processor.sh index 301478e..d2379d7 100755 --- a/publish_linux_processor.sh +++ b/publish_linux_processor.sh @@ -1,4 +1,6 @@ # Publish artifacts on Linux env ./gradlew :sqllin-driver:publishLinuxX64PublicationToMavenRepository +./gradlew :sqllin-driver:publishLinuxArm64PublicationToMavenRepository ./gradlew :sqllin-processor:publishProcessorPublicationToMavenRepository -./gradlew :sqllin-dsl:publishLinuxX64PublicationToMavenRepository \ No newline at end of file +./gradlew :sqllin-dsl:publishLinuxX64PublicationToMavenRepository +./gradlew :sqllin-dsl:publishLinuxArm64PublicationToMavenRepository \ No newline at end of file diff --git a/sqllin-driver/README_CN.md b/sqllin-driver/README_CN.md index c9f7e6f..695df96 100644 --- a/sqllin-driver/README_CN.md +++ b/sqllin-driver/README_CN.md @@ -4,7 +4,7 @@ 最初我们需要一个多平台可用的低阶 Kotlin API 来调用 SQLite。因为我们认为 _sqllin-dsl_ 应该是平台无关的。 所以我们需要 _sqllin-driver_ ,并且 _sqllin-dsl_ 要基于它。我们的目标是编写 Kotlin Multiplatform common -source set 可用的通用的 API,并且它们在不同的平台有不同的实现。 +source set 可用的通用 API,并且它们在不同的平台有不同的实现。 在 Android 上,并没有太多的方法可供我们选择。如果我们使用 Android Framework SQLite JAVA API,事情将会变得非常简单,但是缺点是很多 SQLite 参数不能再 Android P 以下版本的系统上生效。如果我们自己编写 diff --git a/sqllin-driver/build.gradle.kts b/sqllin-driver/build.gradle.kts index 388d5c3..622ab2d 100644 --- a/sqllin-driver/build.gradle.kts +++ b/sqllin-driver/build.gradle.kts @@ -98,10 +98,21 @@ kotlin { } } } +} - tasks.findByName("publishLinuxX64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux - tasks.findByName("publishLinuxArm64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux - tasks.findByName("publishMingwX64PublicationToMavenRepository")?.enabled = HostManager.hostIsMingw +gradle.taskGraph.whenReady { + if (!project.hasProperty("onCICD")) + return@whenReady + tasks.forEach { + when { + it.name.contains("linux", true) -> { + it.enabled = HostManager.hostIsLinux + } + it.name.contains("mingw", true) -> { + it.enabled = HostManager.hostIsMingw + } + } + } } android { diff --git a/sqllin-dsl/build.gradle.kts b/sqllin-dsl/build.gradle.kts index 4c84c5c..9984504 100644 --- a/sqllin-dsl/build.gradle.kts +++ b/sqllin-dsl/build.gradle.kts @@ -100,10 +100,21 @@ kotlin { } } } +} - tasks.findByName("publishLinuxX64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux - tasks.findByName("publishLinuxArm64PublicationToMavenRepository")?.enabled = HostManager.hostIsLinux - tasks.findByName("publishMingwX64PublicationToMavenRepository")?.enabled = HostManager.hostIsMingw +gradle.taskGraph.whenReady { + if (!project.hasProperty("onCICD")) + return@whenReady + tasks.forEach { + when { + it.name.contains("linux", true) -> { + it.enabled = HostManager.hostIsLinux + } + it.name.contains("mingw", true) -> { + it.enabled = HostManager.hostIsMingw + } + } + } } android { From af02810c55227e82040fad23e79ab3490d80a3f3 Mon Sep 17 00:00:00 2001 From: qiaoyuang Date: Thu, 9 Nov 2023 15:51:01 +0800 Subject: [PATCH 2/2] Rename the script name to publish_apple_android_jvm --- .github/workflows/publish.yml | 2 +- publish_apple_android.sh => publish_apple_android_jvm.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename publish_apple_android.sh => publish_apple_android_jvm.sh (54%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2e32f97..7780c7c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -110,7 +110,7 @@ jobs: if: always() - name: Publish to MavenCentral - run: ./publish_apple_android.sh + run: ./publish_apple_android_jvm.sh build-on-windows: runs-on: windows-latest diff --git a/publish_apple_android.sh b/publish_apple_android_jvm.sh similarity index 54% rename from publish_apple_android.sh rename to publish_apple_android_jvm.sh index 30a7caf..839b7db 100755 --- a/publish_apple_android.sh +++ b/publish_apple_android_jvm.sh @@ -1,3 +1,3 @@ # Publish artifacts on macOS env -./gradlew :sqllin-driver:publishAllPublicationsToMavenRepository -./gradlew :sqllin-dsl:publishAllPublicationsToMavenRepository \ No newline at end of file +./gradlew :sqllin-driver:publishAllPublicationsToMavenRepository -PonCICD +./gradlew :sqllin-dsl:publishAllPublicationsToMavenRepository -PonCICD \ No newline at end of file