-
Notifications
You must be signed in to change notification settings - Fork 8
284 lines (268 loc) · 11.7 KB
/
build.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Build
on:
push:
pull_request:
branches:
- main
release:
types:
- prereleased
- released
jobs:
precheck:
runs-on: [ubuntu-20.04]
outputs:
version: ${{ steps.get_version.outputs.version }}
version_number: ${{ steps.get_version.outputs.version_number }}
full_version: ${{ steps.get_version.outputs.full_version }}
branchTag: ${{ steps.get_version.outputs.branchTag }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Validate Release
if: github.event_name == 'release' || github.event_name == 'prerelease'
run: |
TAG_NAME=${GITHUB_REF/refs\/tags\//}
VERSION_FILE=$(cat VERSION)
if [ "$TAG_NAME" != "$VERSION_FILE" ]; then
echo "tag $TAG_NAME not equals to VERSION file $VERSION_FILE"
exit 1
fi
- name: Get Versions
id: get_version
run: |
VERSION_FILE=$(cat VERSION)
echo ::set-output name=branchTag::$(echo $GITHUB_REF | cut -d / -f 3)
if [[ "$VERSION_FILE" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(\.([0-9]+))?$ ]] ; then
VERSION=${VERSION_FILE}.${{ github.run_number }}
VERSION_NUMBER=$(echo "${VERSION_FILE}" | cut -d "v" -f 2).${{ github.run_number }}
SHORT_COMMIT=$(git rev-parse --short=4 HEAD)
FULL_VERSION="${VERSION}_${SHORT_COMMIT}"
echo ::set-output name=full_version::${FULL_VERSION}
echo ::set-output name=version::${VERSION}
echo ::set-output name=version_number::${VERSION_NUMBER}
else
echo "VERSION file doesn't have valid version format: ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(\.([0-9]+))?$"
exit 1
fi
e2e_test:
runs-on: [windows-2019]
needs: [precheck,build_toscactl,build_tosca_server]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cache Tosca Setup
uses: actions/cache@v2
with:
path: tosca-installer
key: tosca-setup-${{ needs.build_tosca_server.outputs.cacheKey }}
- uses: actions/download-artifact@v2
name: Download toscactl
with:
name: toscactl-windows-amd64_${{ needs.precheck.outputs.full_version }}
path: cli
- uses: actions/download-artifact@v2
name: Download toscaci-service
with:
name: toscaci-service-windows-amd64_${{ needs.precheck.outputs.full_version }}
path: toscaci-service
- uses: actions/download-artifact@v2
name: Download toscacommander-addon
with:
name: toscacommander-addon-windows-amd64_${{ needs.precheck.outputs.full_version }}
path: toscacommander-addon
- name: E2E Testing
env:
TRICENTIS_LICENSING_HOME: C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\Licensing
TBOX_HOME: C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\TBox
TRICENTIS_HOME: C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\Classic
TRICENTIS_ALLUSERS_APPDATA: C:\ProgramData\TRICENTIS\Tosca Testsuite\7.0.0
COMMANDER_HOME: C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\ToscaCommander
run: |
netsh advfirewall set allprofiles state off
if(![System.IO.Directory]::Exists("tosca-installer")){
Invoke-WebRequest "${{ secrets.TRICENTIS_15_0_LTS_URL }}" -UseBasicParsing -OutFile tosca-installer.zip
expand-archive .\tosca-installer.zip
Remove-Item tosca-installer.zip
}
echo "Installing Tosca..."
Start-Process '.\tosca-installer\Tricentis Tosca 15.0.0 LTS.exe' -Wait -NoNewWindow -ArgumentList '/s START_SERVICES=1 ADDLOCAL=TricentisTBox MOBILE_TESTING=1 /qn'
echo "Install License"
Start-Process "$Env:TRICENTIS_LICENSING_HOME\ToscaLicenseConfiguration.exe" -Wait -NoNewWindow -ArgumentList 'connect-cloud -i ${{secrets.TRICENTIS_LICENSE_SERVER_ID}} -u ${{secrets.TRICENTIS_LICENSE_USER}} -p ${{secrets.TRICENTIS_LICENSE_PASSWORD}} -v'
echo "Install Tosca Commander Addon"
cp ".\toscacommander-addon\*" "$Env:COMMANDER_HOME\"
Start-Process '.\toscaci-service\CIService.exe'
sleep 2
echo "Install Chrome Tosca Extension"
$KeyPath = "HKLM:\Software\Policies\Google\Chrome\ExtensionInstallForcelist"
$KeyName = "1"
$KeyType = "String"
$KeyValue = "njjjlolnnicemgigahffncnddbioccpo;https://clients2.google.com/service/update2/crx"
#Verify if the registry path already exists
if(!(Test-Path $KeyPath)) {
try {
#Create registry path
New-Item -Path $KeyPath -ItemType RegistryKey -Force -ErrorAction Stop
}
catch {
Write-Output "FAILED to create the registry path"
}
}
#Verify if the registry key already exists
if(!((Get-ItemProperty $KeyPath).$KeyName)) {
try {
#Create registry key
New-ItemProperty -Path $KeyPath -Name $KeyName -PropertyType $KeyType -Value $KeyValue
}
catch {
Write-Output "FAILED to create the registry key"
}
}
Start-Process "$env:PROGRAMFILES/Google/Chrome/Application/chrome.exe"
sleep 10
taskkill /f /im chrome.exe
echo "Execute E2E"
cd e2e
echo "Run toscactl"
..\cli\toscactl-windows-amd64.exe run acceptance installation integration
- name: 'Archive E2E results'
uses: actions/upload-artifact@v2
with:
name: e2e-results_${{ needs.precheck.outputs.full_version }}
path: e2e/build/test/
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
with:
report_paths: 'e2e/build/test/**/junit/*.xml'
check_name: End to end tests
fail_on_failure: true
token: ${{ secrets.GITHUB_TOKEN }}
require_tests: true
test_toscactl:
runs-on: [ubuntu-20.04]
needs: [precheck]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup GO
uses: actions/setup-go@v2
with:
go-version: '1.16' # The Go version to download (if necessary) and use.
- name: Test
working-directory: client
run: make test
build_toscactl:
runs-on: [ubuntu-20.04]
needs: [precheck, test_toscactl]
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup GO
uses: actions/setup-go@v2
with:
go-version: '1.16' # The Go version to download (if necessary) and use.
- name: Build
working-directory: client
run: make build_${{ matrix.goos }} VERSION=${{ needs.precheck.outputs.version }} COMMIT=$(git rev-parse HEAD)
- name: 'Archive debug toscactl'
uses: actions/upload-artifact@v2
with:
name: toscactl-${{ matrix.goos }}-${{ matrix.goarch }}_${{ needs.precheck.outputs.full_version }}
path: client/build/toscactl-${{ matrix.goos }}-amd64*
- name: Release Asset Upload toscactl
uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' || github.event_name == 'prerelease'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: client/build/*
tag: ${{ needs.precheck.outputs.branchTag }}
overwrite: true
file_glob: true
build_tosca_server:
runs-on: [windows-2019]
needs: [precheck]
outputs:
cacheKey: ${{steps.cache-key.outputs.result}}
strategy:
matrix:
goos: [windows]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/github-script@v4
id: cache-key
env:
KEY: ${{ secrets.TRICENTIS_15_0_LTS_URL }}
with:
script: |
const { KEY } = process.env
return require('crypto').createHash('md5').update(KEY).digest("hex");
- name: Cache Tosca Setup
uses: actions/cache@v2
with:
path: tosca-installer
key: tosca-setup-${{steps.cache-key.outputs.result}}
- name: Setup Tosca
run: |
if(![System.IO.Directory]::Exists("tosca-installer")){
Invoke-WebRequest "${{ secrets.TRICENTIS_15_0_LTS_URL }}" -UseBasicParsing -OutFile tosca-installer.zip
expand-archive .\tosca-installer.zip
Remove-Item tosca-installer.zip
}
Start-Process '.\tosca-installer\Tricentis Tosca 15.0.0 LTS.exe' -Wait -NoNewWindow -ArgumentList '/s START_SERVICES=1 ADDLOCAL=TricentisTBox MOBILE_TESTING=1 /qn'
- name: Build
working-directory: server
shell: cmd
run: |
nuget restore
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" ToscaCI.sln /P:Configuration=Release /p:Platform=x64 /property:version=${{ needs.precheck.outputs.version_number }} /property:InformationalVersion=${{ needs.precheck.outputs.full_version }} /t:Build
- name: Package Tosca Commander Addon
working-directory: server
run: |
mkdir build
Compress-Archive -Path CIAddin\bin\Release\* -DestinationPath build\toscacommander-addon-${{ matrix.goos }}-${{ matrix.goarch }}.zip
- name: Package Tosca CIService
working-directory: server
run: |
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z" -UseBasicParsing -OutFile ffmpeg.7z
7z x ffmpeg.7z
cp ffmpeg*\bin\ffmpeg.exe CIService\bin\Release\ffmpeg.exe
Compress-Archive -Path CIService\bin\Release\* -DestinationPath build\toscaci-service-${{ matrix.goos }}-${{ matrix.goarch }}.zip
- name: 'Archive Debug Tosca Commander Addon'
uses: actions/upload-artifact@v2
with:
name: toscacommander-addon-${{ matrix.goos }}-${{ matrix.goarch }}_${{ needs.precheck.outputs.full_version }}
path: server/CIAddin/bin/Release/
- name: 'Archive Debug ToscaCI service'
uses: actions/upload-artifact@v2
with:
name: toscaci-service-${{ matrix.goos }}-${{ matrix.goarch }}_${{ needs.precheck.outputs.full_version }}
path: server/CIService/bin/Release/
- name: Release Asset Upload Tosca Commander Addon
uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' || github.event_name == 'prerelease'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: server/build/toscacommander-addon-${{ matrix.goos }}-${{ matrix.goarch }}.zip
tag: ${{ needs.precheck.outputs.branchTag }}
overwrite: true
file_glob: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Asset Upload ToscaCI Service
uses: svenstaro/upload-release-action@v1-release
if: github.event_name == 'release' || github.event_name == 'prerelease'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: server/build/toscaci-service-${{ matrix.goos }}-${{ matrix.goarch }}.zip
tag: ${{ needs.precheck.outputs.branchTag }}
overwrite: true
file_glob: true