Skip to content

Refactor code to improve cancellation handling and remove unused outp… #321

Refactor code to improve cancellation handling and remove unused outp…

Refactor code to improve cancellation handling and remove unused outp… #321

Workflow file for this run

name: Flutter CI
on:
push:
branches: [master, dev]
paths:
- 'client/**'
pull_request:
branches: [master, dev]
paths:
- 'client/**'
env:
FLUTTER_VERSION: 3.32.0
jobs:
setup:
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
# outputs removed as setup-flutter does not define flutter-version output
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Flutter
id: setup-flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Cache pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('client/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-cache-
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('client/**/*.gradle*', 'client/**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Install Melos
run: dart pub global activate melos
- name: Install dependencies
run: flutter pub get
test:
needs: setup
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Restore pub cache
uses: actions/cache/restore@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('client/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-cache-
- name: Install Melos
run: dart pub global activate melos
- name: Install dependencies
run: flutter pub get
- name: Run dart format check
run: dart format --set-exit-if-changed .
- name: Run tests
run: melos run test:all
build-apk:
needs: setup
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Restore pub cache
uses: actions/cache/restore@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('client/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-cache-
- name: Restore Gradle cache
uses: actions/cache/restore@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('client/**/*.gradle*', 'client/**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Install Melos
run: dart pub global activate melos
- name: Install dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release --target-platform android-arm64 --no-pub
# - name: Upload APK artifact
# uses: actions/upload-artifact@v2
# with:
# name: release-apk
# path: build/app/outputs/flutter-apk/borneo-app-release.apk
#
# build-windows:
# needs: setup
# runs-on: windows-latest
# defaults:
# run:
# working-directory: client
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Setup Flutter
# uses: subosito/flutter-action@v2
# with:
# channel: stable
# flutter-version: ${{ env.FLUTTER_VERSION }}
# cache: true
# - name: Restore pub cache
# uses: actions/cache/restore@v4
# with:
# path: ~/AppData/Local/Pub/Cache
# key: ${{ runner.os }}-pub-cache-${{ hashFiles('client/pubspec.yaml') }}
# restore-keys: ${{ runner.os }}-pub-cache-
# - name: Install Visual Studio Build Tools
# run: |
# choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK" -y
# shell: powershell
# - name: Cache MSBuild
# uses: actions/cache@v4
# with:
# path: ~/AppData/Local/Microsoft/VisualStudio
# key: ${{ runner.os }}-msbuild-${{ hashFiles('client/windows/**') }}
# restore-keys: ${{ runner.os }}-msbuild-
# - name: Install Melos
# run: dart pub global activate melos
# shell: powershell
# - name: Install dependencies
# run: flutter pub get
# shell: powershell
# - name: Build Windows executable
# run: flutter build windows --release --no-pub
# shell: powershell