-
Notifications
You must be signed in to change notification settings - Fork 0
318 lines (293 loc) · 9.74 KB
/
go.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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
permissions:
id-token: write
checks: write
contents: write
packages: write
name: Go Build
'on':
workflow_dispatch: {}
push:
paths-ignore:
- '**/*.md'
jobs:
tests:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
parallel: [1]
index: [0]
steps:
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.5'
- name: Download JUnit Summary from Previous Workflow
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: success
name: junit-test-summary
if_no_artifact_found: warn
branch: main
- name: Install Dependencies
run: go get ./...
shell: bash
- name: Install Fyne Dependencies
run: sudo apt-get -y install golang gcc libgl1-mesa-dev xorg-dev
shell: bash
- name: Split integration tests
id: test_split
uses: hashicorp-forge/go-test-split-action@v1
with:
index: ${{ matrix.index }}
total: ${{ matrix.parallel }}
junit-summary: ./junit-test-summary.xml
- name: Install Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Clone the Terraform provider source
run: git clone https://github.com/OctopusDeployLabs/terraform-provider-octopusdeploy.git
shell: bash
- name: Build the Terraform provider from source
run: go build -o terraform-provider-octopusdeploy
working-directory: terraform-provider-octopusdeploy
- name: Override the location used by Terraform provider
run: |-
cat <<EOT >> ~/.terraformrc
provider_installation {
dev_overrides {
"octopusdeploylabs/octopusdeploy" = "${{ github.workspace }}/terraform-provider-octopusdeploy"
}
direct {}
}
EOT
- name: Go test
shell: bash
env:
LICENSE: ${{ secrets.LICENSE }}
OCTOTESTSKIPINIT: false
OCTODISABLEOCTOCONTAINERLOGGING: true
OCTOTESTDUMPSTATE: true
OCTOTESTDEFAULTSPACEID: Spaces-2
GOMAXPROCS: 2
OCTOTESTRETRYCOUNT: 5
# This avoids errors like
# Error response from daemon: No such container: d7447146fc04ed2253f9f73644b59ca856c255c603099414e6f50b800719b05b: creating network reaper failed: failed to create network
TESTCONTAINERS_RYUK_DISABLED: true
run: |
sudo apt install gotestsum
gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test_split.outputs.run }}" -timeout 0 ./...
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: junit-test-summary-${{ matrix.index }}
path: node-summary.xml
retention-days: 1
tests-combine-summaries:
name: Combine Test Reports
needs: [ tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Install junit-report-merger
run: npm install -g junit-report-merger
- name: Merge reports
run: >
jrm ./junit-test-summary.xml
"junit-test-summary-0/*.xml"
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: junit-test-summary
path: ./junit-test-summary.xml
- name: Report
uses: dorny/test-reporter@v1
with:
name: Go Tests
path: junit-test-summary.xml
reporter: java-junit
fail-on-error: 'true'
release:
runs-on: ubuntu-latest
#needs: [ tests ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.1
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/execute@v2.0.1
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Tag Release
uses: mathieudutour/github-tag-action@v6.1
continue-on-error: true
with:
custom_tag: ${{ steps.determine_version.outputs.semVer }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build-linux:
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.5'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.1
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/execute@v2.0.1
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Install Fyne Dependencies
run: sudo apt-get -y install golang gcc libgl1-mesa-dev xorg-dev
shell: bash
- name: Install Dependencies
run: go get ./...
shell: bash
- name: List Dependencies
run: go list -m all > dependencies.txt
shell: bash
- name: Collect Dependencies
uses: actions/upload-artifact@v3
with:
name: Dependencies
path: dependencies.txt
- name: List Dependency Updates
run: go list -u -m -f "{{if .Update}}{{.}}{{end}}" all > dependencyUpdates.txt
shell: bash
- name: Collect Dependency Updates
uses: actions/upload-artifact@v3
with:
name: Dependencies Updates
path: dependencyUpdates.txt
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@v2
with:
version: v1
args: mod -licenses -json -output bom.json
- run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octoterrawiz_linux_amd64 octoterrawiz.go
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 1
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
continue-on-error: true
with:
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }}
files: |
octoterrawiz_linux_amd64
build-windows:
runs-on: windows-latest
needs: [ release ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.5'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.1
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/execute@v2.0.1
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Install Dependencies
run: go get ./...
shell: pwsh
- run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octoterrawiz_windows_amd64.exe octoterrawiz.go
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: 1
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
continue-on-error: true
with:
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }}
files: |
octoterrawiz_windows_amd64.exe
build-mac:
runs-on: macos-14
needs: [ release ]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.5'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v2.0.1
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/execute@v2.0.1
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Install Dependencies
run: go get ./...
shell: pwsh
- run: go build -ldflags="-X 'main.Version=${{ steps.determine_version.outputs.semVer }}'" -o octoterrawiz_macos_arm64 octoterrawiz.go
env:
GOOS: darwin
GOARCH: arm64
CGO_ENABLED: 1
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
continue-on-error: true
with:
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }}
files: |
octoterrawiz_macos_arm64