Skip to content

Update build.yml

Update build.yml #2

Workflow file for this run

name: GarageScouter
on:
push:
branches: [main]
pull_request:
env:
FLUTTER_VERSION: 3.16.9
jobs:
formatting-analysis:
name: "[GUI] Check Formatting & Analysis"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Get dependencies
run: flutter pub get
- name: Generate mocks
run: dart run build_runner build
- name: Analyze
run: flutter analyze
- name: Check formatting
run: dart format -o none --set-exit-if-changed lib/* test/*
test:
name: "[GUI] Run Tests"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Get dependencies
run: flutter pub get
# - name: Generate full coverage test
# run: dart run full_coverage
- name: Generate mocks
run: dart run build_runner build
# - name: Run tests
# run: flutter test --coverage
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# name: flutter-coverage
# files: coverage/lcov.info
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
build-option: "windows"
artifact-path: "build/windows/x64/runner/Release"
artifact-name: GarageScouter-Windows
- os: macos-14
build-option: "macos"
artifact-path: "build/macos/Build/Products/Release/PathPlanner-macOS.zip"
artifact-name: GarageScouter-macOS
- os: ubuntu-22.04
build-option: "linux"
artifact-path: "build/linux/x64/release/bundle"
artifact-name: GarageScouter-Linux
- os: ubuntu-22.04
build-option: "apk"
artifact-path: "build/app/outputs/flutter-apk/app-release.apk"
artifact-name: GarageScouter-Android
name: "[GUI] Build - ${{ matrix.artifact-name }}"
needs: [formatting-analysis, test]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install flutter deps
if: ${{ matrix.build-option == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }}
- name: Get dependencies
run: flutter pub get
- name: Build App Icons
run: dart run flutter_launcher_icons
- name: Build Isar
run: dart run build_runner build
- name: Set dev version env
if: ${{ github.event_name != 'workflow_dispatch' && matrix.build-option != 'windows' }}
run: echo "VERSION_NAME=0.0.0-dev-${{ github.run_number }}" >> $GITHUB_ENV
- name: Set pubspec version
run: |
flutter pub global activate cider
dart run cider version "${{ env.VERSION_NAME }}+${{ github.run_number }}"
- name: Build app
run: flutter build ${{ matrix.build-option }}
- name: Zip release
if: ${{ matrix.build-option == 'macos' }}
run: |
cd build/macos/Build/Products/Release
zip -r GarageScouter-macOS.zip GarageScouter.app --symlinks
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}