Skip to content

Commit a05c3fd

Browse files
build: update gradle and ci workflows
Signed-off-by: goncalo-frade-iohk <goncalo.frade@iohk.io>
1 parent b91785d commit a05c3fd

File tree

9 files changed

+360
-272
lines changed

9 files changed

+360
-272
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ jobs:
6060
- name: Runner
6161
run: echo ${{ runner.os }}
6262

63+
- name: "Test Kotlin code is properly formatted"
64+
run: ./gradlew ktlintCheck
65+
6366
- name: Build for JS, Android, JVM
6467
run: ./gradlew build allTests koverXmlReportRelease koverHtmlReportRelease --stacktrace
6568

.github/workflows/release.yml

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ name: Release SDK
33

44
env:
55
JAVA_VERSION: 17
6-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
7-
GITHUB_ACTOR: "hyperledger-bot"
8-
GITHUB_ACTOR_EMAIL: "hyperledger-bot@hyperledger.org"
9-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
12-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
13-
OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
14-
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
15-
166

177
on:
188
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version to release (e.g., 1.2.3)'
12+
required: true
1913

2014
permissions:
2115
contents: write
@@ -44,9 +38,25 @@ jobs:
4438
server-username: ${{ secrets.OSSRH_USERNAME }}
4539
server-password: ${{ secrets.OSSRH_PASSWORD }}
4640

41+
- name: Update gradle.properties with new version
42+
run: |
43+
sed -i '' 's/^version = *.*.*/version = ${{ github.event.inputs.version }}/' gradle.properties
44+
45+
- name: Build Kotlin Multiplatform Maven Artifacts
46+
run: ./gradlew publishToMavenLocal --no-configuration-cache
47+
48+
- name: Publish JVM & Android to Maven Central
49+
if: ${{ inputs.release_maven }}
50+
env:
51+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.HYP_BOT_GPG_PRIVATE }}
52+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.HYP_BOT_GPG_PASSWORD }}
53+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
54+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
55+
ORG_GRADLE_PROJECT_autoRelease: true
56+
run: ./gradlew publishToMavenCentral --no-configuration-cache
4757

48-
- uses: crazy-max/ghaction-import-gpg@v5
49-
id: import_gpg
58+
- uses: crazy-max/ghaction-import-gpg@v6
59+
id: import-gpg
5060
with:
5161
gpg_private_key: ${{ secrets.HYP_BOT_GPG_PRIVATE }}
5262
passphrase: ${{ secrets.HYP_BOT_GPG_PASSWORD }}
@@ -55,18 +65,21 @@ jobs:
5565
git_config_global: true
5666
git_tag_gpgsign: false
5767

58-
- name: "Release"
68+
- name: Commit updated files and tag the release
69+
uses: stefanzweifel/git-auto-commit-action@v5
70+
with:
71+
commit_author: "${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>"
72+
commit_user_name: ${{ steps.import-gpg.outputs.name }}
73+
commit_user_email: ${{ steps.import-gpg.outputs.email }}
74+
commit_options: '-s -S'
75+
commit_message: |
76+
chore(release): v${{ github.event.inputs.version }}
77+
tagging_message: v${{ github.event.inputs.version }}
78+
file_pattern: gradle.properties
79+
80+
- name: Create GitHub Release
81+
uses: softprops/action-gh-release@v2
82+
with:
83+
tag_name: v${{ github.event.inputs.version }}
5984
env:
60-
GITHUB_TOKEN: ${{ secrets.IDENTUS_CI }}
61-
GITHUB_ACTOR: ${{ steps.import_gpg.outputs.name }}
62-
GIT_AUTHOR_EMAIL: ${{ steps.import_gpg.outputs.email }}
63-
GIT_COMMITTER_EMAIL: ${{ steps.import_gpg.outputs.email }}
64-
GIT_AUTHOR_NAME: ${{ steps.import_gpg.outputs.name }}
65-
GIT_COMMITTER_NAME: ${{ steps.import_gpg.outputs.name }}
66-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
67-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
68-
OSSRH_GPG_SECRET_KEY: ${{ secrets.HYP_BOT_GPG_PRIVATE }}
69-
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.HYP_BOT_GPG_PASSWORD }}
70-
run: |
71-
npm install
72-
npx semantic-release
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ val groupId = "org.hyperledger.identus"
44
val os: OperatingSystem = OperatingSystem.current()
55

