Skip to content

Revert "Native finalizer for db and stmt" #854

Revert "Native finalizer for db and stmt"

Revert "Native finalizer for db and stmt" #854

Workflow file for this run

name: CI
on:
push:
branches: ['**']
pull_request:
branches: [ main ]
jobs:
fetch_sqlite:
uses: ./.github/workflows/compile_sqlite.yml
analyze:
strategy:
matrix:
dart: [beta]
name: Analyze ${{ matrix.package }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.dart }}
- uses: actions/cache@v4
with:
path: "${{ env.PUB_CACHE }}"
key: dart-dependencies-${{ matrix.dart }}-${{ runner.os }}
restore-keys: |
dart-dependencies-${{ matrix.dart }}-
dart-dependencies-
- name: Pub get
run: dart pub get
- name: Format dart
run: |
dart format --set-exit-if-changed sqlite3
dart format --set-exit-if-changed sqlite3_test
dart format --set-exit-if-changed sqlite3_web
- name: Format native
run: clang-format --Werror --dry-run --style=google assets/*.h test/**/*.c
working-directory: sqlite3
- name: Format native
run: clang-format --Werror --dry-run --style=google src/*{.h,.c}
working-directory: sqlite3_wasm_build
- name: Analyze
run: dart analyze --fatal-infos sqlite3 sqlite3_web sqlite3_test
test:
needs: [analyze, fetch_sqlite]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart: [beta, dev]
sqlite: [system, compiled]
name: Unit tests with Dart ${{ matrix.dart }} on ${{ matrix.os }} with ${{ matrix.sqlite }} sqlite
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.dart }}
- name: Download compiled sqlite3
if: matrix.sqlite == 'compiled'
uses: actions/download-artifact@v5
with:
artifact-ids: ${{ needs.fetch_sqlite.outputs.artifact_id }}
path: sqlite-compiled
- uses: actions/cache@v4
with:
path: "${{ env.PUB_CACHE }}"
key: dart-dependencies-${{ matrix.dart }}-${{ runner.os }}
restore-keys: |
dart-dependencies-${{ matrix.dart }}-
dart-dependencies-
- name: Get Dart dependencies
run: |
dart pub get
- name: Write asset hashes
run: dart run tool/write_asset_hashes.dart
if: matrix.sqlite == 'compiled'
- name: Prepare for tests
run: |
dart run tool/hook_overrides.dart ${{ matrix.sqlite }}
- name: Test sqlite3 package
run: |
dart test --test-randomize-ordering-seed "random" -P ci
working-directory: sqlite3/
# - name: Test with SQLITE_OMIT_AUTOINIT
# if: matrix.sqlite == 'compiled' && runner.os == 'Linux'
# run: |
# ls $LD_LIBRARY_PATH
# dart run tool/check_compile_time_option.dart OMIT_AUTOINIT
# dart test -P ci
# env:
# LD_LIBRARY_PATH: ../sqlite/out/without_autoinit
# working-directory: sqlite3/
- name: Test sqlite3_test package
run: dart test
working-directory: sqlite3_test/
- name: Test extension example
# We can't load extension with the system SQLite on Apple platforms,
# the feature is disabled.
if: ${{ !(runner.os == 'macos' && matrix.sqlite == 'system') }}
run: dart test
working-directory: sqlite3/example/custom_extension
- name: Web tests
run: |
cp ../sqlite-compiled/*.wasm example/web
dart test -P web -r expanded
# If browsers behave differently on different platforms, surely that's not our fault...
# So, only run browser tests on Linux to be faster.
if: matrix.sqlite == 'compiled' && runner.os == 'Linux'
working-directory: sqlite3/
upload_asset_hashes:
needs: [test, fetch_sqlite]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dart-lang/setup-dart@v1
with:
sdk: beta
- name: Download compiled sqlite3
uses: actions/download-artifact@v5
with:
artifact-ids: ${{ needs.fetch_sqlite.outputs.artifact_id }}
path: sqlite-compiled
- uses: actions/cache@v4
with:
path: "${{ env.PUB_CACHE }}"
key: dart-dependencies-beta-${{ runner.os }}
restore-keys: |
dart-dependencies-beta-
dart-dependencies-
- name: Get Dart dependencies
run: |
dart pub get
- name: Write asset hashes
run: dart run tool/write_asset_hashes.dart
- name: Upload asset hashes
uses: actions/upload-artifact@v4
id: upload
with:
name: asset-hashes
path: sqlite3/lib/src/hook/asset_hashes.dart
if-no-files-found: error
retention-days: 1
integration_test_web:
needs: [analyze, fetch_sqlite]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dart-lang/setup-dart@v1
with:
sdk: beta
- name: Download compiled sqlite3
uses: actions/download-artifact@v5
with:
artifact-ids: ${{ needs.fetch_sqlite.outputs.artifact_id }}
path: sqlite-compiled
- uses: actions/cache@v4
with:
path: "${{ env.PUB_CACHE }}"
key: dart-dependencies-${{ matrix.dart }}-${{ runner.os }}
restore-keys: |
dart-dependencies-${{ matrix.dart }}-
dart-dependencies-
- name: Prepare for tests
run: |
dart run tool/write_asset_hashes.dart
dart run tool/hook_overrides.dart compiled
- name: Web tests
run: |
cp ../sqlite-compiled/*.wasm web/
dart pub get
dart test -P gh_actions -r expanded
working-directory: sqlite3_web
# The integration tests for android are currently broken (the emulator doesn't want to
# start up...)
#
# integration_test_android:
# runs-on: macos-latest
# needs: [test]
# strategy:
# matrix:
# test:
# - flutter_libs
# - sqlcipher_flutter
# steps:
# - uses: actions/checkout@v5
# - uses: subosito/flutter-action@v2
# with:
# channel: dev
# - name: pub get
# working-directory: "integration_tests/${{ matrix.test }}"
# run: flutter pub get
#
# - name: run tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 29
# script: flutter test integration_test
# working-directory: "integration_tests/${{ matrix.test }}"
# Shamelessly stolen from https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab
integration_test:
strategy:
matrix:
runner: [ubuntu-latest, macos-latest]
needs: [test, fetch_sqlite]
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
AVD_NAME: ubuntu-avd-x86_64-34
steps:
- name: List simulators
if: runner.os == 'macos'
run: "xcrun xctrace list devices"
- name: Start simulator
if: runner.os == 'macos'
run: |
IPHONE=$(xcrun xctrace list devices 2>&1 | grep -m 1 "iPhone" | awk -F'[()]' '{print $4}')
xcrun simctl boot $IPHONE
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
channel: beta
- name: Flutter version
run: flutter --version
- name: Setup runner
if: runner.os == 'linux'
# https://github.com/ReactiveCircus/android-emulator-runner?tab=readme-ov-file#usage--examples
run: |
sudo apt-get install -y cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev
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: AVD Cache
uses: actions/cache@v4
id: avd-cache
if: runner.os == 'linux'
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-35
- name: Download compiled sqlite3
uses: actions/download-artifact@v5
with:
artifact-ids: ${{ needs.fetch_sqlite.outputs.artifact_id }}
path: sqlite-compiled
- uses: actions/cache@v4
with:
path: "${{ env.PUB_CACHE }}"
key: dart-dependencies-${{ matrix.dart }}-${{ runner.os }}
restore-keys: |
dart-dependencies-${{ matrix.dart }}-
dart-dependencies-
- name: Write asset hashes
run: |
dart pub get
dart run tool/write_asset_hashes.dart
dart run tool/hook_overrides.dart compiled
- name: Flutter sqlite3 tests on macOS
if: runner.os == 'macos'
working-directory: examples/flutter_integration_tests
run: |
flutter config --enable-swift-package-manager
flutter test integration_test
flutter test integration_test -d macos
- name: Flutter sqlite3 tests on Linux
if: false # runner.os == 'linux' currently broken in ci, can't reproduce locally or in Ubuntu VM
working-directory: examples/flutter_integration_tests
run: |
flutter test integration_test -d linux
- name: SQLite Android emulator tests
uses: reactivecircus/android-emulator-runner@v2
if: runner.os == 'linux'
with:
api-level: 34
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: flutter test integration_test
working-directory: "examples/flutter_integration_tests"
- name: Enable sqlite3mc
run: |
dart run tool/hook_overrides.dart compiled-ciphers
- name: Flutter sqlite3mc tests on macOS
if: runner.os == 'macos'
working-directory: examples/flutter_integration_tests
run: |
flutter config --enable-swift-package-manager
flutter test integration_test -Dsqlite3.multipleciphers=true
flutter test integration_test -Dsqlite3.multipleciphers=true -d macos
- name: sqlite3mc Android emulator tests
uses: reactivecircus/android-emulator-runner@v2
if: runner.os == 'linux'
with:
api-level: 34
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: flutter test integration_test -Dsqlite3.multipleciphers=true
working-directory: "examples/flutter_integration_tests"