-
-
Notifications
You must be signed in to change notification settings - Fork 4
169 lines (148 loc) · 6.04 KB
/
android_test_and_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# This is a basic workflow to help you get started with Actions
name: Android - Test and Build
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# allows that other workflows can run this one
workflow_call:
secrets:
KEY_PROPERTIES_KEY_PASSWORD:
required: true
KEY_PROPERTIES_STORE_PASSWORD:
required: true
KEY_PROPERTIES_KEY_ALIAS:
required: true
KEYSTORE_BASE64:
required: true
SENTRY_DSN:
required: true
POSTHOG_API_KEY_DEV:
required: true
POSTHOG_API_KEY_REL:
required: true
env:
JAVA_VERSION: "17"
PROPERTIES_PATH: "./android/key.properties"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-13
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup Java to compile Android project
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: ${{env.JAVA_VERSION}}
# get versions from pubspec
- name: set env variables
run: |
python3 ./.github/workflows/building.py set_env_flutter_version
python3 ./.github/workflows/building.py set_env_dakanji_version
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_VERSION}}
channel: stable
- name: Restore packages
run: flutter pub get
# get / set dakanji assets from cache
- name: Check dakanji assets in cache
id: cache-dakanji-assets-restore
uses: actions/cache/restore@v3
with:
path: tmp
key: dakanji-assets
- name: Download DaKanji assets if necessary
if: steps.cache-dakanji-assets-restore.outputs.cache-hit != 'true'
run: |
python3 setup.py --download-all --no-delete
- name: Move DaKanji assets if in cache
if: steps.cache-dakanji-assets-restore.outputs.cache-hit == 'true'
run: |
python3 setup.py --no-download
- name: Save dakanji assets to cache if not saved
if: steps.cache-dakanji-assets-restore.outputs.cache-hit != 'true'
id: cache-dakanji-assets-save
uses: actions/cache/save@v3
with:
path: tmp
key: dakanji-assets
- name: Setup DaKanji env.dart
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
POSTHOG_API_KEY_REL: ${{ secrets.POSTHOG_API_KEY_REL }}
POSTHOG_API_KEY_DEV: ${{ secrets.POSTHOG_API_KEY_DEV }}
run: |
python3 ./.github/workflows/create_dakanji_env.py
flutter pub run build_runner build --delete-conflicting-outputs
# TESTS
#- name: Run integration tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 29
# disk-size: 16G
# target: google_apis
# profile: Nexus 6
# ram-size: 4096M
# heap-size: 1024M
# script: |
# flutter drive --driver=test_driver/integration_test.dart --target=integration_test/draw_screen_test.dart -d emulator
# create signing files
- name: Creating the .properties file
run: |
echo keyPassword=\${{ secrets.KEY_PROPERTIES_KEY_PASSWORD }} > ${{env.PROPERTIES_PATH}}
echo storePassword=\${{ secrets.KEY_PROPERTIES_STORE_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
echo keyAlias=\${{ secrets.KEY_PROPERTIES_KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}}
echo storeFile=../../keys/DaKanjiRecognizer.jks >> ${{env.PROPERTIES_PATH}}
- name: Decoding base64 into a file
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keys/DaKanjiRecognizer.jks
# build apks
- name: build apks for different architectures
run: |
flutter build apk --split-per-abi
flutter build apk
ls build/app/outputs/apk/release/
- name: rename apks
run: |
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk DaKanji_${{env.DAKANJI_VERSION}}_arm64-v8a.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk DaKanji_${{env.DAKANJI_VERSION}}_armeabi-v7a.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk DaKanji_${{env.DAKANJI_VERSION}}_x86_64.apk
mv build/app/outputs/flutter-apk/app-release.apk DaKanji_${{env.DAKANJI_VERSION}}_fat.apk
- name: Upload artifact arm64-v8a
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_arm64-v8a.apk
path: DaKanji_${{env.DAKANJI_VERSION}}_arm64-v8a.apk
- name: Upload artifact armeabi-v7a
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_armeabi-v7a.apk
path: DaKanji_${{env.DAKANJI_VERSION}}_armeabi-v7a.apk
- name: Upload artifact apk x86_64
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_x86_64.apk
path: DaKanji_${{env.DAKANJI_VERSION}}_x86_64.apk
- name: Upload artifact fat apk
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_fat.apk
path: DaKanji_${{env.DAKANJI_VERSION}}_fat.apk
# build appbundle and upload to artifacts
- name: build app bundle
run: |
python3 ./.github/workflows/building.py comment_large_assets_in_pubspec
flutter pub get
flutter build appbundle
- name: Archive appbundle
uses: actions/upload-artifact@v3
with:
name: DaKanji_${{env.DAKANJI_VERSION}}_bundle.zip
path: build/app/outputs/bundle/release/app-release.aab