Skip to content

Commit 5c70d5b

Browse files
authored
Attach prebuilt libraries to GitHub releases (#300)
1 parent dd0e701 commit 5c70d5b

File tree

12 files changed

+83
-64
lines changed

12 files changed

+83
-64
lines changed

.github/workflows/deploy.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373

7474
build_xcframeworks:
7575
name: Build XCFrameworks
76+
needs:
77+
- fetch_prebuilts
7678
runs-on: macos-latest
7779
steps:
7880
- uses: actions/checkout@v4
@@ -91,8 +93,13 @@ jobs:
9193
uses: gradle/actions/setup-gradle@v4
9294
with:
9395
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
96+
- name: Download prebuilts
97+
uses: actions/download-artifact@v5
98+
with:
99+
artifact-ids: ${{ needs.fetch_prebuilts.outputs.artifact_id }}
100+
path: internal/prebuild-binaries/build/output/
94101
- name: Build frameworks
95-
run: "./gradlew internal:PowerSyncKotlin:buildRelease"
102+
run: "./gradlew -PhasPrebuiltAssets=true internal:PowerSyncKotlin:buildRelease"
96103

97104
- uses: actions/upload-artifact@v4
98105
with:
@@ -105,7 +112,7 @@ jobs:
105112
add_assets:
106113
permissions:
107114
contents: write
108-
needs: [draft_release, build_xcframeworks]
115+
needs: [draft_release, build_xcframeworks, fetch_prebuilts]
109116
name: Add assets to pending release
110117
runs-on: ubuntu-latest
111118
steps:
@@ -114,14 +121,25 @@ jobs:
114121
fetch-depth: 0
115122
- uses: actions/download-artifact@v4
116123
with:
117-
merge-multiple: true
118-
- run: "ls -al"
124+
name: XCFramework
125+
- name: Download prebuilts
126+
uses: actions/download-artifact@v5
127+
with:
128+
artifact-ids: ${{ needs.fetch_prebuilts.outputs.artifact_id }}
129+
path: internal/prebuild-binaries/build/output/
130+
131+
- name: Archive prebuilts
132+
run: |
133+
find internal/prebuild-binaries/build/output
134+
zip -r prebuilt_libraries.zip internal/prebuild-binaries/build/output/
135+
119136
- name: Upload XCFramework
120137
env:
121138
GH_TOKEN: ${{ github.token }}
122139
GH_REPO: ${{ github.repository }}
123140
run: |
124141
gh release upload "${{ needs.draft_release.outputs.tag }}" PowersyncKotlinRelease.zip
142+
gh release upload "${{ needs.draft_release.outputs.tag }}" prebuilt_libraries.zip
125143
126144
- name: "Update release description"
127145
env:

.github/workflows/docs-deploy.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ jobs:
3131
validate-wrappers: true
3232
- name: Build Docs
3333
run: |
34-
./gradlew --scan \
35-
--no-configuration-cache \
36-
-PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} \
37-
dokkaGenerate
34+
./gradlew --scan dokkaGenerate
3835
shell: bash
3936
- name: Upload static files as artifact
4037
id: deployment

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 1.9.0 (unreleased)
3+
## 1.9.0
44

55
- Updated user agent string formats to allow viewing version distributions in the new PowerSync dashboard.
66
- Sync options: `newClientImplementation` is now the default.

