Skip to content

Commit

Permalink
Feature/logging (#251)
Browse files Browse the repository at this point in the history
* Add logging package

* Refresh linux files

* Android flavor setup

* Setup ios flavors

* Setup release CI

* Refactor CI

* Remove debug prints

* Create prod signingConfig only if exists

* Store recent logs

* Remove flavoring on desktop

* Fix android signing

* Fix release paths (except windows)

* Quote secret var

* debug

* Fix env vars

* Add log console

* Add logs section in bug issue template

* Add time to logs

* Add changelog entry

* Rename log console

* Remove key

* Change way of routing

* Add title
  • Loading branch information
shilangyu authored Sep 23, 2021
1 parent 6a7b999 commit 9f9cc52
Show file tree
Hide file tree
Showing 35 changed files with 826 additions and 205 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ A clear and concise description of what the bug is.
3. Scroll down to '....'
4. See error

### Relevant logs

<details>
<summary>Logs</summary>

Paste your logs here. Logs can be found in lemmur: settings > about lemmur > logs.
</details>

### Expected behavior

A clear and concise description of what you expected to happen.
Expand Down
54 changes: 45 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ on:
branches: [master]

jobs:
android:
name: Android
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: "12.x"

- uses: subosito/flutter-action@v1
with:
channel: "stable"
Expand All @@ -33,12 +29,51 @@ jobs:
- name: Run tests
run: flutter test

android:
name: Android
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: "12.x"

- uses: subosito/flutter-action@v1
with:
channel: "stable"

- name: Inject keystore
working-directory: android/app
run: |
echo "${{ secrets.SIGNING_KEY }}" | base64 -d | tee key.jks >/dev/null
- name: Android build
run: flutter build apk --split-per-abi
env:
ANDROID_KEY_ALIAS: ${{ secrets.ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ANDROID_STORE_PATH: key.jks
ANDROID_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
run: flutter build apk --split-per-abi --release --target lib/main_prod.dart --flavor prod

ios:
name: iOS
runs-on: macos-latest
needs: lint
steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v1
with:
channel: "stable"

- run: flutter build ios --no-codesign --release --target lib/main_prod.dart --flavor prod

linux:
name: Linux
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2

Expand All @@ -57,11 +92,12 @@ jobs:
- name: Build
run: |
flutter build linux
flutter build linux --release --target lib/main_prod.dart
windows:
name: Windows
runs-on: windows-latest
needs: lint
steps:
- uses: actions/checkout@v2

Expand All @@ -75,4 +111,4 @@ jobs:
- name: Build
run: |
flutter build windows
flutter build windows --release --target lib/main_prod.dart
46 changes: 23 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,36 @@ jobs:
run: flutter pub get

- name: Inject keystore
working-directory: android
env:
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ALIAS: ${{ secrets.ALIAS }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
working-directory: android/app
run: |
echo storePassword=$KEY_STORE_PASSWORD > key.properties
echo keyPassword=$KEY_PASSWORD >> key.properties
echo keyAlias=$ALIAS >> key.properties
echo storeFile=$HOME/key.jks >> key.properties
echo $SIGNING_KEY | base64 -d | tee ~/key.jks >/dev/null
echo "${{ secrets.SIGNING_KEY }}" | base64 -d | tee key.jks >/dev/null
- name: Generate appbundle
run: flutter build appbundle
env:
ANDROID_KEY_ALIAS: ${{ secrets.ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ANDROID_STORE_PATH: key.jks
ANDROID_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
run: flutter build appbundle --release --target lib/main_prod.dart --flavor prod

- uses: actions/upload-artifact@v2
with:
name: android-appbundle
path: |
build/app/outputs/bundle/release/app-release.aab
build/app/outputs/bundle/prodRelease/app-prod-release.aab
- name: Android build
run: |
flutter build apk --split-per-abi
env:
ANDROID_KEY_ALIAS: ${{ secrets.ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
ANDROID_STORE_PATH: key.jks
ANDROID_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
run:
flutter build apk --split-per-abi --release --target lib/main_prod.dart --flavor prod

mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-arm64-v8a-android.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-armeabi-v7a-android.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-x86_64-android.apk
mv build/app/outputs/flutter-apk/app-arm64-v8a-prod-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-arm64-v8a-android.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-prod-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-armeabi-v7a-android.apk
mv build/app/outputs/flutter-apk/app-x86_64-prod-release.apk lemmur-${{ needs.get-vars.outputs.tag }}-x86_64-android.apk

- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -96,17 +96,17 @@ jobs:
- name: Build
run: |
flutter build linux
flutter build linux --release --target lib/main_prod.dart
- name: Archive
working-directory: build/linux/release/bundle
working-directory: build/linux/x64/release/bundle
run: |
tar -czf lemmur-${{ needs.get-vars.outputs.tag }}-x86_64-linux.tar.gz *
- uses: actions/upload-artifact@v2
with:
name: linux-build
path: build/linux/release/bundle/lemmur-*.tar.gz
path: build/linux/x64/release/bundle/lemmur-*.tar.gz

windows-build:
name: Windows build
Expand All @@ -125,7 +125,7 @@ jobs:
- name: Build
run: |
flutter build windows
flutter build windows --release --target lib/main_prod.dart
- name: Archive
working-directory: build/windows/runner/Release
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ app.*.map.json

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

# Xcode build files
ios/build
12 changes: 9 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
{
"name": "Debug",
"request": "launch",
"type": "dart"
"type": "dart",
"program": "lib/main_dev.dart",
"args": ["--flavor", "dev"]
},
{
"name": "Profile",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
"flutterMode": "profile",
"program": "lib/main_dev.dart",
"args": ["--flavor", "dev"]
},
{
"name": "Release",
"request": "launch",
"type": "dart",
"flutterMode": "release"
"flutterMode": "release",
"program": "lib/main_dev.dart",
"args": ["--flavor", "dev"]
}
]
}
15 changes: 15 additions & 0 deletions .vscode/lemmur.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,20 @@
"L10n string": {
"prefix": "l10n",
"body": ["L10n.of(context)!.$0"]
},
"Mobx store": {
"prefix": "mobxstore",
"body": [
"import 'package:mobx/mobx.dart';",
"",
"part '$TM_FILENAME_BASE.g.dart';",
"",
"class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} = _${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} with _$${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g};",
"",
"abstract class _${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} with Store {",
"\t@observable",
"\t$0",
"}"
]
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Added

- Logging: local logs about some actions/errors. Can be accessed from **settings > about lemmur > logs**

## v0.6.0 - 2021-09-06

### Added
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ linter:
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_print
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
Expand Down
62 changes: 45 additions & 17 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 30

Expand All @@ -51,21 +45,55 @@ android {
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
dev { }

if (System.getenv("ANDROID_STORE_PATH")) {
prod {
keyAlias System.getenv("ANDROID_KEY_ALIAS")
keyPassword System.getenv("ANDROID_KEY_PASSWORD")
storeFile file(System.getenv("ANDROID_STORE_PATH"))
storePassword System.getenv("ANDROID_STORE_PASSWORD")
}
} else {
prod { }
}
}
}

flavorDimensions "app"

productFlavors {
dev {
dimension "app"
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
manifestPlaceholders = [
appName: "lemmur DEV"
]
signingConfig signingConfigs.debug
}

prod {
dimension "app"
manifestPlaceholders = [
appName: "lemmur"
]
signingConfig signingConfigs.prod
}
}

buildTypes {
debug {
testCoverageEnabled true
debuggable true
minifyEnabled false
signingConfig null
}

release {
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
debuggable false
minifyEnabled true
shrinkResources false
zipAlignEnabled true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<application
android:name="io.flutter.app.FlutterApplication"
android:label="lemmur"
android:label="${appName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Loading

0 comments on commit 9f9cc52

Please sign in to comment.