66
plugins {
7-
id("com.android.library") version "8.1.4" apply false
8-
kotlin("jvm") version "1.9.24"
9-
kotlin("plugin.serialization") version "1.8.20"
10-
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
11-
id("org.jetbrains.dokka") version "1.9.20"
12-
id("org.jetbrains.kotlin.kapt") version "1.9.10"
13-
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
7+
alias(libs.plugins.kotlinJvm)
8+
alias(libs.plugins.kotlinAndroid) apply false
9+
alias(libs.plugins.androidApplication) apply false
10+
alias(libs.plugins.androidLibrary) apply false
11+
alias(libs.plugins.kotlinMultiplatform) apply false
12+
alias(libs.plugins.mavenPublish) apply false
13+
alias(libs.plugins.dokka) apply false
14+
alias(libs.plugins.ksp) apply false
15+
alias(libs.plugins.ktlint)
1416
}
1517

1618
buildscript {
@@ -20,12 +22,6 @@ buildscript {
2022
google()
2123
gradlePluginPortal()
2224
}
23-
dependencies {
24-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24")
25-
classpath("com.google.protobuf:protobuf-gradle-plugin:0.9.1")
26-
classpath("com.squareup.sqldelight:gradle-plugin:1.5.5")
27-
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.23.1")
28-
}
2925
}
3026

