Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 85c9b10

Browse files
committed
1 parent c7f14d8 commit 85c9b10

File tree

7 files changed

+44
-31
lines changed

7 files changed

+44
-31
lines changed

.github/workflows/lints.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ on:
66
branches:
77
- master
88
pull_request:
9+
10+
env:
11+
FORCE_COLOR: true
12+
913
jobs:
1014
golangci:
1115
name: Golangci
1216
runs-on: ubuntu-latest
1317
steps:
14-
- uses: actions/checkout@v2
15-
- name: golangci-lint
16-
uses: golangci/golangci-lint-action@v2
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.21'
22+
cache: false
23+
- uses: golangci/golangci-lint-action@v4
1724
with:
1825
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
1926
version: v1.55.2
2027
editorconfig:
2128
name: EditorConfig
2229
runs-on: ubuntu-latest
2330
steps:
24-
- uses: actions/checkout@v2
25-
- name: ECLint
26-
uses: snow-actions/[email protected]
31+
- uses: actions/checkout@v4
32+
- uses: snow-actions/[email protected]
2733
with:
2834
args: check
2935

.github/workflows/security.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717

1818
- name: Run Snyk to check for vulnerabilities
1919
uses: snyk/actions/golang@master

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
steps:
2424

2525
- name: Set up Go ${{ matrix.go-version }}
26-
uses: actions/setup-go@v2
26+
uses: actions/setup-go@v5
2727
with:
2828
go-version: ${{ matrix.go-version }}
2929
id: go
3030

3131
- name: Check out code into the Go module directory
32-
uses: actions/checkout@v2
32+
uses: actions/checkout@v4
3333

