Skip to content

Flutter CI

Flutter CI #145

Workflow file for this run

# Adapted from https://gist.github.com/aagarwal1012/eb2551683d81cf47d60868ab607520b1
name: Flutter CI
on:
workflow_dispatch:
push:
branches:
- master
env:
flutter_version: 2.2.1
jobs:
build:
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout
uses: actions/checkout@v1
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: "12.x"
- name: Cache Flutter
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
- name: Setup Flutter
uses: subosito/flutter-action@v1.5.3
with:
flutter-version: ${{ env.flutter_version }}
- name: Disable Analytics
run: flutter config --no-analytics
- name: Install Dependencies
run: flutter pub get
# Checks
- name: Analyze
run: flutter analyze .
- name: Check Format
run: flutter format --set-exit-if-changed -l 9999 --dry-run .
# - name: Test
# run: flutter test
# env:
# TOKEN_API: ${{ secrets.TOKEN_API }}
# TOKEN_API_AUTH: ${{ secrets.TOKEN_API_AUTH }}
# Build
- name: Build
run: flutter build apk --split-per-abi --dart-define=GITHUB_SHA=$GITHUB_SHA
# Add File
- name: Export APK
uses: actions/upload-artifact@v3
with:
name: release-apk
path: build/app/outputs/flutter-apk/*.apk
# Upload
- name: Upload APK to API
run: |
curl -X POST -F file='@build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk' -F head_sha=$GITHUB_SHA -H 'Authorization: Bearer ${{secrets.UPLOAD_TOKEN}}' https://api.argo-magister.nl/v1/builder/upload/