-
Notifications
You must be signed in to change notification settings - Fork 41
/
CSharpStepTemplate.yml
165 lines (147 loc) · 6.01 KB
/
CSharpStepTemplate.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
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
# STEPS LEVEL TEMPLATE:
# Used to build CSharp
# Reusable
# Used to "hide" the additional variables specific to this SDK which shouldn't be set from a higher level, or
# shared from a multi-build pipeline like a publish
parameters:
- name: ApiSpecSource
displayName: ApiSpecSource
type: string
default: -apiSpecGitUrl https://raw.githubusercontent.com/PlayFab/API_Specs/master/
- name: CommitMessage
displayName: CommitMessage
type: string
default: Automated build from ADO Pipeline
- name: GitDestBranch
displayName: GitDestBranch
type: string
default: doNotCommit
- name: SdkName
displayName: SdkName
type: string
default: CSharpSDK
- name: GitJSetupBranch
displayName: GitJSetupBranch
type: string
default: master
- name: GitSdkGenBranch
displayName: GitSdkGenBranch
type: string
default: master
- name: isVersioned
displayName: isVersioned
type: boolean
default: false
- name: TestCompile
displayName: TestCompile
type: boolean
default: true
- name: TestWin32NetCore
displayName: TestWin32NetCore
type: boolean
default: true
- name: TestWin32Basic
displayName: TestWin32Basic
type: boolean
default: true
- name: SelfTemplateResource
displayName: SelfTemplateResource
type: string
default: self
steps:
- checkout: JenkinsSdkSetupScripts
clean: true
path: s
- checkout: API_Specs
clean: true
path: s/API_Specs
- checkout: SdkGenerator
clean: true
path: s/SdkGenerator
- checkout: ${{ parameters.SelfTemplateResource }}
clean: true
submodules: true
path: s/sdks/CSharpSDK
persistCredentials: true
- bash: |
set -e
echo alias the ADO variables into local variables
ApiSpecSource="${{ parameters.ApiSpecSource }}"
CommitMessage="${{ parameters.CommitMessage }}"
GitDestBranch="${{ parameters.GitDestBranch }}"
SdkName="${{ parameters.SdkName }}"
TestCompile="${{ parameters.TestCompile }}"
TestWin32Basic="${{ parameters.TestWin32Basic }}"
TestWin32NetCore="${{ parameters.TestWin32NetCore }}"
WORKSPACE=$(pwd -W)
# Hack attempt to get WORKSPACE into a sub-environment
export WORKSPACE="$WORKSPACE"
echo === load util.sh to find msbuild ===
if [ -f "util.sh" ]; then
. "./util.sh" 2> /dev/null
elif [ ! -z "$WORKSPACE" ]; then
. "$WORKSPACE/JenkinsSdkSetupScripts/JenkinsScripts/Pipeline/util.sh" 2> /dev/null
fi
Find2019MsBuild || Find2017MsBuild
cd "$WORKSPACE/sdks/$SdkName"
. "$WORKSPACE/JenkinsSdkSetupScripts/JenkinsScripts/Pipeline/testInit.sh"
cd "$WORKSPACE/SDKGenerator/SDKBuildScripts"
targetSrc="csharp"
export PF_TEST_TITLE_DATA_JSON="$WORKSPACE\JenkinsSdkSetupScripts\Creds\testTitleData.json"
. ./shared_build.sh
if [ $TestCompile = true ] ;
then
echo === Build the CSharp Project ===
"$MSBUILD_EXE" "$WORKSPACE//sdks//$SdkName//PlayFabSDK//PlayFabSDK.sln" //restore //p:configuration="Debug" //t:Rebuild
fi
cd "$WORKSPACE/sdks/$SdkName/PlayFabSDK"
if [ $TestWin32NetCore = true ] ;
then
echo === Build the CSharp UnitTestRunner ===
"$MSBUILD_EXE" "$WORKSPACE//sdks//$SdkName//PlayFabSDK//UnittestRunner//UnittestRunner.csproj" //restore //p:configuration="Release" //t:Rebuild
echo === Run the CSharpSdk UnitTestRunner net core app 2.0 ===
cd "$WORKSPACE/sdks/$SdkName/PlayFabSDK/UnittestRunner/bin/Release/netcoreapp2.0"
cmd <<< dotnet .\\UnittestRunner.dll -testInputsFile "$WORKSPACE\\JenkinsSdkSetupScripts\\Creds\\testTitleData.json"
fi
if [ $TestWin32Basic = true ] ;
then
echo === Build PlayFabSDK+Unit.sln ===
"$MSBUILD_EXE" "$WORKSPACE//sdks//$SdkName//PlayFabSDK//PlayFabSDK+Unit.sln" //restore //p:configuration="Release" //t:Rebuild
echo === Run PlayFabSDK+Unit.sln ===
cd "$WORKSPACE//sdks//$SdkName//PlayFabSDK//UnittestRunner//bin//Release//net45"
cmd <<< UnittestRunner.exe -testInputsFile "$WORKSPACE//JenkinsSdkSetupScripts//Creds//testTitleData.json"
fi
if [ $TestWin32Basic = true ] || [ $TestWin32NetCore = true ] || [ $TestCompile = true ] ;
then
"$MSBUILD_EXE" "$WORKSPACE//SDKGenerator//JenkinsConsoleUtility//JenkinsConsoleUtility.sln" //restore //p:configuration="Debug" //p:platform="Any CPU" //t:Rebuild
cd "$WORKSPACE//SDKGenerator//JenkinsConsoleUtility"
ListenCsJCU
fi
if [ $isVersioned = true ] ;
then
cd "$WORKSPACE\SDKGenerator\JenkinsConsoleUtility\bin\Debug"
cmd <<< "JenkinsConsoleUtility.exe --version -SdkName $SdkName -workspacepath "$WORKSPACE" -destFile version_$EXECUTOR_NUMBER.txt $apiSpecSource"
echo TODO inject environment variable - $WORKSPACE/version_$EXECUTOR_NUMBER.txt ?
touch $WORKSPACE/version_$EXECUTOR_NUMBER
echo === publish .NetCore nuget package ===
echo This step is disabled for now, because we are still publishing the 4.5 package.
echo We should decide at some point what and how to deal with the additional .netcore package
echo cd "$WORKSPACE\sdks\$SdkName\PlayFabSDK\source"
echo dotnet pack --configuration Release --output bin\out .\PlayFabSDK.csproj
echo nuget push .\bin\out\PlayFabAllSDK.$sdkVersion.nupkg -Source nuget.org -A $NUGET_API_KEY
echo === publish .Net45 nuget package ===
cd "$WORKSPACE\sdks\$SdkName\PlayFabSDK\source"
dotnet pack --configuration Release --output bin\out .\PlayFabSDK.csproj
nuget push bin\out\PlayFabAllSDK.$sdkVersion.nupkg -Source nuget.org -A $NUGET_API_KEY
echo === publish CloudScript plugin ===
echo this step is disabled until we can discover why this is trying to access XPlat
echo cd "$WORKSPACE\sdks\$SdkName\Plugins\CloudScript\source"
echo dotnet pack --configuration Release --output bin\out .\PlayFabCloudScriptPlugin.csproj
echo nuget push bin\out\PlayFabCloudScriptPlugin.$sdkVersion-alpha.nupkg -Source nuget.org -A $NUGET_API_KEY
fi
displayName: 'Build/Test/Report'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '*.xml'
testRunTitle: CSharpTemplate