3434
- name: Test unit
3535
run: go run gotest.tools/gotestsum@latest

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
require (
66
github.com/blang/semver/v4 v4.0.0
7-
github.com/cardil/ghet v0.0.1-0.20240322174403-1901c4fe21ac
7+
github.com/cardil/ghet v0.0.1-0.20240326133720-fccab8f3066e
88
github.com/fatih/color v1.16.0
99
github.com/google/go-containerregistry v0.19.1
1010
github.com/google/ko v0.15.2
@@ -193,7 +193,7 @@ require (
193193
k8s.io/apimachinery v0.29.3 // indirect
194194
k8s.io/klog/v2 v2.120.1 // indirect
195195
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
196-
knative.dev/client-pkg v0.0.0-20240322171749-cf1573f93631 // indirect
196+
knative.dev/client-pkg v0.0.0-20240326133606-ca64d2dc74eb // indirect
197197
knative.dev/pkg v0.0.0-20240318073042-db6f3b074e8c // indirect
198198
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
199199
sigs.k8s.io/kind v0.22.0 // indirect

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ github.com/bodgit/sevenzip v1.5.0 h1:QESwnPUnhqftOgbi6wIiWm1WEkrT4puHukt5a2psEcw
114114
github.com/bodgit/sevenzip v1.5.0/go.mod h1:+E74G6pfBX8IMaVybsKMgGTTTBcbHU8ssPTJ9mLUr38=
115115
github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4=
116116
github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM=
117-
github.com/cardil/ghet v0.0.1-0.20240322174403-1901c4fe21ac h1:J6clysTPmIXMLYNh5Vu+x3qNiMTXKibibYz4dO/tiT8=
118-
github.com/cardil/ghet v0.0.1-0.20240322174403-1901c4fe21ac/go.mod h1:INmHFxuHn5LmjkjmR9aCqa6msghwM/4q5He/vYlucfY=
117+
github.com/cardil/ghet v0.0.1-0.20240326133720-fccab8f3066e h1:ijvKajl7Hv/H3k2J9PyXsDlwDcxt98T/lRoT7G2eizk=
118+
github.com/cardil/ghet v0.0.1-0.20240326133720-fccab8f3066e/go.mod h1:GMYQeYWhSM+R11LaHHocV/9d/JZcG1+XVUDzm5nbtrc=
119119
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
120120
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
121121
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -799,8 +799,8 @@ k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
799799
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
800800
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
801801
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
802-
knative.dev/client-pkg v0.0.0-20240322171749-cf1573f93631 h1:LRwjoTbqyruGECvQZyGQE3k5clxwmgCQEt5HcWTUz2Y=
803-
knative.dev/client-pkg v0.0.0-20240322171749-cf1573f93631/go.mod h1:CODwMfQexBzzgB2fv9hYF1+FZfrYc9TF3B26GxW69zQ=
802+
knative.dev/client-pkg v0.0.0-20240326133606-ca64d2dc74eb h1:GXMlA9qA1b/a1eRBgMhfdmFqLyv17DdjaOnaH/ZFBU0=
803+
knative.dev/client-pkg v0.0.0-20240326133606-ca64d2dc74eb/go.mod h1:+wx9/SVVGLte1JRcULet7kKnnUmgPzG1vQpD8E4DwVs=
804804
knative.dev/pkg v0.0.0-20240318073042-db6f3b074e8c h1:d8GmDhObjnH/iKrazsNjgLuuEnxLiFE/QSaeFY337cw=
805805
knative.dev/pkg v0.0.0-20240318073042-db6f3b074e8c/go.mod h1:RfDXq7Rf7UmGCEdAiJZPpBRuh7dX73T8clniFt2zEAA=
806806
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

tests/example/.golangci.yml

-9
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,3 @@ issues:
3636
- path: _test\.go
3737
linters:
3838
- wrapcheck
39-
40-
41-
linters-settings:
42-
gomoddirectives:
43-
# List of allowed `replace` directives. Default is empty.
44-
replace-allow-list:
45-
# FIXME: remove after https://github.com/google/ko/issues/476
46-
- github.com/google/ko
47-
- knative.dev/client-pkg

tests/project_build_test.go

+23-7
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,41 @@ func TestProjectBuild(t *testing.T) {
1717
if testing.Short() {
1818
t.Skip("short tests only")
1919
}
20-
execCmd(t, "./example", "./mage", "clean", "build")
21-
execCmd(t, "./example/build/_output/bin", fmt.Sprintf("./other-%s-%s",
22-
runtime.GOOS, runtime.GOARCH))
20+
c := mkCmd("./example", "./mage", "clean", "build")
21+
assertCommandStarted(t, c)
22+
assertCommandSucceded(t, c)
23+
c = mkCmd("./example/build/_output/bin",
24+
fmt.Sprintf("./other-%s-%s", runtime.GOOS, runtime.GOARCH))
25+
assertCommandStarted(t, c)
26+
assertCommandSucceded(t, c)
2327
}
2428

25-
func execCmd(tb testing.TB, dir, name string, args ...string) {
26-
tb.Helper()
29+
func mkCmd(dir, name string, args ...string) *exec.Cmd {
2730
c := exec.Command(name, args...)
2831
c.Env = append(
29-
env(filterOutByName{names: []string{"GOOS"}}),
32+
env(filterOutByName{names: []string{"GOOS", "GOARCH", "GOARM"}}),
3033
"GOTRACEBACK=all",
3134
)
3235
c.Dir = dir
3336
c.Stdout = os.Stdout
3437
c.Stderr = os.Stderr
38+
return c
39+
}
40+
41+
func assertCommandStarted(tb testing.TB, c *exec.Cmd) {
42+
tb.Helper()
3543
assert.NilError(tb, c.Start())
3644
tb.Logf("Started `%q` with pid %d",
37-
append([]string{name}, args...),
45+
append([]string{c.Path}, c.Args...),
3846
c.Process.Pid)
47+
tb.Log("Process env:")
48+
for _, e := range c.Env {
49+
tb.Logf(" * %s", e)
50+
}
51+
}
52+
53+
func assertCommandSucceded(tb testing.TB, c *exec.Cmd) {
54+
tb.Helper()
3955
assert.NilError(tb, c.Wait())
4056
}
4157

0 commit comments

Comments
 (0)