mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
ML-51 Integrate Crashlytics (#52)
* added crashlytics * added firebase_options to CD * Version bump * added firebase_options to CI * timeout
This commit is contained in:
parent
6944da25fa
commit
6232ad555a
9 changed files with 46 additions and 21 deletions
14
.github/workflows/cd_dev.yml
vendored
14
.github/workflows/cd_dev.yml
vendored
|
@ -59,13 +59,13 @@ jobs:
|
||||||
echo -n "$GOOGLE_SERVICES_JSON_ANDROID" | base64 --decode --output $GOOGLE_SERVICES_JSON_ANDROID_PATH
|
echo -n "$GOOGLE_SERVICES_JSON_ANDROID" | base64 --decode --output $GOOGLE_SERVICES_JSON_ANDROID_PATH
|
||||||
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
||||||
|
|
||||||
# - name: Restore lib/firebase_options.dart
|
- name: Restore firebase_options.dart
|
||||||
# env:
|
env:
|
||||||
# KEYSTORE: ${{ secrets.FIREBASE_OPTIONS }}
|
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
||||||
# run: |
|
run: |
|
||||||
# FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
||||||
# echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
||||||
# cp $FIREBASE_OPTIONS_PATH ./lib
|
cp $FIREBASE_OPTIONS_PATH ./lib
|
||||||
|
|
||||||
- name: Install Flutter
|
- name: Install Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
|
|
14
.github/workflows/cd_prod.yml
vendored
14
.github/workflows/cd_prod.yml
vendored
|
@ -50,13 +50,13 @@ jobs:
|
||||||
echo -n "$GOOGLE_SERVICES_JSON_ANDROID" | base64 --decode --output $GOOGLE_SERVICES_JSON_ANDROID_PATH
|
echo -n "$GOOGLE_SERVICES_JSON_ANDROID" | base64 --decode --output $GOOGLE_SERVICES_JSON_ANDROID_PATH
|
||||||
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
cp $GOOGLE_SERVICES_JSON_ANDROID_PATH ./android/app
|
||||||
|
|
||||||
# - name: Restore firebase_options.dart
|
- name: Restore firebase_options.dart
|
||||||
# env:
|
env:
|
||||||
# FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
||||||
# run: |
|
run: |
|
||||||
# FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
||||||
# echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
||||||
# cp $FIREBASE_OPTIONS_PATH ./lib
|
cp $FIREBASE_OPTIONS_PATH ./lib
|
||||||
|
|
||||||
- name: Install Flutter
|
- name: Install Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
|
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -14,7 +14,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
timeout-minutes: 5
|
timeout-minutes: 10
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: shaunco/ssh-agent@git-repo-mapping
|
- uses: shaunco/ssh-agent@git-repo-mapping
|
||||||
|
@ -41,7 +41,13 @@ jobs:
|
||||||
- name: Generate intl
|
- name: Generate intl
|
||||||
run: flutter pub run intl_utils:generate
|
run: flutter pub run intl_utils:generate
|
||||||
|
|
||||||
|
- name: Restore firebase_options.dart
|
||||||
|
env:
|
||||||
|
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
|
||||||
|
run: |
|
||||||
|
FIREBASE_OPTIONS_PATH=$RUNNER_TEMP/firebase_options.dart
|
||||||
|
echo -n "$FIREBASE_OPTIONS" | base64 --decode --output $FIREBASE_OPTIONS_PATH
|
||||||
|
cp $FIREBASE_OPTIONS_PATH ./lib
|
||||||
|
|
||||||
- name: Analyze project source
|
- name: Analyze project source
|
||||||
run: flutter analyze lib --fatal-infos
|
run: flutter analyze lib --fatal-infos
|
||||||
# - name: Run tests
|
|
||||||
# run: flutter test
|
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
analyzer:
|
|
||||||
exclude: [lib/main_prod.dart]
|
|
|
@ -29,6 +29,7 @@ if (keystorePropertiesFile.exists()) {
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
lib/firebase.dart
Normal file
14
lib/firebase.dart
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
import 'firebase_options.dart';
|
||||||
|
|
||||||
|
Future<void> initializeFirebase() async {
|
||||||
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
|
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
|
||||||
|
PlatformDispatcher.instance.onError = (error, stack) {
|
||||||
|
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/environment.dart';
|
import 'package:lightmeter/environment.dart';
|
||||||
|
|
||||||
import 'application.dart';
|
import 'application.dart';
|
||||||
|
import 'firebase.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await initializeFirebase();
|
||||||
|
|
||||||
runApp(const Application(Environment.prod()));
|
runApp(const Application(Environment.prod()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: lightmeter
|
name: lightmeter
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 0.9.1+16
|
version: 0.9.2+17
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.0 <3.0.0"
|
sdk: ">=2.18.0 <3.0.0"
|
||||||
|
@ -11,6 +11,8 @@ dependencies:
|
||||||
camera: 0.10.0+4
|
camera: 0.10.0+4
|
||||||
exif: 3.1.2
|
exif: 3.1.2
|
||||||
dynamic_color: 1.5.4
|
dynamic_color: 1.5.4
|
||||||
|
firebase_core: 2.10.0
|
||||||
|
firebase_crashlytics: 3.1.2
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_bloc: 8.1.1
|
flutter_bloc: 8.1.1
|
||||||
|
|
Loading…
Reference in a new issue