build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ tasks.getByName<Delete>("clean") {
3030

3131
// Merges individual module docs into a single HTML output
3232
dependencies {
33-
dokka(project(":common:"))
34-
dokka(project(":core:"))
35-
dokka(project(":compose:"))
36-
dokka(project(":integrations:room"))
37-
dokka(project(":integrations:sqldelight"))
38-
dokka(project(":integrations:supabase"))
33+
dokka(projects.common)
34+
dokka(projects.core)
35+
dokka(projects.compose)
36+
dokka(projects.integrations.room)
37+
dokka(projects.integrations.sqldelight)
38+
dokka(projects.integrations.supabase)
3939
dokka(projects.sqlite3multipleciphers)
4040
}
4141

compose/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ kotlin {
2323

2424
sourceSets {
2525
commonMain.dependencies {
26-
api(project(":core"))
26+
api(projects.core)
2727
implementation(compose.runtime)
2828
}
2929
androidMain.dependencies {

core-tests-android/proguard-rules.pro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
*;
3131
}
3232

33+
-keep class androidx.test.** {
34+
*;
35+
}
36+
3337
-keep class androidx.tracing.Trace {
3438
public static void beginSection(java.lang.String);
3539
public static void endSection();
Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,18 @@
11
package com.powersync
22

3+
import com.powersync.testutils.IntegrationTestHelpers
34
import androidx.test.ext.junit.runners.AndroidJUnit4
45
import androidx.test.platform.app.InstrumentationRegistry
5-
import androidx.sqlite.SQLiteException
6-
import androidx.sqlite.execSQL
7-
import app.cash.turbine.turbineScope
8-
import com.powersync.db.schema.Schema
9-
import com.powersync.encryption.AndroidEncryptedDatabaseFactory
10-
import com.powersync.encryption.Key
11-
import com.powersync.testutils.UserRow
12-
import kotlinx.coroutines.*
13-
import kotlinx.coroutines.runBlocking
14-
import kotlinx.coroutines.test.runTest
156
import org.junit.After
16-
import org.junit.Assert.*
177
import org.junit.Before
188
import org.junit.Test
199
import org.junit.runner.RunWith
2010

2111
@RunWith(AndroidJUnit4::class)
2212
class EncryptedDatabaseTest {
23-
13+
private val helpers = IntegrationTestHelpers(
14+
InstrumentationRegistry.getInstrumentation().targetContext
15+
)
2416
@Test
25-
fun testEncryptedDatabase() =
26-
runTest {
27-
val context = InstrumentationRegistry.getInstrumentation().targetContext
28-
29-
val database = PowerSyncDatabase(
30-
factory = AndroidEncryptedDatabaseFactory(
31-
context,
32-
Key.Passphrase("mykey")
33-
),
34-
schema = Schema(UserRow.table),
35-
dbFilename = "encrypted_test",
36-
)
37-
38-
assertEquals("chacha20", database.get("PRAGMA cipher") { it.getString(0)!! })
39-
40-
database.execute(
41-
"INSERT INTO users (id, name, email) VALUES (uuid(), ?, ?)",
42-
listOf("Test", "test@example.org"),
43-
)
44-
database.close()
45-
46-
val unencryptedFactory = DatabaseDriverFactory(context)
47-
val unencrypted = unencryptedFactory.openConnection("encrypted_test", null, false)
48-
49-
try {
50-
unencrypted.execSQL("SELECT * FROM sqlite_schema")
51-
throw IllegalStateException("Was able to read schema from encrypted database without supplying a key")
52-
} catch (_: SQLiteException) {
53-
// Expected
54-
}
55-
unencrypted.close()
56-
}
17+
fun testEncryptedDatabase() = helpers.testEncryptedDatabase()
5718
}

core-tests-android/src/main/java/com/powersync/testutils/IntegrationTestHelpers.kt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.powersync.testutils
22

33
import android.content.Context
4+
import androidx.sqlite.SQLiteException
5+
import androidx.sqlite.execSQL
46
import app.cash.turbine.turbineScope
57
import com.powersync.DatabaseDriverFactory
68
import com.powersync.PowerSyncDatabase
79
import com.powersync.PowerSyncException
810
import com.powersync.db.schema.Schema
11+
import com.powersync.encryption.AndroidEncryptedDatabaseFactory
12+
import com.powersync.encryption.Key
913
import kotlinx.coroutines.CompletableDeferred
1014
import kotlinx.coroutines.async
1115
import kotlinx.coroutines.runBlocking
@@ -228,4 +232,36 @@ class IntegrationTestHelpers(private val context: Context) {
228232
database.execute("INSERT INTO foo VALUES (?)", parameters = listOf(data))
229233
}
230234
}
235+
236+
fun testEncryptedDatabase() = runTest {
237+
val database = PowerSyncDatabase(
238+
factory = AndroidEncryptedDatabaseFactory(
239+
context,
240+
Key.Passphrase("mykey")
241+
),
242+
schema = Schema(UserRow.table),
243+
dbFilename = "encrypted_test",
244+
)
245+
246+
check(database.get("PRAGMA cipher") { it.getString(0)!! } == "chacha20") {
247+
"Should be able to query PRAGMA cipher"
248+
}
249+
250+
database.execute(
251+
"INSERT INTO users (id, name, email) VALUES (uuid(), ?, ?)",
252+
listOf("Test", "test@example.org"),
253+
)
254+
database.close()
255+
256+
val unencryptedFactory = DatabaseDriverFactory(context)
257+
val unencrypted = unencryptedFactory.openConnection("encrypted_test", null, false)
258+
259+
try {
260+
unencrypted.execSQL("SELECT * FROM sqlite_schema")
261+
throw IllegalStateException("Was able to read schema from encrypted database without supplying a key")
262+
} catch (_: SQLiteException) {
263+
// Expected
264+
}
265+
unencrypted.close()
266+
}
231267
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ development=true
1919
RELEASE_SIGNING_ENABLED=true
2020
# Library config
2121
GROUP=com.powersync
22-
LIBRARY_VERSION=1.8.1
22+
LIBRARY_VERSION=1.9.0
2323
GITHUB_REPO=https://github.com/powersync-ja/powersync-kotlin.git
2424
# POM
2525
POM_URL=https://github.com/powersync-ja/powersync-kotlin/

integrations/room/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ kotlin {
2626
}
2727

2828
commonMain.dependencies {
29-
api(project(":core"))
29+
api(projects.common)
3030
api(libs.androidx.room.runtime)
3131
api(libs.androidx.sqlite.bundled)
3232

0 commit comments

Comments
 (0)