Skip to content

Generator: link to build_runner analyzer issue #257

Generator: link to build_runner analyzer issue

Generator: link to build_runner analyzer issue #257

Workflow file for this run

name: Test
# Avoid duplicate builds for pull requests, allow manual trigger.
on:
push:
branches:
- main
- dev
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.
# Build Flutter test app with latest and lowest supported Flutter 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_LATEST: 3.47.5 # Available versions: https://docs.flutter.dev/release/archive
FLUTTER_VERSION_LOWEST: 3.44.1 # Lowest supported Flutter SDK
DART_VERSION: 3.13.4 # 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Prefer running on Ubuntu over Dart Docker image
- uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d # v1.8.1
with:
sdk: ${{ env.DART_VERSION }}
- 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
flutter-version: ${{ env.FLUTTER_VERSION_LATEST }}
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-2025
- macos-15
- 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.13.4
- 3.7.3 # Use latest bugfix release to get tooling fixes
runs-on: ${{ matrix.os }}
steps:
- uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d # v1.8.1
with:
sdk: ${{ matrix.sdk }}
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Generator Test
working-directory: generator
# Generator test suites must not run in parallel (see notes on GeneratorTestEnv):
# set concurrency=1 to run only one test suite (== test file) at a time.
run: |
../tool/pub.sh get
../tool/pub.sh run test --concurrency=1
- name: Install ObjectBox C library
working-directory: objectbox_test
# Use Sync-enabled library to at least partially run sync_test.dart
run: ../install.sh --sync
- 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
# Checks the main Flutter examples can be built for mobile and desktop platforms with latest SDK
flutter-examples:
strategy:
fail-fast: false
matrix:
os:
- macos-15
- ubuntu-24.04
- windows-2025
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
flutter-version: ${{ env.FLUTTER_VERSION_LATEST }}
cache: true
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
# Test building for Android (must use a Linux OS, see build-example.sh) with the
# highest supported JDK.
# ubuntu-24.04 defaults to JDK 17.
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version: 21
verify-signature: true
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
# Install Ubuntu packages required for Flutter build
# https://docs.flutter.dev/platform-integration/linux/setup#set-up-tooling
# Note: clang, cmake, pkg-config and libstdc++-12-dev are pre-installed on ubuntu-24.04
run: ./tool/apt-install.sh ninja-build libgtk-3-dev
- run: echo $PATH
- run: flutter doctor -v
- run: make examples
working-directory: objectbox
# Verifies dependencies can be resolved (the Flutter SDK might pin lower versions than possible
# based on its bundled Dart SDK, see https://dart.dev/go/sdk-version-pinning) and a Flutter app
# can be built (currently only for Android) with latest and lowest supported Flutter SDK.
# Running integration tests requires an emulator, so this is still done manually.
test-app-build:
strategy:
fail-fast: false
matrix:
# Test latest available and lowest supported Flutter SDK.
# Env variables can not be used directly here, so reference them by name
# and resolve them in the steps below via the env context.
flutter-version-var:
- FLUTTER_VERSION_LATEST
- FLUTTER_VERSION_LOWEST
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
flutter-version: ${{ env[matrix.flutter-version-var] }}
cache: true
- run: flutter doctor -v
- name: Build Android App Bundle
working-directory: objectbox_test_app
run: |
flutter pub get
dart run build_runner build
flutter build appbundle