-
-
Notifications
You must be signed in to change notification settings - Fork 203
72 lines (58 loc) · 2.63 KB
/
main.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
name: Build
on:
push:
branches:
- master
- develop
pull_request:
branches: [ master ]
workflow_dispatch:
env:
FRAMEWORK: net8.0-android
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Android workload
run: dotnet workload install android
- name: Install Android platform tools
run: $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install platform-tools
- name: Restore NuGet packages
run: dotnet restore
- name: Run tests
run: dotnet test --configuration $CONFIGURATION --no-restore --collect:"XPlat Code Coverage" --results-directory ./coverage Stratum.Test/Stratum.Test.csproj
- name: Publish Android
run: |
REF=$(echo $GITHUB_SHA | cut -c -7)
sed -i "s|package=\"com.stratumauth.app\"|package=\"com.stratumauth.app.$REF\"|g" Stratum.Droid/Properties/AndroidManifest.xml
sed -i "s|<string name=\"displayName\" translatable=\"false\">Authenticator</string>|<string name=\"displayName\" translatable=\"false\">Authenticator ($REF)</string>|g" Stratum.Droid/Resources/values/strings.xml
dotnet publish -f:$FRAMEWORK -c:$CONFIGURATION --no-restore Stratum.Droid/Stratum.Droid.csproj
APK=$(find Stratum.Droid/bin/$CONFIGURATION/$FRAMEWORK/publish -name '*-Signed.apk')
mv $APK "com.stratumauth.app.$REF.apk"
- name: Publish Wear OS
run: |
REF=$(echo $GITHUB_SHA | cut -c -7)
sed -i "s|package=\"com.stratumauth.app\"|package=\"com.stratumauth.app.$REF\"|g" Stratum.WearOS/Properties/AndroidManifest.xml
sed -i "s|<string name=\"displayName\" translatable=\"false\">Authenticator</string>|<string name=\"displayName\" translatable=\"false\">Authenticator ($REF)</string>|g" Stratum.WearOS/Resources/values/strings.xml
dotnet publish -f:$FRAMEWORK -c:$CONFIGURATION --no-restore Stratum.WearOS/Stratum.WearOS.csproj
APK=$(find Stratum.WearOS/bin/$CONFIGURATION/$FRAMEWORK/publish -name '*-Signed.apk')
mv $APK "com.stratumauth.app.wearos.$REF.apk"
- name: Generate coverage report
uses: irongut/[email protected]
with:
filename: coverage/**/coverage.cobertura.xml
badge: true
format: markdown
output: both
thresholds: '60 80'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Stratum
path: |
com.stratumauth.app*.apk
code-coverage-results.md