-
Notifications
You must be signed in to change notification settings - Fork 9
129 lines (124 loc) · 4.35 KB
/
tests.yml
File metadata and controls
129 lines (124 loc) · 4.35 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
name: Tests
on:
push:
branches:
- main
- dev
paths:
- src/**
- reports/**
pull_request:
types:
- ready_for_review
paths:
- src/**
- reports/**
workflow_dispatch:
inputs:
force_run:
default: false
required: false
type: boolean
description: Bypass code changed check
env:
Solution_Directory: src\AnalyticsEngine\Tests.UnitTests
Build_Platform: anycpu
Build_ProcessorArchitecture: x86
ClientID: ${{ secrets.APP_CLIENTID }}
ClientSecret: ${{ secrets.APP_CLIENTSECRET }}
TenantGUID: ${{ secrets.APP_TENANTGUID }}
TenantDomain: ${{ secrets.APP_TENANTDOMAIN }}
CognitiveEndpoint: ${{ secrets.APP_COGNITIVEENDPOINT }}
CognitiveKey: ${{ secrets.APP_COGNITIVEKEY}}
CosmosDbTestContainerCurrent: stats
CosmosDbTestContainerHistory: history
CosmosDbTestDatabaseName: UnitTestDevOps
CosmosDb: ${{ secrets.APP_COSMOSDB }}
redis: ${{ secrets.CONNECTIONSTRINGS_REDIS }}
ServiceBus: ${{ secrets.CONNECTIONSTRINGS_SERVICEBUS }}
Storage: ${{ secrets.CONNECTIONSTRINGS_STORAGE }}
jobs:
setup_tests:
# Will check that the interesting folders have been updated.
runs-on: ubuntu-latest
outputs:
code_changed: ${{ steps.changes.outputs.code == 'true' }}
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Check if the code has been modified so tests must be run
id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # 3.0.2
with:
filters: |
code:
- 'src/**'
test_aitracker:
runs-on: ubuntu-latest
needs: setup_tests
if: inputs.force_run || needs.setup_tests.outputs.code_changed == 'true'
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Run AI Tracker tests
run: |
cd src/SPO/AITracker/TypeScript
npm ci
npm run test
test_dotnet:
# Tests job
# Preparation:
# - Transform configuration files
# - Restore dependencies
# Build:
# - Build .Net projects
# Test:
# - Run test suite
runs-on: windows-latest
needs: setup_tests
if: inputs.force_run || needs.setup_tests.outputs.code_changed == 'true'
strategy:
matrix:
configuration: [Release] # [Debug, Release]
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # 2.0.0
- name: Cache NuGet Packages
id: nuget-packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
if: false
env:
cache-name: nuget-package-cache
with:
path: ~\.nuget\packages
key: ${{ runner.os }}-${{ env.cache-name }}
- name: Config substitution - Unit tests
uses: microsoft/variable-substitution@6287962da9e5b6e68778dc51e840caa03ca84495 # 1.0.0
with:
files: '${{ env.Solution_Directory }}\App.Release.config'
- name: Restore the application
run: msbuild ${{ env.Solution_Directory }} -t:Restore `
-p:Configuration=${{ env.Configuration }} `
-p:Platform=${{ env.Build_Platform }} `
-p:ProcessorArchitecture=${{ env.Build_ProcessorArchitecture }}
env:
Configuration: ${{ matrix.configuration }}
- name: Build solution
run: msbuild ${{ env.Solution_Directory }} `
-p:Configuration=${{ env.Configuration }} `
-p:Platform=${{ env.Build_Platform }} `
-p:ProcessorArchitecture=${{ env.Build_ProcessorArchitecture }}
env:
Configuration: ${{ matrix.configuration }}
- name: Execute unit tests
uses: jesusfer/vstest-action@f5ec12ddb71f6e151b738fa4740f8fea61e9214b
with:
testAssembly: Tests.UnitTests.dll
searchFolder: ${{ env.Solution_Directory }}\bin\${{ env.Configuration }}\
runInParallel: true
vstestLocationMethod: location
vstestLocation: C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe
env:
Configuration: ${{ matrix.configuration }}