Skip to content

Commit 5190f95

Browse files
owenrumneyknqyf263
andauthored
feat: Adding support for Windows testing (#3037)
Signed-off-by: Owen Rumney <owen.rumney@aquasec.com> Signed-off-by: knqyf263 <knqyf263@gmail.com> Co-authored-by: knqyf263 <knqyf263@gmail.com>
1 parent b00f3c6 commit 5190f95

File tree

75 files changed

+1404
-1414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1404
-1414
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/semantic-pr.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
suse
5959
photon
6060
distroless
61+
windows
6162
6263
ruby
6364
php

.github/workflows/test.yaml

+15-11
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ on:
99
- 'mkdocs.yml'
1010
- 'LICENSE'
1111
pull_request:
12-
env:
13-
TINYGO_VERSION: "0.25.0"
1412
jobs:
1513
test:
1614
name: Test
17-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.operating-system }}
16+
strategy:
17+
matrix:
18+
operating-system: [ubuntu-latest, windows-latest, macos-latest]
1819
steps:
1920
- uses: actions/checkout@v3
2021

@@ -30,18 +31,20 @@ jobs:
3031
echo "Run 'go mod tidy' and push it"
3132
exit 1
3233
fi
34+
if: matrix.operating-system == 'ubuntu-latest'
3335

3436
- name: Lint
3537
uses: golangci/golangci-lint-action@v3.3.0
3638
with:
3739
version: v1.49
3840
args: --deadline=30m
3941
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
42+
if: matrix.operating-system == 'ubuntu-latest'
4043

41-
- name: Install TinyGo
42-
run: |
43-
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
44-
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
44+
# Install tools
45+
- uses: aquaproj/aqua-installer@v1.2.0
46+
with:
47+
aqua_version: v1.25.0
4548

4649
- name: Run unit tests
4750
run: make test
@@ -73,12 +76,13 @@ jobs:
7376
with:
7477
go-version-file: go.mod
7578

76-
- name: Install TinyGo
77-
run: |
78-
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
79-
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
79+
# Install tools
80+
- uses: aquaproj/aqua-installer@v1.1.2
81+
with:
82+
aqua_version: v1.25.0
8083

8184
- name: Run module integration tests
85+
shell: bash
8286
run: |
8387
make test-module-integration
8488

aqua.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# aqua - Declarative CLI Version Manager
3+
# https://aquaproj.github.io/
4+
registries:
5+
- type: standard
6+
ref: v3.106.0 # renovate: depName=aquaproj/aqua-registry
7+
packages:
8+
- name: tinygo-org/tinygo@v0.26.0

go.mod

+56-59
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
github.com/golang-jwt/jwt v3.2.2+incompatible
4040
github.com/golang/protobuf v1.5.2
4141
github.com/google/go-containerregistry v0.12.0
42-
github.com/google/licenseclassifier/v2 v2.0.0-pre6
42+
github.com/google/licenseclassifier/v2 v2.0.0
4343
github.com/google/uuid v1.3.0
4444
github.com/google/wire v0.5.0
4545
github.com/hashicorp/go-getter v1.6.2
@@ -82,7 +82,40 @@ require (
8282
)
8383

