Node: Support using node:sqlite and encryption #391
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensures certain packages work on simulators | |
name: Test Simulators/Emulators | |
on: | |
pull_request: # triggered for any PR updates (including new pushes to PR branch) | |
jobs: | |
check-changes: | |
name: Check for relevant changes | |
runs-on: ubuntu-latest | |
outputs: | |
should_run: ${{ steps.check.outputs.should_run }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for changes | |
id: check | |
run: | | |
git fetch origin ${{ github.base_ref }} | |
if git diff --quiet origin/${{ github.base_ref }} -- packages/common packages/powersync-op-sqlite tools/powersynctests; then | |
echo "should_run=false" >> $GITHUB_OUTPUT | |
else | |
echo "should_run=true" >> $GITHUB_OUTPUT | |
fi | |
test-android: | |
name: Test Android | |
needs: check-changes | |
if: ${{ needs.check-changes.outputs.should_run == 'true' }} | |
runs-on: ubuntu-xl | |
timeout-minutes: 30 | |
env: | |
AVD_NAME: ubuntu-avd-x86_64-31 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Enable KVM group perms | |
run: | | |
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: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: AVD Cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-31 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
cache: 'gradle' | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build:packages | |
- name: Setup Detox build framework cache | |
working-directory: ./tools/powersynctests | |
run: | | |
pnpx detox clean-framework-cache && pnpx detox build-framework-cache | |
- name: Initialize Android Folder | |
run: mkdir -p ~/.android/avd | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/[email protected] | |
with: | |
api-level: 31 | |
force-avd-creation: false | |
target: google_apis | |
arch: x86_64 | |
disable-animations: false | |
avd-name: $AVD_NAME | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
script: echo "Generated AVD snapshot for caching." | |
- name: Android Emulator Build | |
working-directory: ./tools/powersynctests | |
run: pnpx detox build --configuration android.emu.release | |
- name: Run connected Android tests | |
uses: ReactiveCircus/[email protected] | |
with: | |
api-level: 31 | |
target: google_apis | |
arch: x86_64 | |
avd-name: $AVD_NAME | |
script: cd tools/powersynctests && pnpx detox test --configuration android.emu.release --headless | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
test-ios: | |
name: Test iOS | |
needs: check-changes | |
# TODO: Re-enable iOS tests. They have been disabled because they are failing extremely frequently without | |
# any apparent cause. In particular, it seems like even starting the simulator times out most of the time. | |
if: ${{ false && needs.check-changes.outputs.should_run == 'true' }} | |
runs-on: macOS-15 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up XCode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
# TODO: Update to latest-stable once GH installs iOS 26 simulators | |
xcode-version: '^16.4.0' | |
- name: CocoaPods Cache | |
uses: actions/cache@v3 | |
id: cocoapods-cache | |
with: | |
path: | | |
tools/powersynctests/ios/Pods/* | |
key: ${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }} | |
- name: Cache Xcode Derived Data | |
uses: actions/cache@v3 | |
with: | |
path: | | |
tools/powersynctests/ios/build/* | |
key: xcode-derived-${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }} | |
restore-keys: | | |
xcode-derived-${{ runner.os }}- | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build:packages | |
- name: Install Detox dependencies | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
npm install -g detox-cli | |
detox clean-framework-cache && detox build-framework-cache | |
- name: Install CocoaPods dependencies | |
working-directory: tools/powersynctests/ios | |
run: pod install | |
- name: iOS Simulator Build | |
working-directory: ./tools/powersynctests | |
run: pnpx detox build --configuration ios.sim.release | |
- name: iOS Simulator Test | |
working-directory: ./tools/powersynctests | |
run: pnpx detox test --configuration ios.sim.release --cleanup |