Skip to content

Commit

Permalink
wip: Setup KMMBridge, test gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
Manrich121 committed Feb 19, 2024
1 parent 223c3b2 commit 84898ed
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 77 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/KMMBridge-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: iOS Publish
on:
workflow_dispatch:
# push:
# branches:
# - "main"
jobs:
call-kmmbridge-publish:
permissions:
contents: write
packages: write
uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/[email protected]
with:
jvmVersion: 17
versionBaseProperty: LIBRARY_VERSION
# secrets:
# PODSPEC_SSH_KEY: ${{ secrets.PODSPEC_SSH_KEY }}
80 changes: 17 additions & 63 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,18 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Deploy to Sonatype

on: workflow_dispatch

permissions:
contents: read

name: All Publish
on:
workflow_dispatch:
# push:
# branches:
# - "main"
jobs:
build:
uses: ./.github/workflows/gradle.yml
deploy:
needs: build
strategy:
matrix:
include:
- target: publishIosArm64PublicationToSonatypeRepository
os: macos-latest
- target: publishAndroidDebugPublicationToSonatypeRepository
os: ubuntu-latest
- target: publishAndroidReleasePublicationToSonatypeRepository
os: ubuntu-latest
- target: publishKotlinMultiplatformPublicationToSonatypeRepository
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v3
with:
path: |
~/.konan
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
passphrase: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle publish
run: |
./gradlew \
${{ matrix.target }} \
closeSonatypeStagingRepository \
-Psigning.gnupg.passphrase='${{secrets.OSSRH_GPG_SECRET_KEY_PASSWORD}}' \
-Psigning.gnupg.keyName='${{secrets.OSSRH_GPG_SECRET_KEY_ID}}' \
-PsonatypeUsername='${{secrets.OSSRH_USERNAME}}' \
-PsonatypePassword='${{secrets.OSSRH_PASSWORD}}'
call-kmmbridge-publish:
permissions:
contents: write
packages: write
uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/[email protected]
with:
jvmVersion: 17
versionBaseProperty: LIBRARY_VERSION
publishTask: kmmBridgePublish publishKotlinMultiplatformPublicationToGitHubPackagesRepository publishAndroidDebugPublicationToGitHubPackagesRepository publishAndroidReleasePublicationToGitHubPackagesRepository
# secrets:
# PODSPEC_SSH_KEY: ${{ secrets.PODSPEC_SSH_KEY }}
64 changes: 64 additions & 0 deletions .github/workflows/deploy_old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Deploy to Sonatype

on: workflow_dispatch

permissions:
contents: read

jobs:
build:
uses: ./.github/workflows/gradle.yml
deploy:
needs: build
strategy:
matrix:
include:
- target: publishIosArm64PublicationToSonatypeRepository
os: macos-latest
- target: publishAndroidDebugPublicationToSonatypeRepository
os: ubuntu-latest
- target: publishAndroidReleasePublicationToSonatypeRepository
os: ubuntu-latest
- target: publishKotlinMultiplatformPublicationToSonatypeRepository
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v3
with:
path: |
~/.konan
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
passphrase: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3

- name: Gradle publish
run: |
./gradlew \
${{ matrix.target }} \
closeSonatypeStagingRepository \
-Psigning.gnupg.passphrase='${{secrets.OSSRH_GPG_SECRET_KEY_PASSWORD}}' \
-Psigning.gnupg.keyName='${{secrets.OSSRH_GPG_SECRET_KEY_ID}}' \
-PsonatypeUsername='${{secrets.OSSRH_USERNAME}}' \
-PsonatypePassword='${{secrets.OSSRH_PASSWORD}}'
24 changes: 24 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// swift-tools-version:5.3
import PackageDescription

let packageName = "allshared"

let package = Package(
name: packageName,
platforms: [
.iOS(.v13)
],
products: [
.library(
name: packageName,
targets: [packageName]
),
],
targets: [
.binaryTarget(
name: packageName,
path: "./allshared/build/XCFrameworks/debug/\(packageName).xcframework"
)
,
]
)
39 changes: 39 additions & 0 deletions allshared/allshared.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Pod::Spec.new do |spec|
spec.name = 'allshared'
spec.version = '0.1'
spec.homepage = 'https://www.touchlab.co'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'PowerSyncKMMBridgetSKIE'
spec.vendored_frameworks = 'build/cocoapods/framework/allshared.framework'

spec.ios.deployment_target = '13.5'


spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':allshared',
'PRODUCT_MODULE_NAME' => 'allshared',
}

spec.script_phases = [
{
:name => 'Build allshared',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]
spec.libraries = 'c++', 'sqlite3'
end
41 changes: 41 additions & 0 deletions allshared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.kmmbridge)
alias(libs.plugins.skie)
alias(libs.plugins.mavenPublishPlugin)
}

