-
-
Notifications
You must be signed in to change notification settings - Fork 2
257 lines (229 loc) · 8.72 KB
/
fw-lite.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: FieldWorks Lite
on:
workflow_dispatch:
push:
paths:
- 'backend/FwLite/**'
- 'backend/harmony/**'
- 'frontend/viewer/**'
- '.github/workflows/fw-lite.yaml'
branches:
- develop
- main
pull_request:
paths:
- 'backend/FwLite/**'
- 'backend/harmony/**'
- 'frontend/viewer/**'
- '.github/workflows/fw-lite.yaml'
branches:
- develop
- main
jobs:
build-and-test:
name: Build FW Lite and run tests
timeout-minutes: 20
runs-on: windows-latest
outputs:
version: ${{ steps.setVersion.outputs.VERSION }}
semver-version: ${{ steps.setVersion.outputs.SEMVER_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- uses: actions/setup-node@v4
with:
node-version-file: './frontend/package.json'
- name: Set Version
id: setVersion
shell: bash
# set version to date in vYYYY-MM-DD-commitSha format, and semver version to YYYY.MM.DD
run: |
shortSha=$(echo ${{ github.sha }} | cut -c1-8)
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_OUTPUT}
echo "SEMVER_VERSION=$(date +%Y.%-m.%-d)" >> ${GITHUB_OUTPUT}
- name: Build viewer
working-directory: frontend/viewer
run: |
corepack enable
pnpm install
pnpm run build-app
- name: Dotnet build
working-directory: backend/FwLite/FwLiteDesktop
run: |
dotnet build --configuration Release
- name: Dotnet test
run: dotnet test FwLiteOnly.slnf --configuration Release --logger GitHubActions
- name: Upload viewer artifacts
uses: actions/upload-artifact@v4
with:
name: fw-lite-viewer-app
if-no-files-found: error
path: frontend/viewer/dist
publish-mac:
name: Publish FW Lite app for Mac
needs: build-and-test
timeout-minutes: 30
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: actions/download-artifact@v4
with:
name: fw-lite-viewer-app
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Dotnet build
working-directory: backend/FwLite/LocalWebApp
run: dotnet build --configuration Release
- name: Publish OSX
working-directory: backend/FwLite/LocalWebApp
run: dotnet publish -r osx-x64 --artifacts-path ../artifacts -p:Version=${{ needs.build-and-test.outputs.semver-version }}
- name: Publish OSX ARM
working-directory: backend/FwLite/LocalWebApp
run: dotnet publish -r osx-arm64 --artifacts-path ../artifacts -p:Version=${{ needs.build-and-test.outputs.semver-version }}
#todo sign the app
- name: Upload local web app artifacts
uses: actions/upload-artifact@v4
with:
name: fw-lite-local-web-app-mac
if-no-files-found: error
path: backend/FwLite/artifacts/publish/LocalWebApp/*
publish-linux:
name: Publish FW Lite app for Linux
needs: build-and-test
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: actions/download-artifact@v4
with:
name: fw-lite-viewer-app
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Dotnet build
working-directory: backend/FwLite/LocalWebApp
run: dotnet build --configuration Release
- name: Publish Linux
working-directory: backend/FwLite/LocalWebApp
run: dotnet publish -r linux-x64 --artifacts-path ../artifacts -p:PublishSingleFile=true -p:Version=${{ needs.build-and-test.outputs.semver-version }}
- name: Upload FWLite Desktop artifacts
uses: actions/upload-artifact@v4
with:
name: fw-lite-local-web-app-linux
if-no-files-found: error
path: backend/FwLite/artifacts/publish/LocalWebApp/*
publish-win:
name: Publish FW Lite app for Windows
needs: build-and-test
timeout-minutes: 30
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: actions/download-artifact@v4
with:
name: fw-lite-viewer-app
path: frontend/viewer/dist
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Setup Maui
run: dotnet workload install maui-windows
- name: Dotnet build
working-directory: backend/FwLite/LocalWebApp
run: dotnet build --configuration Release
- name: Publish Windows MAUI portable app
working-directory: backend/FwLite/FwLiteDesktop
run: |
dotnet publish -r win-x64 --artifacts-path ../artifacts -p:WindowsPackageType=None -p:ApplicationDisplayVersion=${{ needs.build-and-test.outputs.semver-version }}
dotnet publish -r win-arm64 --artifacts-path ../artifacts -p:WindowsPackageType=None -p:ApplicationDisplayVersion=${{ needs.build-and-test.outputs.semver-version }}
mkdir -p ../artifacts/sign/portable
cp -r ../artifacts/publish/FwLiteDesktop/* ../artifacts/sign/portable/
- name: Publish Windows MAUI msix app
working-directory: backend/FwLite/FwLiteDesktop
run: |
dotnet publish -r win-x64 --artifacts-path ../artifacts -p:ApplicationDisplayVersion=${{ needs.build-and-test.outputs.semver-version }}
dotnet publish -r win-arm64 --artifacts-path ../artifacts -p:ApplicationDisplayVersion=${{ needs.build-and-test.outputs.semver-version }}
mkdir -p ../artifacts/msix
cp ../artifacts/bin/FwLiteDesktop/*/AppPackages/*/*.msix ../artifacts/msix/
- name: Bundle MSIX
working-directory: backend/FwLite/artifacts/msix
shell: pwsh
run: |
$SdkVersion = '10.0.19041.0'
$Architecture = 'x86'
$sdkToolsPath = Join-Path -Path 'C:\Program Files (x86)\Windows Kits\10\bin' -ChildPath $SdkVersion -AdditionalChildPath $Architecture
$env:Path += ";$sdkToolsPath"
MakeAppx.exe bundle /v /bv ${{ needs.build-and-test.outputs.semver-version }}.1 /d . /p ../sign/FwLiteDesktop.msixbundle
- name: Sign with Trusted Signing
if: ${{ github.ref_name == 'develop' || github.ref_name == 'main' }}
uses: sillsdev/codesign/trusted-signing-action@v3
with:
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
files-folder: ${{ github.workspace }}/backend/FwLite/artifacts/sign
files-folder-filter: msixbundle,exe
files-folder-recurse: true
files-folder-depth: 4
description: 'Release for version ${{ needs.build-and-test.outputs.version }} from branch ${{ github.ref_name || github.head_ref }}'
description-url: 'https://github.com/sillsdev/languageforge-lexbox'
- name: Upload FWLite Portable
uses: actions/upload-artifact@v4
with:
name: fw-lite-portable
if-no-files-found: error
path: backend/FwLite/artifacts/sign/portable/*
- name: Upload FWLite MSIX
uses: actions/upload-artifact@v4
with:
name: fw-lite-msix
if-no-files-found: error
path: backend/FwLite/artifacts/sign/*.msixbundle
create-release:
if: ${{ github.ref_name == 'main' }}
name: Create Release
needs: [ build-and-test, publish-win, publish-linux, publish-mac]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: fw-lite-msix
path: fw-lite-msix
- uses: actions/download-artifact@v4
with:
name: fw-lite-portable
path: fw-lite-portable
- uses: actions/download-artifact@v4
with:
name: fw-lite-local-web-app-linux
path: fw-lite-local-web-app-linux
- name: Zip artifacts
run: |
zip -r fw-lite-portable.zip fw-lite-portable
chmod +x fw-lite-local-web-app-linux/*/LocalWebApp
zip -r fw-lite-local-web-app-linux.zip fw-lite-local-web-app-linux
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build-and-test.outputs.version }}
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: |
fw-lite-msix/*
fw-lite-portable.zip
fw-lite-local-web-app-linux.zip