-
Notifications
You must be signed in to change notification settings - Fork 62
174 lines (148 loc) · 8.68 KB
/
Test.yml
File metadata and controls
174 lines (148 loc) · 8.68 KB
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
name: Execute Unit Tests
on:
workflow_call:
jobs:
Test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
BUILD_CONFIGURATION: "Release"
SLDOMAIN: "amdocs.sealights.co"
APP_NAME: "Ginger"
APP_NAMESPACE: "Amdocs.*,ginger.*"
PR_NUMBER: ${{github.event.pull_request.number}}
PR_TARGET_BRANCH: "Releases/${{github.base_ref}}"
PR_LAST_COMMIT: ${{ github.event.pull_request.head.sha }}
REPO_URL: ${{github.repositoryUrl }}
steps:
# ------------------------------------------------------------------------------------------------------
# Restore static site content
# ------------------------------------------------------------------------------------------------------
- name: Restore static site content -Windows
if: runner.os == 'Windows'
uses: actions/cache@v5
with:
path: ./**
key: cache-site-windows-${{ github.run_number }}
enableCrossOsArchive:
true
- name: Restore static site content - Linux
if: runner.os == 'Linux'
uses: actions/cache@v5
with:
path: ./**
key: cache-site-linux-${{ github.run_number }}
enableCrossOsArchive:
true
- name: Restore static site content - macOS
if: runner.os == 'macOS'
uses: actions/cache@v5
with:
path: ./**
key: cache-site-macos-${{ github.run_number }}
enableCrossOsArchive:
true
# ------------------------------------------------------------------------------------------------------
# Install .Net core SDK 10.0.103
# ------------------------------------------------------------------------------------------------------
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.103
# ------------------------------------------------------------------------------------------------------
# Install Mono - for Ubuntu as pre-requisite for building Ginger
# ------------------------------------------------------------------------------------------------------
- name: 'Install Mono - Linux'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y mono-complete
- name: 'Install Mono - macOS'
if: runner.os == 'macOS'
run: brew install mono
# ------------------------------------------------------------------------------------------------------
# Install Nuget tool v1.0.5
# ------------------------------------------------------------------------------------------------------
- name: Setup Nuget
uses: Nuget/setup-nuget@v2.0.1
# ------------------------------------------------------------------------------------------------------
# Restore Ginger solution NuGet packages
# ------------------------------------------------------------------------------------------------------
- name: Restore nuget packages
run: nuget restore ./Ginger/Ginger.sln
# ------------------------------------------------------------------------------------------------------
# Install msbild && Build Ginger Solution
# ------------------------------------------------------------------------------------------------------
- name: Add msbuild to PATH
if: ${{github.workflow == 'Ginger Windows Test'}}
uses: microsoft/setup-msbuild@v2
- name: Build Ginger Solution
if: ${{github.workflow == 'Ginger Windows Test'}}
run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=$env:BUILD_CONFIGURATION
# ------------------------------------------------------------------------------------------------------
# Start Testing
# ------------------------------------------------------------------------------------------------------
- name: 'Testing GingerUtilsTest'
if: success() || failure()
run: dotnet test Ginger/GingerUtilsTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
- name: 'Testing GingerCoreCommonTest'
if: success() || failure()
run: dotnet test Ginger/GingerCoreCommonTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
- name: 'Testing GingerCoreNETUnitTest'
if: success() || failure()
run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
- name: 'Testing GingerPluginCoreTest'
if: success() || failure()
run: dotnet test Ginger/GingerPluginCoreTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
- name: 'Testing GingerConsoleTest'
if: success() || failure()
run: dotnet test Ginger/GingerConsoleTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
- name: 'Testing GingerAutoPilotTest'
if: success() || failure()
run: dotnet test Ginger/GingerAutoPilotTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal
# ------------------------------------------------------------------------------------------------------
# Run .Net Framework tests using powershell and publish the results
# ------------------------------------------------------------------------------------------------------
- name: Run tests for Ginger .NetFramework *Test Dlls for Windows
if: (success() || failure()) && (runner.os == 'Windows') # run this step even if previous step failed and if the OS is Windows
run: powershell -file "TestDotNetFrameworkGithub.ps1"
# ------------------------------------------------------------------------------------------------------
# Run Standalone CLI Test
# ------------------------------------------------------------------------------------------------------
- name: Run Standalone CLI Test for Linux
if: (success() || failure()) && (runner.os == 'Linux') # run this step even if previous step failed
shell: bash
run: |
pwd
ls -alt
chmod +x CLITestsGithub.sh
sudo apt install dos2unix
dos2unix -b CLITestsGithub.sh
./CLITestsGithub.sh
# ------------------------------------------------------------------------------------------------------
# Publish Test Results
# ------------------------------------------------------------------------------------------------------
- name: Test Report - Windows
uses: dorny/test-reporter@v1
if: (success() || failure()) && (runner.os == 'Windows') # run this step even if previous step failed
with:
name: Generate Unit Test Report for Windows # Name of the check run which will be created
path: "D:/a/TestResults/*.trx" # Path to test results
reporter: dotnet-trx # Format of test results
- name: Test Report - Linux
uses: dorny/test-reporter@v1
if: (success() || failure()) && (runner.os == 'Linux') # run this step even if previous step failed
with:
name: Generate Unit Test Report for Linux # Name of the check run which will be created
path: "**/*.trx" # Path to test results
reporter: dotnet-trx # Format of test results
- name: Test Report - MacOS
uses: dorny/test-reporter@v1
if: (success() || failure()) && (runner.os == 'macOS') # run this step even if previous step failed
with:
name: Generate Unit Test Report for MacOS # Name of the check run which will be created
path: "**/*.trx" # Path to test results
reporter: dotnet-trx # Format of test results