Skip to content

chore: Update Flutter Template #8

chore: Update Flutter Template

chore: Update Flutter Template #8

name: "[CodeCheck] Flutter - Android"
on:
pull_request:
types: [opened, edited, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# You need to uncomment [Setup - Flutter Actions with Cache] when you want to use
# different runner then our internal M1 flutter-builds runner.
env:
flutter_version: "3.27.1"
java_version: "17"
jobs:
codestyle-check-android:
name: Project CodeCheck
runs-on: ubuntu-latest
# runs-on: [self-hosted, macOS, flutter-builds] # use this for self-hosted runners
timeout-minutes: 15
steps:
- name: '[Setup - Checkout]'
uses: actions/[email protected]
- name: '[Setup - Java]'
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ env.java_version }}
- name: '[Setup - Flutter Actions with Cache]'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.flutter_version }}
cache: true
architecture: x64
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
# Make sure we have latest FVM
- name: '[FVM - Install]'
run: dart pub global activate fvm
# Install correct fvm version
- name: '[FVM - Install version]'
run: fvm install ${{ env.flutter_version }}
# Make gen
- name: '[Flutter - Generate code]'
run: make gen
# Run linter
- name: '[Flutter - Run Linter]'
run: fvm flutter analyze
# Build is slightly faster when targeting single platform, debug version and only apk instead of appbundle
- name: '[Flutter - Build APK]'
run: fvm flutter build apk -t lib/main_develop.dart --flavor develop --target-platform android-arm64 --debug
# Only on self hosted. Cleanup the files after the build
# - name: '[Finish - Cleanup]'
# run: |
# rm -rf ./* || true
# rm -rf ./.??* || true