Skip to content

fix: Flutter caching issues in GitHub actions #27

fix: Flutter caching issues in GitHub actions

fix: Flutter caching issues in GitHub actions #27

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.38.5"
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: 25
steps:
- name: '[Setup - Checkout]'
uses: actions/checkout@v4.2.1
- name: '[Setup - Java]'
uses: actions/setup-java@v4.4.0
with:
distribution: 'zulu'
java-version: ${{ env.java_version }}
# Install Flutter SDK
- name: '[Setup - Flutter SDK]'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.flutter_version }}
cache: false
architecture: x64
# 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 }}
# Install sops
- name: '[Secrets - Setup SOPS]'
uses: nhedger/setup-sops@v2
# Load secrets
- name: '[Secrets - Generate keystore and properties]'
env:
SECRETS_ENCRYPT_KEY: ${{ secrets.SECRETS_ENCRYPT_KEY }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_PROPERTIES: ${{ secrets.RELEASE_PROPERTIES }}
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_STG_APP_DISTRIBUTION_SERVICE_ACCOUNT }}
run: ./extras/secrets/tools/load-secrets.sh
# 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_staging.dart --flavor staging --target-platform android-arm64 --obfuscate --split-debug-info=build/app/outputs/symbols --debug
# Only on self hosted. Cleanup the files after the build
# - name: '[Finish - Cleanup]'
# run: |
# rm -rf ./* || true
# rm -rf ./.??* || true