-
Notifications
You must be signed in to change notification settings - Fork 4
232 lines (198 loc) · 8.08 KB
/
build_wlma_binaries_ghh.yaml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Build Window, Liunx, macOS, Android (GH hosted)
on:
workflow_dispatch:
workflow_call:
outputs:
version:
description: "Version string extracted from pubspec.yaml"
value: ${{ jobs.build.outputs.version }}
jobs:
build:
runs-on: ${{ matrix.os }}
outputs:
version: ${{ env.VERSION }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Extract secrets
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
run: |
echo "${{ secrets.SECRET_FILES }}" | base64 -d > secret_files.zip
unzip secret_files.zip -d .
- name: Extract secrets
if: matrix.os == 'windows-latest'
env:
secretfiles: "${{ secrets.SECRET_FILES }}"
run: |
$secretFiles = $env:secretfiles
$secretFilesBytes = [System.Convert]::FromBase64String($secretFiles)
$secretFilesZip = "secret_files.zip"
[IO.File]::WriteAllBytes($secretFilesZip, $secretFilesBytes)
unzip $secretFilesZip -d .
- name: Set up Java
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: "17.*"
cache: gradle
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
#architecture: x64
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Check Flutter Version
run: flutter --version
- name: Upgrade Flutter
run: flutter upgrade
- name: Get Dependencies
run: flutter pub get
- name: Install Linux build dependancies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y
sudo sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev imagemagick
- name: Run tests
run: flutter test --coverage
- name: Build for Windows
if: matrix.os == 'windows-latest'
run: flutter build windows
- name: Build for Linux
if: matrix.os == 'ubuntu-latest'
run: flutter build linux
- name: Build for macOS
if: matrix.os == 'macos-latest'
run: flutter build macos
- name: Get Android keystore
if: matrix.os == 'ubuntu-latest'
id: android_keystore
uses: timheuer/base64-to-file@v1.2
with:
fileName: keystore.jks
encodedString: ${{ secrets.STOREFILE }}
- name: Create key.properties for Android
if: matrix.os == 'ubuntu-latest'
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties
echo "storePassword=${{ secrets.STOREPASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEYPASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEYALIAS }}" >> android/key.properties
- name: Build Android (aab)
if: matrix.os == 'ubuntu-latest'
run: flutter build appbundle
- name: Build Android (apk)
if: matrix.os == 'ubuntu-latest'
run: flutter build apk
- name: Extract version from pubspec.yaml (macOS and Linux)
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
run: |
echo "VERSION=$(sed -n 's/^version: *//p' pubspec.yaml)" >> $GITHUB_ENV
shell: bash
- name: Extract version from pubspec.yaml (Windows)
if: matrix.os == 'windows-latest'
run: |
$version = (Select-String -Path "pubspec.yaml" -Pattern 'version: (.+)$').Matches.Groups[1].Value.Trim()
"VERSION=$version" >> $env:GITHUB_ENV
shell: powershell
- name: Rename Android aab and apk
if: matrix.os == 'ubuntu-latest'
run: |
mv build/app/outputs/bundle/release/app-release.aab build/app/outputs/bundle/release/dikt-android-${{ env.VERSION }}.aab
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/dikt-android-${{ env.VERSION }}.apk
# Using tar to keep 'execute' attribute of binary, this one is lost when simply uploading folder as artefact and getting it as .zip
- name: Compress and package the artifact (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cd build/linux/x64/release/bundle
tar -czf ../../../../dikt-linux-x64-${{ env.VERSION }}.tar ./
- name: Compress and package the artifact (macOS)
if: matrix.os == 'macos-latest'
run: |
cd build/macos/Build/Products/Release/
zip -r -D -y dikt-macOS-${{ env.VERSION }}.zip dikt.app
mv dikt-macOS-${{ env.VERSION }}.zip ../../../../dikt-macOS-${{ env.VERSION }}.zip
# zip -r -D -y dikt-macOS-x64-${{ env.VERSION }}.zip dikt.app
# mv dikt-macOS-x64-${{ env.VERSION }}.zip ../../../../dikt-macOS-x64-${{ env.VERSION }}.zip
# Zip file will be zipped by GH when creating artifcat, no need
# - name: Compress and package the artifact (Windows)
# if: matrix.os == 'windows-latest'
# run: Compress-Archive -Path ".\build\windows\runner\Release\" -DestinationPath ".\build\dikt-windows-x64-${{ env.VERSION }}.zip"
# shell: powershell
- name: List contents of the Release directory (Windows)
if: matrix.os == 'windows-latest'
run: Get-ChildItem -Path ".\build\windows\x64\runner\Release\" -Name
shell: powershell
- name: Smoketest/run app (Windows)
if: matrix.os == 'windows-latest'
run: Start-Process -FilePath ".\build\windows\x64\runner\Release\dikt.exe"
shell: powershell
- name: Smoketest/run app (macOS)
if: matrix.os == 'macos-latest'
run: |
open build/macos/Build/Products/Release/dikt.app --stdout build/stdout_dikt.txt --args build/
# sleep 3
# For some reasons the app shows empty window
# - name: Upload stdout (macOS)
# if: matrix.os == 'macos-latest'
# uses: actions/upload-artifact@v3
# with:
# name: stdout_dikt.txt
# path: build/stdout_dikt.txt
# if-no-files-found: error
# - name: Make screenshot (macOS)
# if: matrix.os == 'macos-latest'
# uses: OrbitalOwen/desktop-screenshot-action@0.1
# with:
# file-name: 'macOS.jpg'
- name: Smoketest/run app (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
nohup build/linux/x64/release/bundle/dikt &
# Action doesn't work on Linux, no desktop environment likely
# - name: Make screenshot (Linux)
# if: matrix.os == 'ubuntu-latest'
# uses: OrbitalOwen/desktop-screenshot-action@0.1
# with:
# file-name: 'Linux.jpg'
- name: Upload Artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: dikt-windows-x64-${{ env.VERSION }}
path: build/windows/x64/runner/Release/
if-no-files-found: error
- name: Upload Artifact (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: dikt-linux-x64-${{ env.VERSION }}.tar
path: build/dikt-linux-x64-${{ env.VERSION }}.tar
if-no-files-found: error
- name: Upload Artifact (Android aab)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: dikt-android-${{ env.VERSION }}.aab
path: build/app/outputs/bundle/release/dikt-android-${{ env.VERSION }}.aab
if-no-files-found: error
- name: Upload Artifact (Android apk)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: dikt-android-${{ env.VERSION }}.apk
path: build/app/outputs/flutter-apk/dikt-android-${{ env.VERSION }}.apk
if-no-files-found: error
- name: Upload Artifact (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: dikt-macOS-${{ env.VERSION }}
path: build/dikt-macOS-${{ env.VERSION }}.zip
# name: dikt-macOS-x64-${{ env.VERSION }}
# path: build/dikt-macOS-x64-${{ env.VERSION }}.zip
if-no-files-found: error