Improved example app #619
This file contains 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: CI/CD | |
on: | |
push: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
score-package: | |
name: "Score Package" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Run Dart Package Analyser | |
uses: axel-op/dart-package-analyzer@master | |
id: analysis | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check Package Scores | |
env: | |
TOTAL: ${{ steps.analysis.outputs.total }} | |
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} | |
run: | | |
if (( $TOTAL < $TOTAL_MAX )) | |
then | |
echo Package score less than available score. Improve the score! | |
exit 1 | |
fi | |
analyse-code: | |
name: "Analyse Code" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Flutter Environment | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "beta" | |
cache: true | |
- name: Get Package Dependencies | |
run: flutter pub get | |
- name: Get Example Dependencies | |
run: flutter pub get -C example | |
- name: Get Test Tile Server Dependencies | |
run: dart pub get -C tile_server | |
- name: Check Formatting | |
run: dart format --output=none --set-exit-if-changed . | |
- name: Check Lints | |
run: dart analyze --fatal-warnings | |
run-tests: | |
name: "Run Tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Flutter Environment | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "beta" | |
cache: true | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Install ObjectBox Libs For Testing | |
run: cd test && bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh) --quiet | |
- name: Run Tests | |
run: flutter test -r expanded | |
build-demo-android: | |
name: "Build Demo App (Android)" | |
runs-on: ubuntu-latest | |
needs: [analyse-code, run-tests] | |
defaults: | |
run: | |
working-directory: ./example | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Java 21 Environment | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
cache: 'gradle' | |
- name: Setup Flutter Environment | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "beta" | |
cache: true | |
- name: Build | |
run: flutter build apk --obfuscate --split-debug-info=./symbols | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-demo | |
path: example/build/app/outputs/apk/release | |
if-no-files-found: error | |
build-demo-windows: | |
name: "Build Demo App (Windows)" | |
runs-on: windows-latest | |
needs: [analyse-code, run-tests] | |
defaults: | |
run: | |
working-directory: ./example | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Flutter Environment | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "beta" | |
cache: true | |
- name: Build | |
run: flutter build windows --obfuscate --split-debug-info=./symbols | |
- name: Create Installer | |
run: iscc "windowsApplicationInstallerSetup.iss" | |
working-directory: . | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-demo | |
path: windowsTemp/WindowsApplication.exe | |
if-no-files-found: error | |
build-tile-server-windows: | |
name: "Build Tile Server (Windows)" | |
runs-on: windows-latest | |
needs: [analyse-code, run-tests] | |
defaults: | |
run: | |
working-directory: ./tile_server | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Dart Environment | |
uses: dart-lang/setup-dart@v1 | |
- name: Get Dependencies | |
run: dart pub get | |
- name: Get Dart Dependencies | |
run: dart pub get | |
- name: Generate Tile Images | |
run: dart run bin/generate_dart_images.dart | |
- name: Compile | |
run: dart compile exe bin/tile_server.dart | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-ts | |
path: tile_server/bin/tile_server.exe | |
if-no-files-found: error | |
build-tile-server-linux: | |
name: "Build Tile Server (Linux/Ubuntu)" | |
runs-on: ubuntu-latest | |
needs: [analyse-code, run-tests] | |
defaults: | |
run: | |
working-directory: ./tile_server | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Dart Environment | |
uses: dart-lang/setup-dart@v1 | |
- name: Get Dependencies | |
run: dart pub get | |
- name: Run Pre-Compile Generator | |
run: dart run bin/generate_dart_images.dart | |
- name: Compile | |
run: dart compile exe bin/tile_server.dart | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-ts | |
path: tile_server/bin/tile_server.exe | |
if-no-files-found: error |