Skip to content

iOS tests: Run pub get first #775

iOS tests: Run pub get first

iOS tests: Run pub get first #775

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:
package: [sqlite3, sqlite3_test]
dart: [beta]
name: Analyze on Dart ${{ matrix.dart }}
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
working-directory: ${{ matrix.package }}
- name: Format dart
run: dart format --set-exit-if-changed .
working-directory: ${{ matrix.package }}
- name: Format native
run: clang-format --Werror --dry-run --style=google assets/*.h test/**/*.c
if: ${{ matrix.package == 'sqlite3' }}
working-directory: sqlite3
- name: Format native
run: clang-format --Werror --dry-run --style=google src/*{.h,.c}
if: ${{ matrix.package == 'sqlite3' }}
working-directory: sqlite3_wasm_build
- name: Analyze
run: dart analyze --fatal-infos lib/ test/
working-directory: ${{ matrix.package }}
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/out
- 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 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 pub get
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
if: matrix.sqlite != 'system' || runner.os != 'Windows'
run: |
dart pub get
dart test
working-directory: sqlite3_test/
- name: Web tests
run: |
curl https://simon-public.fsn1.your-objectstorage.com/assets/sqlite3/2.8.0/sqlite3.wasm -o example/web/sqlite3.wasm
curl https://simon-public.fsn1.your-objectstorage.com/assets/sqlite3/2.8.0/sqlite3mc.wasm -o example/web/sqlite3mc.wasm
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.
# todo: Something broke Dart web tests in Dart 2.18, it looks like this is related to finalizers
if: matrix.sqlite == 'compiled' && runner.os == 'Linux'
working-directory: sqlite3/
# 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 }}"
integration_test_linux:
if: "false" # currently broken
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- name: Setup Flutter
run: |
flutter config --enable-linux-desktop
sudo apt-get update -y
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
flutter --version
- name: sqlite3 driver tests
run: "flutter pub get && xvfb-run -a flutter test integration_test"
working-directory: integration_tests/flutter_swiftpm
- name: sqlcipher driver tests
run: "flutter pub get && xvfb-run -a flutter test integration_test"
working-directory: integration_tests/sqlcipher_flutter
# Shamelessly stolen from https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab
integration_test_ios:
needs: [test]
runs-on: macos-latest
steps:
- name: List simulators
run: "xcrun xctrace list devices"
- name: Start simulator
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
- name: Flutter version
run: flutter --version
- name: Download compiled sqlite3
uses: actions/download-artifact@v5
with:
artifact-ids: ${{ needs.fetch_sqlite.outputs.artifact_id }}
path: sqlite/out
- 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: SQLite driver tests
working-directory: examples/flutter_integration_tests
run: flutter test integration_test
integration_test_macos:
if: "false" # Temporarily disabled since it causes timeouts
needs: [test]
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- name: Setup Flutter
run: |
flutter config --enable-macos-desktop
flutter --version
- name: sqlite3 driver tests
run: "flutter pub get && flutter test integration_test"
working-directory: integration_tests/flutter_libs
- name: sqlcipher driver tests
run: "flutter pub get && flutter test integration_test"
working-directory: integration_tests/sqlcipher_flutter