Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pure async functions and bring back non-host-object API #142

Merged
merged 44 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1dbc828
Brought back non host object API
ospfranco Aug 12, 2024
d15ccc5
Fix function name
ospfranco Aug 26, 2024
44fc86d
Update builder bob
ospfranco Sep 7, 2024
ee17c81
CPP linting
ospfranco Sep 7, 2024
eb1cb08
Fix row generation
ospfranco Sep 7, 2024
8b43980
Fix prepared statements
ospfranco Sep 7, 2024
15a3282
cpp-lint
ospfranco Sep 7, 2024
15451ea
Enable the rest of the tests
ospfranco Sep 7, 2024
9e7ba05
Try to launch android emulator and run in-app tests
ospfranco Sep 8, 2024
195cb02
Update actions
ospfranco Sep 8, 2024
5534d55
Update actions
ospfranco Sep 8, 2024
4b44026
Update actions
ospfranco Sep 8, 2024
ae4ec9d
Update CI
ospfranco Sep 8, 2024
c626285
Update CI
ospfranco Sep 8, 2024
9a25409
Update actions
ospfranco Sep 8, 2024
5d7770e
Update actions
ospfranco Sep 8, 2024
b2806be
Update actions
ospfranco Sep 8, 2024
34cecc3
Update actions
ospfranco Sep 8, 2024
b4558d3
Update actions
ospfranco Sep 8, 2024
fc50219
Update
ospfranco Sep 8, 2024
95c595c
Fix awaits in transactions
ospfranco Sep 8, 2024
664284d
lint
ospfranco Sep 8, 2024
1f98c8f
Fix missing await rollback
ospfranco Sep 8, 2024
8343899
Migrate the rest of scripts to run tests on device
ospfranco Sep 8, 2024
bd147b7
Fix sqlcipher compilation
ospfranco Sep 8, 2024
9006ffb
Modify execute function for libsql
ospfranco Sep 9, 2024
c5ff1cc
stub
ospfranco Sep 9, 2024
1abf61f
Fix libsql compilation
ospfranco Sep 9, 2024
fe0251d
Fix libsql erroring out
ospfranco Sep 9, 2024
d40db97
clang tidy
ospfranco Sep 9, 2024
33a408f
Format
ospfranco Sep 9, 2024
dece8de
Run iOS tests in simulator
ospfranco Sep 9, 2024
37f50ff
Modify turbo cache
ospfranco Sep 9, 2024
0e8e898
Change release scheme
ospfranco Sep 9, 2024
9522939
Do not start metro
ospfranco Sep 9, 2024
b4d13e8
Add test libsql
ospfranco Sep 9, 2024
d222457
Merge pull request #143 from OP-Engineering/oscar/run-in-app-tests
ospfranco Sep 9, 2024
a4500e5
Add test for executeWithHostObjects
ospfranco Sep 10, 2024
043883c
Merge branch 'main' into oscar/bring-back-non-host-object-api
ospfranco Sep 11, 2024
9772671
Update package.json to beta
ospfranco Sep 11, 2024
24c1b48
Merge branch 'main' into oscar/bring-back-non-host-object-api
ospfranco Sep 18, 2024
2d28d7f
Fix multiple connections being open and error messages
ospfranco Sep 18, 2024
3839d59
Fix sqlcipher compilation
ospfranco Sep 18, 2024
4cb7e7d
One more fix for sqlcipher
ospfranco Sep 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 202 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,67 @@ jobs:
- name: Typecheck files
run: yarn typecheck

build-android:
# build-android:
# runs-on: ubuntu-latest
# env:
# TURBO_CACHE_DIR: .turbo/android
# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Turn off addons
# run: |
# node ./scripts/turnOffEverything.js

# - name: Setup
# uses: ./.github/actions/setup

# - name: Cache turborepo for Android
# uses: actions/cache@v3
# with:
# path: ${{ env.TURBO_CACHE_DIR }}
# key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-turborepo-android-

# - name: Check turborepo cache for Android
# run: |
# TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:android:release --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:android:release').cache.status")

# if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
# echo "turbo_cache_hit=1" >> $GITHUB_ENV
# fi

# - name: Install JDK
# if: env.turbo_cache_hit != 1
# uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: '17'

# - name: Finalize Android SDK
# if: env.turbo_cache_hit != 1
# run: |
# /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"

# - name: Cache Gradle
# if: env.turbo_cache_hit != 1
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/wrapper
# ~/.gradle/caches
# key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-

