-
Notifications
You must be signed in to change notification settings - Fork 8
113 lines (92 loc) · 3.23 KB
/
ci.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
name: CI
on:
workflow_call:
inputs:
project_path:
description: Path to .csproj to build
required: true
type: string
test_mobile:
description: Test mobile projects
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
project_path:
description: Path to .csproj to build
required: true
type: string
jobs:
build_and_test:
name: Build & Test
runs-on: ubuntu-latest
if: ${{ inputs.test_mobile == 'false' || inputs.test_mobile == null }}
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install Workload
run: |
dotnet nuget locals all --clear
dotnet workload install wasm-tools --source https://api.nuget.org/v3/index.json --ignore-failed-sources
- name: Restore
run: dotnet restore ${{ inputs.project_path }}
- name: Build
run: dotnet build ${{ inputs.project_path }} --no-restore --configuration Release
- name: Test
run: dotnet test ${{ inputs.project_path }} --no-build --configuration Release --logger "trx;LogFileName=test-results.trx"
- name: Check file existence
id: check_files
if: success() || failure()
uses: andstor/file-existence-action@v1
with:
files: "test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: steps.check_files.outputs.files_exists == 'true'
with:
name: Tests Results
path: test-results.trx
reporter: dotnet-trx
build_and_test_mobile:
name: Build & Test Android
runs-on: windows-latest
if: ${{ inputs.test_mobile != 'false' && inputs.test_mobile != '' }}
steps:
- uses: actions/checkout@v3
- name: Setup DotNet Environment
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install MAUI Workload
run: |
dotnet nuget locals all --clear
dotnet workload install maui --ignore-failed-sources
dotnet workload install android maui wasm-tools --source https://api.nuget.org/v3/index.json
- name: Restore Dependencies
run: |
dotnet restore SSW.Rewards.sln
- name: Update google-services.json
shell: bash
run: |
echo ${{ vars.GOOGLE_SERVICES_JSON }} | base64 --decode > src/MobileUI/Platforms/Android/google-services.json
- name: Build and sign Android
run: dotnet build src/MobileUI/MobileUI.csproj -f:net8.0-android --configuration Release
- name: Test
run: dotnet test ${{ inputs.project_path }} --no-build --configuration Release --logger "trx;LogFileName=test-results.trx"
- name: Check file existence
id: check_files
if: success() || failure()
uses: andstor/file-existence-action@v1
with:
files: "test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: steps.check_files.outputs.files_exists == 'true'
with:
name: Tests Results
path: test-results.trx
reporter: dotnet-trx