-
Notifications
You must be signed in to change notification settings - Fork 183
230 lines (193 loc) · 6.14 KB
/
win_build_and_test.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
name: win_build_and_test
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
branches:
- main
pull_request:
concurrency:
group: win_build_and_test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: 1.18.7
RESULT_PATH: testresults
PYTHON_VERSION: 3.8.10
REQUIREMENTS_PATH: "tests/requirements.txt"
jobs:
go-test:
name: go-test
runs-on: ${{ matrix.OS }}
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Caching dependency
uses: actions/cache@v3
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Install gotestsum
run: |
cd $env:TEMP
go install gotest.tools/gotestsum@latest
- name: Run go tests
run: |
& ./scripts/windows/make.ps1 unit_test
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.OS }}-go-test-results
path: unit_results.xml
build:
name: build
runs-on: "windows-2019"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Caching dependency
uses: actions/cache@v3
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Install checksum
run: choco install -y checksum
- name: Install wix
run: choco install -y wixtoolset --version 3.11.2
- name: Build
run: |
refreshenv
$env:PATH = "C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\WiX Toolset v3.11\bin;$env:PATH"
& ./scripts/windows/make.ps1 bundle -build_agent 1 -build_msi 1 -build_choco 1
& ./build/SignalFxAgent/bin/signalfx-agent.exe --version
- name: Archive exe
uses: actions/upload-artifact@v3
with:
name: exe
path: build/SignalFxAgent/bin/signalfx-agent.exe
- name: Archive msi
uses: actions/upload-artifact@v3
with:
name: msi
path: build/SignalFxAgent-*.msi
- name: Archive zip
uses: actions/upload-artifact@v3
with:
name: zip
path: build/SignalFxAgent-*.zip
- name: Archive nupkg
uses: actions/upload-artifact@v3
with:
name: nupkg
path: build/signalfx-agent.*.nupkg
docker-build:
name: docker-build
runs-on: windows-2019
needs:
- build
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download exe
uses: actions/download-artifact@v3
with:
name: exe
path: dist
- name: Build docker image
run: docker build -t signalfx-agent:latest-windows -f Dockerfile.windows .
integration-tests:
name: integration-tests
runs-on: ${{ matrix.OS }}
needs:
- build
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
env:
SANIC_NO_UVLOOP: "true"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download zip
uses: actions/download-artifact@v3
with:
name: zip
path: build
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }}
- name: Install pytest
run: pip install -r "${{ env.REQUIREMENTS_PATH }}"
- name: Install IIS-WebServerRole
run: choco install -y --source windowsfeatures IIS-WebServerRole
- name: Extract bundle
run: |
cd build
7z x SignalFxAgent*.zip
- name: Run integration tests
run: |
$env:AGENT_BIN = $(Resolve-Path build\SignalFxAgent\bin\signalfx-agent.exe)
pytest -m "(windows or windows_only) and not deployment and not installer" --verbose --junitxml=${{ env.RESULT_PATH }}/test_results.xml --html=${{ env.RESULT_PATH }}/test_results.html --self-contained-html tests
- name: Uploading pytest result artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-integration-pytest-result
path: ${{ env.RESULT_PATH }}
installer-tests:
runs-on: ${{ matrix.OS }}
needs:
- build
strategy:
matrix:
OS: ["windows-2019", "windows-2022"]
env:
SANIC_NO_UVLOOP: "true"
steps:
- name: Check out the codebase.
uses: actions/checkout@v3
- name: Download msi
uses: actions/download-artifact@v3
with:
name: msi
path: build
- name: Download nupkg
uses: actions/download-artifact@v3
with:
name: nupkg
path: build
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }}
- name: Install pytest
run: pip install -r "${{ env.REQUIREMENTS_PATH }}"
- name: Run installer tests
run: |
$msi_path = $(Resolve-Path build\SignalFxAgent-*.msi)
$nupkg_path = $(Resolve-Path build\signalfx-agent*.nupkg)
pytest -m "installer and windows_only" --test-msi-path="$msi_path" --test-nupkg-path="$nupkg_path" --verbose --junitxml=${{ env.RESULT_PATH }}/test_results.xml --html=${{ env.RESULT_PATH }}/test_results.html --self-contained-html tests
- name: Uploading pytest result artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-installer-pytest-result
path: ${{ env.RESULT_PATH }}