3127
java {
@@ -37,24 +33,6 @@ java {
3733
allprojects {
3834
this.group = groupId
3935

40-
repositories {
41-
mavenLocal()
42-
mavenCentral()
43-
google()
44-
maven("https://plugins.gradle.org/m2/")
45-
// Needed for Kotlin coroutines that support new memory management mode
46-
maven {
47-
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
48-
}
49-
maven {
50-
setUrl("https://maven.pkg.github.com/hyperledger/aries-uniffi-wrappers")
51-
credentials {
52-
username = System.getenv("GITHUB_ACTOR")
53-
password = System.getenv("GITHUB_TOKEN")
54-
}
55-
}
56-
}
57-
5836
configurations.all {
5937
resolutionStrategy {
6038
eachDependency {
@@ -100,14 +78,3 @@ subprojects {
10078
}
10179
}
10280
}
103-
104-
nexusPublishing {
105-
repositories {
106-
sonatype {
107-
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
108-
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
109-
username.set(System.getenv("OSSRH_USERNAME"))
110-
password.set(System.getenv("OSSRH_PASSWORD"))
111-
}
112-
}
113-
}

gradle.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
version = 3.0.0
1+
version = 4.0.0
22
org.gradle.jvmargs = -Xmx3072M -Dkotlin.daemon.jvm.options="-Xmx3072M"
33
kotlin.code.style = official
44
android.useAndroidX = true
55
kotlin.mpp.enableCInteropCommonization = true
66
kotlin.native.cacheKind.iosSimulatorArm64 = none
7-
apollo_version = 1.4.2
8-
didpeer_version = 1.1.2
97
kotlin.mpp.androidSourceSetLayoutVersion = 2
108
kotlinx.atomicfu.enableJvmIrTransformation = true
119
kotlinx.atomicfu.enableJsIrTransformation = true

gradle/libs.versions.toml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
[versions]
2+
kotlin = "1.9.20"
3+
agp = "8.2.2"
4+
apollo = "1.4.2"
5+
didpeer = "1.1.2"
6+
kotlincrypto-hash-sha = "0.4.0"
7+
didcomm = "0.3.2"
8+
anoncreds = "0.2.0-wrapper.1"
9+
bignum = "0.3.9"
10+
bouncycastle = "1.68"
11+
sdjwt = "0.4.0"
12+
jsonld = "1.4.0"
13+
json = "2.0.1"
14+
protoc = "3.12.0"
15+
urdna = "1.3"
16+
17+
ksp = "1.9.20-1.0.14" # pick a KSP in the 1.9.x line; adjust if needed
18+
ktlint = "12.1.0"
19+
dokka = "1.9.20"
20+
sqldelight = "2.0.1"
21+
protobuf-plugin = "0.9.1"
22+
vanniktech-maven-publish = "0.28.0"
23+
24+
coroutines = "1.8.1"
25+
serialization = "1.6.0"
26+
ktor = "2.3.11"
27+
datetime = "0.6.0"
28+
kotlin-kover = "0.7.6"
29+
30+
androidx-core-ktx = "1.7.0"
31+
androidx-appcompat = "1.6.0"
32+
androidx-constraintlayout = "2.1.4"
33+
androidx-navigation = "2.5.3"
34+
material = "1.8.0"
35+
lifecycle = "2.3.1"
36+
room = "2.4.2"
37+
38+
junit4 = "4.13.2"
39+
androidx-junit = "1.1.5"
40+
espresso = "3.5.1"
41+
lighthouse-logging = "1.1.2"
42+
mockito = "4.4.0"
43+
mockito-kotlin = "4.0.0"
44+
45+
[libraries]
46+
# Dependencies
47+
dependencies-apollo = { module = "org.hyperledger.identus.apollo:apollo", version.ref = "apollo" }
48+
dependencies-didpeer = { module = "io.iohk.atala.prism.didcomm:didpeer", version.ref = "didpeer" }
49+
dependencies-kotlincrypto-hash-sha = { module = "org.kotlincrypto.hash:sha2", version.ref = "kotlincrypto-hash-sha" }
50+
dependencies-didcomm = { module = "org.didcommx:didcomm", version.ref = "didcomm" }
51+
dependencies-anoncreds = { module = "org.hyperledger:anoncreds_uniffi", version.ref = "anoncreds" }
52+
dependencies-ionspin-bignum = { module = "com.ionspin.kotlin:bignum", version.ref = "bignum" }
53+
dependencies-bouncycastle = { module = "org.bouncycastle:bcprov-jdk15on", version.ref = "bouncycastle" }
54+
dependencies-eudi-sdjwt = { module = "eu.europa.ec.eudi:eudi-lib-jvm-sdjwt-kt", version.ref = "sdjwt" }
55+
dependencies-json-ld = { module = "com.apicatalog:titanium-json-ld-jre8", version.ref = "jsonld" }
56+
dependencies-json = { module = "org.glassfish:jakarta.json", version.ref = "json" }
57+
dependencies-protoc = { module = "com.google.protobuf:protoc", version.ref = "protoc"}
58+
dependencies-setl-rdf-urdna = { module = "io.setl:rdf-urdna", version.ref = "urdna"}
59+
60+
# AndroidX
61+
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core-ktx" }
62+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
63+
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" }
64+
androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "androidx-navigation" }
65+
androidx-navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "androidx-navigation" }
66+
androidx-material = { module = "com.google.android.material:material", version.ref = "material" }
67+
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
68+
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
69+
70+
room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
71+
room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
72+
73+
# KotlinX
74+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
75+
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
76+
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "datetime"}
77+
78+
# Ktor
79+
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
80+
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
81+
ktor-client-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
82+
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
83+
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
84+
ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" }
85+
86+
# SqlDelight
87+
sqldelight-sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" }
88+
sqldelight-android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
89+
sqldelight-couroutines-extensions = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqldelight" }
90+
91+
# Testing
92+
junit4 = { module = "junit:junit", version.ref = "junit4" }
93+
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
94+
androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
95+
96+
lighthouse-logging = { module = "org.lighthousegames:logging", version.ref = "lighthouse-logging" }
97+
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
98+
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
99+
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
100+
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito-kotlin" }
101+
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
102+
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
103+
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
104+
105+
protobuf-java = { module = "com.google.protobuf:protobuf-java", version = "3.14.0" }
106+
pbandk-runtime = { module = "pro.streem.pbandk:pbandk-runtime", version = "0.14.2" }
107+
108+
[plugins]
109+
androidApplication = { id = "com.android.application", version.ref = "agp" }
110+
androidLibrary = { id = "com.android.library", version.ref = "agp" }
111+
112+
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
113+
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
114+
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
115+
116+
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
117+
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
118+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
119+
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
120+
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" }
121+
kotlinKover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlin-kover" }
122+
123+
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-maven-publish" }
124+
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

protosLib/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ val os: OperatingSystem = OperatingSystem.current()
77

88
plugins {
99
`java-library`
10-
id("com.google.protobuf")
10+
alias(libs.plugins.kotlinJvm)
11+
alias(libs.plugins.protobuf)
1112
}
1213

1314
// Mock configuration which derives compile only.
@@ -18,7 +19,8 @@ val jarPathConf: Configuration by configurations.creating {
1819

1920
dependencies {
2021
// This is needed for includes, ref: https://github.com/google/protobuf-gradle-plugin/issues/41#issuecomment-143884188
21-
compileOnly("com.google.protobuf:protobuf-java:3.14.0")
22+
implementation(libs.pbandk.runtime)
23+
implementation(libs.pbandk.runtime)
2224
}
2325

2426
sourceSets {

0 commit comments

Comments
 (0)