Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dae6411

Browse files
authored
upgrade github workflows to go 1.18 (anchore#649)
* upgrade github workflows to go 1.18 Signed-off-by: Jonas Galvão Xavier <[email protected]> * upgrade syft & set go1.18 for CI workflows Signed-off-by: Jonas Galvão Xavier <[email protected]> * go mod tidy Signed-off-by: Jonas Galvão Xavier <[email protected]> * add go1.17 static analysis Signed-off-by: Jonas Galvão Xavier <[email protected]> * fix yaml comment Signed-off-by: Jonas Galvão Xavier <[email protected]>
1 parent 7555342 commit dae6411

5 files changed

Lines changed: 77 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
- "v*"
1010

1111
env:
12-
GO_VERSION: "1.17.x"
12+
GO_VERSION: "1.18.x"
13+
GO_STABLE_VERSION: true
1314

1415
jobs:
1516
quality-gate:
@@ -34,6 +35,15 @@ jobs:
3435
checkName: "Static analysis"
3536
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3637

38+
- name: Check static analysis golangci-lint results
39+
uses: fountainhead/[email protected]
40+
id: static-analysis-go1-17
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
44+
checkName: "Static analysis against 1.17"
45+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
46+
3747
- name: Check unit test results
3848
uses: fountainhead/[email protected]
3949
id: unit
@@ -80,9 +90,10 @@ jobs:
8090
ref: ${{ github.event.pull_request.head.sha || github.sha }}
8191

8292
- name: Quality gate
83-
if: steps.static-analysis.outputs.conclusion != 'success' || steps.unit.outputs.conclusion != 'success' || steps.integration.outputs.conclusion != 'success' || steps.cli-linux.outputs.conclusion != 'success' || steps.acceptance-linux.outputs.conclusion != 'success' || steps.acceptance-mac.outputs.conclusion != 'success'
93+
if: steps.static-analysis-go1-17.outputs.conclusion != 'success' || steps.static-analysis.outputs.conclusion != 'success' || steps.unit.outputs.conclusion != 'success' || steps.integration.outputs.conclusion != 'success' || steps.cli-linux.outputs.conclusion != 'success' || steps.acceptance-linux.outputs.conclusion != 'success' || steps.acceptance-mac.outputs.conclusion != 'success'
8494
run: |
8595
echo "Static Analysis Status: ${{ steps.static-analysis.conclusion }}"
96+
echo "Static Analysis Status 1.17: ${{ steps.static-analysis-go1-17.conclusion }}"
8697
echo "Unit Test Status: ${{ steps.unit.outputs.conclusion }}"
8798
echo "Integration Test Status: ${{ steps.integration.outputs.conclusion }}"
8899
echo "Acceptance Test (Linux) Status: ${{ steps.acceptance-linux.outputs.conclusion }}"
@@ -100,6 +111,7 @@ jobs:
100111
- uses: actions/setup-go@v2
101112
with:
102113
go-version: ${{ env.GO_VERSION }}
114+
stable: ${{ env.GO_STABLE_VERSION }}
103115

104116
- uses: actions/checkout@v2
105117
with:

.github/workflows/validations.yaml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,56 @@ on:
77
pull_request:
88

99
env:
10-
GO_VERSION: "1.17.x"
10+
GO_VERSION: "1.18.x"
11+
GO_STABLE_VERSION: true
1112

1213
jobs:
14+
# TODO: please delete me once once we move to 1.18 and golangci-lint works with it.
15+
Static-Analysis-Golangci-lint:
16+
# Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline
17+
name: "Static analysis against 1.17"
18+
runs-on: ubuntu-20.04
19+
steps:
20+
- uses: actions/setup-go@v2
21+
with:
22+
go-version: "1.17"
23+
stable: ${{ env.GO_STABLE_VERSION }}
24+
25+
- uses: actions/checkout@v2
26+
27+
- name: Restore tool cache
28+
id: tool-cache
29+
uses: actions/[email protected]
30+
with:
31+
path: ${{ github.workspace }}/.tmp
32+
key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }}
33+
34+
- name: Restore go cache
35+
id: go-cache
36+
uses: actions/[email protected]
37+
with:
38+
path: ~/go/pkg/mod
39+
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
40+
restore-keys: |
41+
${{ runner.os }}-go-${{ env.GO_VERSION }}-
42+
43+
- name: (cache-miss) Bootstrap all project dependencies
44+
if: steps.tool-cache.outputs.cache-hit != 'true' || steps.go-cache.outputs.cache-hit != 'true'
45+
run: make bootstrap
46+
47+
- name: Bootstrap CI environment dependencies
48+
run: make ci-bootstrap
49+
50+
- name: Run linters
51+
run: make lint
52+
53+
# allow for PRs to skip validating the syft version to allow for incremental updates of syft before release.
54+
# In this way checks against the main branch (which are required for release) will fail, but PR checks will not
55+
- name: Ensure syft version is a release version
56+
run: |
57+
echo "GitHub reference: ${GITHUB_REF##*/}"
58+
git fetch origin main
59+
git merge-base --is-ancestor ${GITHUB_REF##*/} origin/main && make validate-syft-release-version || echo "skipping syft version checkk"
1360
1461
Static-Analysis:
1562
# Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline
@@ -19,6 +66,7 @@ jobs:
1966
- uses: actions/setup-go@v2
2067
with:
2168
go-version: ${{ env.GO_VERSION }}
69+
stable: ${{ env.GO_STABLE_VERSION }}
2270

2371
- uses: actions/checkout@v2
2472

@@ -64,6 +112,7 @@ jobs:
64112
- uses: actions/setup-go@v2
65113
with:
66114
go-version: ${{ env.GO_VERSION }}
115+
stable: ${{ env.GO_STABLE_VERSION }}
67116

68117
- uses: actions/checkout@v2
69118

@@ -106,6 +155,7 @@ jobs:
106155
- uses: actions/setup-go@v2
107156
with:
108157
go-version: ${{ env.GO_VERSION }}
158+
stable: ${{ env.GO_STABLE_VERSION }}
109159

110160
- uses: actions/checkout@v2
111161

@@ -154,6 +204,7 @@ jobs:
154204
- uses: actions/setup-go@v2
155205
with:
156206
go-version: ${{ env.GO_VERSION }}
207+
stable: ${{ env.GO_STABLE_VERSION }}
157208

158209
- uses: actions/checkout@v2
159210

@@ -248,6 +299,7 @@ jobs:
248299
- uses: actions/setup-go@v2
249300
with:
250301
go-version: ${{ env.GO_VERSION }}
302+
stable: ${{ env.GO_STABLE_VERSION }}
251303

252304
- uses: actions/checkout@v2
253305

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bootstrap: $(RESULTSDIR) bootstrap-go bootstrap-tools ## Download and install al
107107
$(call title,Bootstrapping dependencies)
108108

109109
.PHONY: static-analysis
110-
static-analysis: lint check-go-mod-tidy check-licenses validate-grype-db-schema
110+
static-analysis: check-go-mod-tidy check-licenses validate-grype-db-schema
111111

112112
.PHONY: lint
113113
lint: ## Run gofmt + golangci lint checks

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ require (
1010
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04
1111
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4
1212
github.com/anchore/packageurl-go v0.1.1-0.20220314153042-1bcd40e5206b
13-
github.com/anchore/stereoscope v0.0.0-20220307154759-8a5a70c227d3
14-
github.com/anchore/syft v0.41.6
13+
github.com/anchore/stereoscope v0.0.0-20220315185520-25183ec78f40
14+
github.com/anchore/syft v0.42.0
1515
github.com/bmatcuk/doublestar/v2 v2.0.4
1616
github.com/docker/docker v20.10.12+incompatible
1717
github.com/dustin/go-humanize v1.0.0
@@ -60,6 +60,7 @@ require (
6060
github.com/Masterminds/semver/v3 v3.1.1 // indirect
6161
github.com/Microsoft/go-winio v0.5.1 // indirect
6262
github.com/acobaugh/osrelease v0.1.0 // indirect
63+
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb // indirect
6364
github.com/anchore/go-rpmdb v0.0.0-20210914181456-a9c52348da63 // indirect
6465
github.com/andybalholm/brotli v1.0.4 // indirect
6566
github.com/aws/aws-sdk-go v1.43.0 // indirect

go.sum

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cv
261261
github.com/alicebob/sqlittle v1.4.0 h1:vgYt0nAjhdf/hg52MjKJ84g/uTzBPfrvI+VUBrIghxA=
262262
github.com/alicebob/sqlittle v1.4.0/go.mod h1:Co1L1qxHqCwf41puWhk2HOodojR0mcsAV4BIt8byZh8=
263263
github.com/anchore/client-go v0.0.0-20210222170800-9c70f9b80bcf/go.mod h1:FaODhIA06mxO1E6R32JE0TL1JWZZkmjRIAd4ULvHUKk=
264+
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb h1:iDMnx6LIjtjZ46C0akqveX83WFzhpTD3eqOthawb5vU=
265+
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb/go.mod h1:DmTY2Mfcv38hsHbG78xMiTDdxFtkHpgYNVDPsF2TgHk=
264266
github.com/anchore/go-rpmdb v0.0.0-20210914181456-a9c52348da63 h1:C9W/LAydEz/qdUhx1MdjO9l8NEcFKYknkxDVyo9LAoM=
265267
github.com/anchore/go-rpmdb v0.0.0-20210914181456-a9c52348da63/go.mod h1:6qH8c6U/3CBVvDDDBZnPSTbTINq3cIdADUYTaVf75EM=
266268
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 h1:VzprUTpc0vW0nnNKJfJieyH/TZ9UYAnTZs5/gHTdAe8=
@@ -270,10 +272,10 @@ github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4 h1:rmZG77uXgE
270272
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4/go.mod h1:Bkc+JYWjMCF8OyZ340IMSIi2Ebf3uwByOk6ho4wne1E=
271273
github.com/anchore/packageurl-go v0.1.1-0.20220314153042-1bcd40e5206b h1:YJWYt/6KQXR9JR46lLHrTTYi8rcye42tKcyjREA/hvA=
272274
github.com/anchore/packageurl-go v0.1.1-0.20220314153042-1bcd40e5206b/go.mod h1:Blo6OgJNiYF41ufcgHKkbCKF2MDOMlrqhXv/ij6ocR4=
273-
github.com/anchore/stereoscope v0.0.0-20220307154759-8a5a70c227d3 h1:Kx2jlMdENAf4cVjYGYLI+fiavVhzhtmU89GUYDITJ1w=
274-
github.com/anchore/stereoscope v0.0.0-20220307154759-8a5a70c227d3/go.mod h1:XESZQTgFETDBatmyoet6XZ0zVknoIMDSAhj2INj2a5w=
275-
github.com/anchore/syft v0.41.6 h1:MiI6kCByU7Yv3VCPBXMTE2MrGYrT+OZzhJgwJdmhuZ8=
276-
github.com/anchore/syft v0.41.6/go.mod h1:bpjCESyDJcJwdxey3IyLjsynIKxFpG56Xf2YlEvYX3I=
275+
github.com/anchore/stereoscope v0.0.0-20220315185520-25183ec78f40 h1:OSyFMZgEwQW0wFyv10kEi9kmB52FQFRUQmc2H6d8LTY=
276+
github.com/anchore/stereoscope v0.0.0-20220315185520-25183ec78f40/go.mod h1:OVVJ4y/L26pspeeHNvNa7GeQfoLPWxJe13iODl9x5l4=
277+
github.com/anchore/syft v0.42.0 h1:xHy7Viga48U80NwVBaSv9x63ygk/Bqja8Dr/P8F4nUg=
278+
github.com/anchore/syft v0.42.0/go.mod h1:zmU1U+xOgPbQ1h0vS11/A/05b2RH8vlXXvyT2kzCFbQ=
277279
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
278280
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
279281
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=

0 commit comments

Comments
 (0)