kotlin {

listOf(
// iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
export(project(":core"))
isStatic = true
}
}

sourceSets {
commonMain.dependencies {
implementation(project(":core"))
}
}
}

publishing {
repositories {
maven {
name = "githubPackages"
url = project.uri("https://maven.pkg.github.com/powersync-ja/powersync-kotlin-sdk")
credentials(PasswordCredentials::class)
}
}
}

kmmbridge {
mavenPublishArtifacts()
spm()
}
2 changes: 2 additions & 0 deletions allshared/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.powersync.allshared"/>
17 changes: 13 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinCocoapods) apply false
alias(libs.plugins.cocoapods) apply false
alias(libs.plugins.kmmbridge) apply false
alias(libs.plugins.skie) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.sqldelight) apply false
alias(libs.plugins.grammarKitComposer) apply false
alias(libs.plugins.mavenPublishPlugin) apply false
alias(libs.plugins.downloadPlugin) apply false
}

val GROUP: String by project
val VERSION_NAME: String by project

allprojects {
repositories {
Expand Down Expand Up @@ -41,6 +41,15 @@ allprojects {
exclude(group = "ai.grazie.nlp")
}

}
subprojects {
val GROUP: String by project
val LIBRARY_VERSION: String by project

group = GROUP
version = VERSION_NAME
version = LIBRARY_VERSION
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion connectors/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

kotlin {
androidTarget {
publishLibraryVariants("release", "debug")
publishAllLibraryVariants()
}

iosArm64()
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ val buildCInteropDef by tasks.registering {

kotlin {
androidTarget {
publishLibraryVariants("release", "debug")
publishAllLibraryVariants()
}

// iosX64() Disabled for now, uncomment when we you are not on an M1 Mac
Expand Down
2 changes: 1 addition & 1 deletion demos/hello-powersync/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ plugins {
alias(projectLibs.plugins.androidLibrary) apply false
alias(projectLibs.plugins.jetbrainsCompose) apply false
alias(projectLibs.plugins.kotlinMultiplatform) apply false
alias(projectLibs.plugins.kotlinCocoapods) apply false
alias(projectLibs.plugins.cocoapods) apply false
}
2 changes: 1 addition & 1 deletion demos/hello-powersync/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
alias(projectLibs.plugins.kotlinMultiplatform)
alias(projectLibs.plugins.kotlinCocoapods)
alias(projectLibs.plugins.cocoapods)
alias(projectLibs.plugins.androidApplication)
alias(projectLibs.plugins.jetbrainsCompose)
alias(projectLibs.plugins.sqldelight)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ development=true
RELEASE_SIGNING_ENABLED=true
# POM
GROUP=com.powersync
VERSION_NAME=0.0.1-ALPHA+1
LIBRARY_VERSION=0.0.1-ALPHA+1
POM_URL=https://github.com/powersync-ja/powersync-kotlin-sdk/
POM_SCM_URL=https://github.com/powersync-ja/powersync-kotlin-sdk
POM_SCM_CONNECTION=scm:git:https://github.com/powersync-ja/powersync-kotlin-sdk.git
Expand Down
8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ coroutines = "1.7.3"
kotlinx-datetime = "0.5.0"
kotlinx-io = "0.3.0"
ktor = "2.3.7"
skie = "0.6.1"
uuid = "0.8.2"
powersync-core = "0.1.5"
sqlite-android = "3.45.0"
grammerKit = "0.1.12"

sqlDelight = "2.0.1"
stately = "2.0.6"
Expand All @@ -29,8 +27,11 @@ compose-compiler = "1.5.8"

# plugins
android-gradle-plugin = "8.2.2"
kmmBridge = "0.5.1"
skie = "0.6.1"
maven-publish = "0.27.0"
download-plugin = "4.0.4"
grammerKit = "0.1.12"

# Sample - Android
androidx-core = "1.12.0"
Expand Down Expand Up @@ -91,11 +92,12 @@ compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview"
androidApplication = { id = "com.android.application", version.ref = "android-gradle-plugin" }
androidLibrary = { id = "com.android.library", version.ref = "android-gradle-plugin" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose" }
kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
skie = { id = "co.touchlab.skie", version.ref = "skie" }
kmmbridge = { id = "co.touchlab.kmmbridge", version.ref = "kmmBridge" }
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqlDelight" }
grammarKitComposer = { id = "com.alecstrong.grammar.kit.composer", version.ref = "grammerKit" }
mavenPublishPlugin = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
Expand Down
Loading

0 comments on commit 84898ed

Please sign in to comment.