8484
require (
85+
cloud.google.com/go v0.104.0 // indirect
86+
cloud.google.com/go/compute v1.12.1 // indirect
8587
cloud.google.com/go/compute/metadata v0.2.1 // indirect
88+
cloud.google.com/go/iam v0.5.0 // indirect
89+
cloud.google.com/go/storage v1.23.0 // indirect
90+
github.com/Azure/azure-sdk-for-go v67.1.0+incompatible
91+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
92+
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
93+
github.com/Azure/go-autorest/autorest v0.11.28
94+
github.com/Azure/go-autorest/autorest/adal v0.9.21
95+
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
96+
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
97+
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
98+
github.com/Azure/go-autorest/logger v0.2.1 // indirect
99+
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
100+
github.com/BurntSushi/toml v1.2.1 // indirect
101+
github.com/GoogleCloudPlatform/docker-credential-gcr v2.0.5+incompatible
102+
github.com/MakeNowJust/heredoc v1.0.0 // indirect
103+
github.com/Masterminds/goutils v1.1.1 // indirect
104+
github.com/Masterminds/semver v1.5.0 // indirect
105+
github.com/Masterminds/semver/v3 v3.2.0 // indirect
106+
github.com/Masterminds/squirrel v1.5.3 // indirect
107+
github.com/Microsoft/go-winio v0.6.0 // indirect
108+
github.com/Microsoft/hcsshim v0.9.4 // indirect
109+
github.com/OneOfOne/xxhash v1.2.8 // indirect
110+
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
111+
github.com/VividCortex/ewma v1.1.1 // indirect
112+
github.com/acomagu/bufpipe v1.0.3 // indirect
113+
github.com/agext/levenshtein v1.2.3 // indirect
114+
github.com/agnivade/levenshtein v1.1.1 // indirect
115+
github.com/alecthomas/chroma v0.10.0 // indirect
116+
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
117+
github.com/apparentlymart/go-cidr v1.1.0 // indirect
118+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
86119
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
87120
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8 // indirect
88121
github.com/aws/aws-sdk-go-v2/credentials v1.13.3 // indirect
@@ -133,64 +166,6 @@ require (
133166
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect
134167
github.com/aws/aws-sdk-go-v2/service/workspaces v1.23.0 // indirect
135168
github.com/aws/smithy-go v1.13.4 // indirect
136-
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
137-
github.com/go-openapi/analysis v0.21.4 // indirect
138-
github.com/go-openapi/errors v0.20.3 // indirect
139-
github.com/go-openapi/loads v0.21.2 // indirect
140-
github.com/go-openapi/spec v0.20.7 // indirect
141-
github.com/go-openapi/validate v0.22.0 // indirect
142-
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
143-
github.com/googleapis/go-type-adapters v1.0.0 // indirect
144-
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
145-
github.com/hashicorp/hcl v1.0.0 // indirect
146-
github.com/liamg/iamgo v0.0.9 // indirect
147-
github.com/liamg/jfather v0.0.7 // indirect
148-
github.com/liamg/memoryfs v1.4.3 // indirect
149-
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
150-
github.com/microsoft/go-rustaudit v0.0.0-20220808201409-204dfee52032 // indirect
151-
github.com/oklog/ulid v1.3.1 // indirect
152-
github.com/opentracing/opentracing-go v1.2.0 // indirect
153-
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
154-
github.com/shibumi/go-pathspec v1.3.0 // indirect
155-
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
156-
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
157-
go.mongodb.org/mongo-driver v1.10.0 // indirect
158-
)
159-
160-
require (
161-
cloud.google.com/go v0.104.0 // indirect
162-
cloud.google.com/go/compute v1.12.1 // indirect
163-
cloud.google.com/go/iam v0.5.0 // indirect
164-
cloud.google.com/go/storage v1.23.0 // indirect
165-
github.com/Azure/azure-sdk-for-go v67.1.0+incompatible
166-
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
167-
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
168-
github.com/Azure/go-autorest/autorest v0.11.28
169-
github.com/Azure/go-autorest/autorest/adal v0.9.21
170-
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
171-
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
172-
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
173-
github.com/Azure/go-autorest/logger v0.2.1 // indirect
174-
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
175-
github.com/BurntSushi/toml v1.2.1 // indirect
176-
github.com/GoogleCloudPlatform/docker-credential-gcr v2.0.5+incompatible
177-
github.com/MakeNowJust/heredoc v1.0.0 // indirect
178-
github.com/Masterminds/goutils v1.1.1 // indirect
179-
github.com/Masterminds/semver v1.5.0 // indirect
180-
github.com/Masterminds/semver/v3 v3.2.0 // indirect
181-
github.com/Masterminds/squirrel v1.5.3 // indirect
182-
github.com/Microsoft/go-winio v0.6.0 // indirect
183-
github.com/Microsoft/hcsshim v0.9.4 // indirect
184-
github.com/OneOfOne/xxhash v1.2.8 // indirect
185-
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
186-
github.com/VividCortex/ewma v1.1.1 // indirect
187-
github.com/acomagu/bufpipe v1.0.3 // indirect
188-
github.com/agext/levenshtein v1.2.3 // indirect
189-
github.com/agnivade/levenshtein v1.1.1 // indirect
190-
github.com/alecthomas/chroma v0.10.0 // indirect
191-
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
192-
github.com/apparentlymart/go-cidr v1.1.0 // indirect
193-
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
194169
github.com/beorn7/perks v1.0.1 // indirect
195170
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
196171
github.com/bmatcuk/doublestar v1.3.4 // indirect
@@ -215,6 +190,7 @@ require (
215190
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
216191
github.com/docker/go-metrics v0.0.1 // indirect
217192
github.com/docker/go-units v0.5.0 // indirect
193+
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
218194
github.com/emirpasic/gods v1.12.0 // indirect
219195
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
220196
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
@@ -226,9 +202,14 @@ require (
226202
github.com/go-git/go-git/v5 v5.4.2
227203
github.com/go-gorp/gorp/v3 v3.0.2 // indirect
228204
github.com/go-logr/logr v1.2.3 // indirect
205+
github.com/go-openapi/analysis v0.21.4 // indirect
206+
github.com/go-openapi/errors v0.20.3 // indirect
229207
github.com/go-openapi/jsonpointer v0.19.5 // indirect
230208
github.com/go-openapi/jsonreference v0.20.0 // indirect
209+
github.com/go-openapi/loads v0.21.2 // indirect
210+
github.com/go-openapi/spec v0.20.7 // indirect
231211
github.com/go-openapi/swag v0.22.3 // indirect
212+
github.com/go-openapi/validate v0.22.0 // indirect
232213
github.com/gobwas/glob v0.2.3 // indirect
233214
github.com/goccy/go-yaml v1.8.2 // indirect
234215
github.com/gofrs/uuid v4.0.0+incompatible // indirect
@@ -241,16 +222,20 @@ require (
241222
github.com/google/go-cmp v0.5.9 // indirect
242223
github.com/google/gofuzz v1.2.0 // indirect
243224
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
225+
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
244226
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
227+
github.com/googleapis/go-type-adapters v1.0.0 // indirect
245228
github.com/gorilla/mux v1.8.0 // indirect
246229
github.com/gosuri/uitable v0.0.4 // indirect
247230
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
248231
github.com/hashicorp/errwrap v1.1.0 // indirect
249232
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
250233
github.com/hashicorp/go-multierror v1.1.1
234+
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
251235
github.com/hashicorp/go-safetemp v1.0.0 // indirect
252236
github.com/hashicorp/go-uuid v1.0.3 // indirect
253237
github.com/hashicorp/go-version v1.6.0 // indirect
238+
github.com/hashicorp/hcl v1.0.0 // indirect
254239
github.com/hashicorp/hcl/v2 v2.14.1 // indirect
255240
github.com/huandu/xstrings v1.3.3 // indirect
256241
github.com/imdario/mergo v0.3.13 // indirect
@@ -267,13 +252,18 @@ require (
267252
github.com/knqyf263/nested v0.0.1
268253
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
269254
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
255+
github.com/liamg/iamgo v0.0.9 // indirect
256+
github.com/liamg/jfather v0.0.7 // indirect
257+
github.com/liamg/memoryfs v1.4.3 // indirect
270258
github.com/lib/pq v1.10.6 // indirect
271259
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
260+
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 // indirect
272261
github.com/magiconair/properties v1.8.6 // indirect
273262
github.com/mattn/go-colorable v0.1.12 // indirect
274263
github.com/mattn/go-isatty v0.0.14 // indirect
275264
github.com/mattn/go-runewidth v0.0.13 // indirect
276265
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
266+
github.com/microsoft/go-rustaudit v0.0.0-20220808201409-204dfee52032 // indirect
277267
github.com/mitchellh/copystructure v1.2.0 // indirect
278268
github.com/mitchellh/go-homedir v1.1.0 // indirect
279269
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
@@ -292,14 +282,17 @@ require (
292282
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
293283
github.com/morikuni/aec v1.0.0 // indirect
294284
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
285+
github.com/oklog/ulid v1.3.1 // indirect
295286
github.com/olekukonko/tablewriter v0.0.5 // indirect
296287
github.com/opencontainers/go-digest v1.0.0
297288
github.com/opencontainers/image-spec v1.1.0-rc2
298289
github.com/opencontainers/runc v1.1.3 // indirect
299290
github.com/opencontainers/runtime-spec v1.0.3-0.20220311020903-6969a0a09ab1 // indirect
300291
github.com/opencontainers/selinux v1.10.1 // indirect
292+
github.com/opentracing/opentracing-go v1.2.0 // indirect
301293
github.com/owenrumney/squealer v1.0.1-0.20220510063705-c0be93f0edea // indirect
302294
github.com/pelletier/go-toml v1.9.5 // indirect
295+
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
303296
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
304297
github.com/pkg/errors v0.9.1 // indirect
305298
github.com/pmezard/go-difflib v1.0.0 // indirect
@@ -314,6 +307,7 @@ require (
314307
github.com/russross/blackfriday v1.6.0 // indirect
315308
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e
316309
github.com/sergi/go-diff v1.1.0 // indirect
310+
github.com/shibumi/go-pathspec v1.3.0 // indirect
317311
github.com/shopspring/decimal v1.2.0 // indirect
318312
github.com/sirupsen/logrus v1.9.0 // indirect
319313
github.com/spdx/tools-golang v0.3.0
@@ -322,6 +316,7 @@ require (
322316
github.com/spf13/jwalterweatherman v1.1.0 // indirect
323317
github.com/stretchr/objx v0.5.0 // indirect
324318
github.com/subosito/gotenv v1.4.1 // indirect
319+
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
325320
github.com/ulikunitz/xz v0.5.10 // indirect
326321
github.com/vbatts/tar-split v0.11.2 // indirect
327322
github.com/xanzy/ssh-agent v0.3.0 // indirect
@@ -332,6 +327,8 @@ require (
332327
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 // indirect
333328
github.com/zclconf/go-cty v1.10.0 // indirect
334329
github.com/zclconf/go-cty-yaml v1.0.2 // indirect
330+
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
331+
go.mongodb.org/mongo-driver v1.10.0 // indirect
335332
go.opencensus.io v0.23.0 // indirect
336333
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
337334
go.uber.org/atomic v1.10.0 // indirect

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
869869
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
870870
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
871871
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
872-
github.com/google/licenseclassifier/v2 v2.0.0-pre6 h1:ytJvfOEiKcN1m5vkAJXkK2olICdrXqwNKFkBpKQ5Q+I=
873-
github.com/google/licenseclassifier/v2 v2.0.0-pre6/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM=
872+
github.com/google/licenseclassifier/v2 v2.0.0 h1:1Y57HHILNf4m0ABuMVb6xk4vAJYEUO0gDxNpog0pyeA=
873+
github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM=
874874
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
875875
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
876876
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=

goreleaser-canary.yml

+8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ builds:
1212
goos:
1313
- darwin
1414
- linux
15+
- windows
1516
goarch:
1617
- amd64
1718
- arm64
19+
ignore:
20+
- goos: windows
21+
goarch: arm64
1822

1923
archives:
2024
-
@@ -25,7 +29,11 @@ archives:
2529
arm64: ARM64
2630
darwin: macOS
2731
linux: Linux
32+
windows: Windows
2833
files:
2934
- README.md
3035
- LICENSE
3136
- contrib/*.tpl
37+
format_overrides:
38+
- goos: windows
39+
format: zip

goreleaser.yml

+15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ builds:
1313
- darwin
1414
- linux
1515
- freebsd
16+
- windows
1617
goarch:
1718
- amd64
1819
- 386
@@ -30,6 +31,16 @@ builds:
3031
goarch: arm
3132
- goos: freebsd
3233
goarch: arm64
34+
- goos: windows
35+
goarch: 386
36+
- goos: windows
37+
goarch: arm
38+
- goos: windows
39+
goarch: arm64
40+
- goos: windows
41+
goarch: s390x
42+
- goos: windows
43+
goarch: ppc64le
3344

3445
release:
3546
extra_files:
@@ -59,6 +70,7 @@ nfpms:
5970
netbsd: NetBSD
6071
freebsd: FreeBSD
6172
dragonfly: DragonFlyBSD
73+
windows: Windows
6274
contents:
6375
- src: contrib/*.tpl
6476
dst: /usr/local/share/trivy/templates
@@ -83,6 +95,9 @@ archives:
8395
- README.md
8496
- LICENSE
8597
- contrib/*.tpl
98+
format_overrides:
99+
- goos: windows
100+
format: zip
86101

87102

88103
brews:

pkg/cloud/aws/cache/cache.go

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func (c *Cache) load() (*CacheData, error) {
5252
if err != nil {
5353
return nil, ErrCacheNotFound
5454
}
55+
defer func() { _ = m.Close() }()
5556

5657
var data CacheData
5758
if err := json.NewDecoder(m).Decode(&data); err != nil {
@@ -127,5 +128,6 @@ func (c *Cache) AddServices(state *state.State, includedServices []string) error
127128
if err != nil {
128129
return err
129130
}
131+
defer func() { _ = f.Close() }()
130132
return json.NewEncoder(f).Encode(data)
131133
}

0 commit comments

Comments
 (0)