# - name: Build example for Android
# env:
# JAVA_OPTS: '-XX:MaxHeapSize=6g'
# run: |
# yarn turbo run run:android:release --cache-dir="${{ env.TURBO_CACHE_DIR }}"

test-android:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
Expand All @@ -39,7 +99,7 @@ jobs:

- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:android:release --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:android:release').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
Expand Down Expand Up @@ -68,13 +128,32 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Build example for Android
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
- name: Enable KVM
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Give execute permissions to script
run: chmod +x ./scripts/test-android.sh

build-ios:
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
emulator-options: -no-window -no-boot-anim -no-audio -no-snapshot-load
script: |
adb wait-for-device
adb shell input keyevent 82
./scripts/test-android.sh

# - name: Build example for Android
# env:
# JAVA_OPTS: '-XX:MaxHeapSize=6g'
# run: |
# yarn turbo run android --cache-dir="${{ env.TURBO_CACHE_DIR }}"

test-ios:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
Expand Down Expand Up @@ -104,7 +183,7 @@ jobs:

- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:ios').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
Expand All @@ -129,11 +208,15 @@ jobs:
env:
NO_FLIPPER: 1

- name: Build example for iOS
# - name: Build example for iOS
# run: |
# yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

- name: run tests
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
./scripts/test-ios.sh

build-ios-sqlcipher:
test-ios-sqlcipher:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
Expand Down Expand Up @@ -163,7 +246,70 @@ jobs:

- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:ios').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi

- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
uses: actions/cache@v3
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-

- name: Install cocoapods
# if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
bundle exec pod install
env:
NO_FLIPPER: 1

# - name: Build example for iOS
# run: |
# yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

- name: run tests
run: |
./scripts/test-ios.sh

test-ios-libsql:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Turn on SQLCipher
run: |
node ./scripts/turnOnLibsql.js

- name: Setup
uses: ./.github/actions/setup

- name: install bundler dependencies
run: |
cd example
bundle install

- name: Cache turborepo for iOS
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-

- name: Check turborepo cache for iOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:ios').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
Expand All @@ -188,11 +334,15 @@ jobs:
env:
NO_FLIPPER: 1

- name: Build example for iOS
# - name: Build example for iOS
# run: |
# yarn turbo run run:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

- name: run tests
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
./scripts/test-ios.sh

build-android-sqlcipher:
test-android-sqlcipher:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
Expand All @@ -217,7 +367,7 @@ jobs:

- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:android:release --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:android:release').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
Expand Down Expand Up @@ -246,13 +396,26 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Build example for Android
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
- name: Enable KVM
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

build-android-libsql:
- name: Give execute permissions to script
run: chmod +x ./scripts/test-android.sh

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
emulator-options: -no-window -no-boot-anim -no-audio -no-snapshot-load
script: |
adb wait-for-device
adb shell input keyevent 82
./scripts/test-android.sh

test-android-libsql:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
Expand All @@ -277,7 +440,7 @@ jobs:

- name: Check turborepo cache for Android
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run run:android:release --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'run:android:release').cache.status")

if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
Expand Down Expand Up @@ -306,8 +469,21 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Build example for Android
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
- name: Enable KVM
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Give execute permissions to script
run: chmod +x ./scripts/test-android.sh

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
emulator-options: -no-window -no-boot-anim -no-audio -no-snapshot-load
script: |
adb wait-for-device
adb shell input keyevent 82
./scripts/test-android.sh
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
![benchmark](benchmark.png)

**Current SQLite version: 3.45.1**

Created by [@ospfranco](https://twitter.com/ospfranco). **Please consider sponsoring!**.

# Docs
OP-SQLite has grown large to cover a lot of plugins, sqlite versions and APIs. Please read the full documentation before opening an issue.

[See the docs](https://ospfranco.notion.site/OP-SQLite-Documentation-a279a52102464d0cb13c3fa230d2f2dc?pvs=4)

Some of the big and external (back-ends, out-of-tree features, plugins) supported features:

- Vanilla sqlite ofc
- Libsql is supported as a sqlite backend
- SQLCipher is supported as a sqlite backend
- FTS5 plugin
- cr-sqlite plugin
- sqlite-vec plugin
- Reactive queries (currently with some issues, please donate)

# License

MIT License.
8 changes: 8 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,12 @@ tasks.whenTaskAdded { task ->
task.dependsOn(it)
}
}
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "opsqlite"
codegenJavaPackageName = "com.op.sqlite.example"
}
}
Loading
Loading