Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
86c2860a2This file is pinned to the selected release. Download the original to open it in your design tool.
name: Flutter CI
on:
push:
branches: [master, dev, dev-*]
paths:
- 'client/**'
pull_request:
branches: [master, dev, dev-*]
paths:
- 'client/**'
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: Read Flutter version
id: read-flutter-version
run: |
echo "FLUTTER_VERSION=$(cat flutter_version)" >> $GITHUB_ENV
working-directory: client
- 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: ${{ steps.read-flutter-version.outputs.FLUTTER_VERSION }}
cache: true
- name: Cache pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('pubspec.yaml', 'pubspec.lock') }}
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 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: Read Flutter version
id: read-flutter-version
run: |
echo "FLUTTER_VERSION=$(cat flutter_version)" >> $GITHUB_ENV
working-directory: client
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ steps.read-flutter-version.outputs.FLUTTER_VERSION }}
cache: true
- name: Cache pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('pubspec.yaml', 'pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-cache-
- name: Install dependencies
run: flutter pub get
- name: Run dart format check
run: dart format --set-exit-if-changed .
- name: Run tests
run: flutter test
build-apk:
needs: setup
runs-on: ubuntu-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read Flutter version
id: read-flutter-version
run: |
echo "FLUTTER_VERSION=$(cat flutter_version)" >> $GITHUB_ENV
working-directory: client
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ steps.read-flutter-version.outputs.FLUTTER_VERSION }}
cache: true
- name: Cache pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('pubspec.yaml', 'pubspec.lock') }}
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 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 dependencies
# run: flutter pub get
# shell: powershell
# - name: Build Windows executable
# run: flutter build windows --release --no-pub
# shell: powershell