Merge branch 'release-4.2.0' #26
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
name: Test | |
# Avoid duplicate builds for pull requests, allow manual trigger. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
# Minimal access by default | |
permissions: | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
env: | |
# Run generator integration tests and init script with latest SDK. | |
# Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new SDKs. | |
# NOTE: also update matrix configurations below! | |
FLUTTER_VERSION: 3.29.2 # Available versions: https://docs.flutter.dev/release/archive | |
DART_VERSION: 3.7.2 # Available versions: https://dart.dev/get-dart/archive | |
jobs: | |
# Runs generator integration tests, e.g. ensures generator works as expected. | |
# Note: no need to test oldest SDK here, generator package is also built as part of unit-tests job. | |
generator-integ-tests: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
# Prefer running on Ubuntu over Dart Docker image | |
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5 | |
with: | |
sdk: ${{ env.DART_VERSION }} | |
- name: Install ObjectBox C library | |
run: ./install.sh --install # Install globally for generator integration tests | |
- name: Integration test | |
run: ./generator/test.sh | |
# Check the init script works - it's not something we usually run during normal development. | |
# The init script gets dependencies for all packages and runs code generation for those that | |
# need it. | |
init-script: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- run: ./tool/init.sh | |
# Runs generator and objectbox unit tests | |
unit-tests: | |
strategy: | |
fail-fast: false # To see all Dart SDKs that fail, also sometimes with more helpful errors. | |
matrix: | |
os: | |
- windows-2022 | |
- macos-14 | |
- ubuntu-24.04 | |
sdk: | |
# Test latest available and lowest supported SDK (see dev-doc/updating-dart-flutter-and-dependencies.md). | |
# Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new SDKs. | |
# Can not use env variables here, only within 'steps'. | |
# For available versions see https://dart.dev/get-dart/archive | |
- 3.7.2 | |
- 3.5.4 # Use latest bugfix release to get tooling fixes | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5 | |
with: | |
sdk: ${{ matrix.sdk }} | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Generator Test | |
working-directory: generator | |
run: | | |
../tool/pub.sh get | |
../tool/pub.sh run test | |
- name: Install ObjectBox C library | |
working-directory: objectbox_test | |
run: ../install.sh | |
- name: Library Test | |
working-directory: objectbox_test | |
# Set concurrency=1 to run only one test suite (== test file) at a time to make it easier to | |
# attribute native logs. Note that on GitHub Actions this currently makes no difference as | |
# Dart defaults to concurrency=1. | |
# Run again with OBX_IN_MEMORY=true using in-memory database. | |
run: | | |
../tool/pub.sh get | |
../tool/pub.sh run build_runner build | |
../tool/pub.sh run test --concurrency=1 | |
export OBX_IN_MEMORY=true | |
../tool/pub.sh run test --concurrency=1 | |
# Builds a mobile and a desktop release of the main Flutter examples | |
flutter-examples: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-24.04 | |
- windows-2022 # Flutter 2.9 and newer need Visual Studio 2022 to build for desktop | |
flutter-version: | |
# Test latest available and lowest supported SDK (see dev-doc/updating-dart-flutter-and-dependencies.md). | |
# Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new SDKs. | |
# Can not use env variables here, only within 'steps'. | |
# For available versions see https://docs.flutter.dev/release/archive | |
# NOTE Also update versions for Ubuntu below! | |
- 3.29.2 | |
- 3.24.5 # Use latest bugfix release to get tooling fixes | |
include: | |
# Test building for Android with highest supported JDK on latest Flutter SDK, | |
# lowest supported JDK on lowest supported Flutter SDK. (Android is only built if a Linux | |
# OS is detected, see integration-test.sh) | |
- os: ubuntu-24.04 | |
flutter-version: 3.29.2 | |
jdk: 21 | |
- os: ubuntu-24.04 | |
flutter-version: 3.24.5 # Use latest bugfix release to get tooling fixes | |
jdk: 17 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0 | |
with: | |
flutter-version: ${{ matrix.flutter-version }} | |
cache: true | |
- if: ${{ matrix.jdk }} | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.jdk }} | |
- run: echo $PATH | |
- run: flutter --version | |
# https://docs.flutter.dev/desktop#additional-linux-requirements | |
- if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: ./tool/apt-install.sh ninja-build pkg-config libgtk-3-dev | |
- run: make integration-test | |
working-directory: objectbox |