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

Run in-app tests in GA #143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -214,4 +214,12 @@ tasks.whenTaskAdded { task ->
task.dependsOn(it)
}
}
}

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