Skip to content

Commit 4c20eab

Browse files
authored
Merge pull request #97 from grafana/paul/upgrade-k6
Upgrade k6, dependencies, and CI workflow
2 parents cf95003 + c294002 commit 4c20eab

File tree

14 files changed

+347
-323
lines changed

14 files changed

+347
-323
lines changed

.github/workflows/ci.yml

+45-13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- v*
1111
pull_request:
1212

13+
defaults:
14+
run:
15+
shell: bash
16+
1317
jobs:
1418
build-with-xk6:
1519
runs-on: ubuntu-latest
@@ -19,24 +23,52 @@ jobs:
1923
- name: Install Go
2024
uses: actions/setup-go@v3
2125
with:
22-
go-version: 1.18.x
23-
- name: Get module name
24-
run: |
25-
echo "::set-output name=Module::$(go list -m)"
26-
id: module-name
27-
- name: Verify builds with xk6
26+
go-version: 1.20.x
27+
- name: Check build
2828
run: |
29+
go version
30+
pwd && ls -l
31+
2932
go install go.k6.io/xk6/cmd/xk6@latest
30-
xk6 build --with ${{ steps.module-name.outputs.Module }}=.
33+
MODULE_NAME=$(go list -m)
34+
35+
xk6 build \
36+
--output ./k6ext \
37+
--with $MODULE_NAME="."
38+
./k6ext version
3139
32-
run-unit-tests:
33-
runs-on: ubuntu-latest
40+
test-go-versions:
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
go-version: [1.19.x, 1.20.x, tip]
45+
platform: [ubuntu-latest, windows-latest]
46+
runs-on: ${{ matrix.platform }}
3447
steps:
3548
- name: Checkout code
3649
uses: actions/checkout@v3
37-
- name: Install Go
50+
- name: Install Go ${{ matrix.go-version }}
51+
if: matrix.go-version != 'tip'
3852
uses: actions/setup-go@v3
3953
with:
40-
go-version: 1.18.x
41-
- name: Run unit tests
42-
run: go test -v -cover -race ./...
54+
go-version: ${{ matrix.go-version }}
55+
- name: Install Go stable
56+
if: matrix.go-version == 'tip'
57+
uses: actions/setup-go@v3
58+
with:
59+
go-version: 1.x
60+
- name: Install Go tip
61+
shell: bash
62+
if: matrix.go-version == 'tip'
63+
run: |
64+
go install golang.org/dl/gotip@latest
65+
gotip download
66+
echo "GOROOT=$HOME/sdk/gotip" >> "$GITHUB_ENV"
67+
echo "GOPATH=$HOME/go" >> "$GITHUB_ENV"
68+
echo "$HOME/go/bin" >> "$GITHUB_PATH"
69+
echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH"
70+
- name: Run tests
71+
run: |
72+
which go
73+
go version
74+
go test -race -timeout 60s ./...

.github/workflows/linter.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,30 @@ jobs:
1111
- name: Install Go
1212
uses: actions/setup-go@v3
1313
with:
14-
go-version: 1.17.x
14+
go-version: 1.20.x
1515
- name: Check module dependencies
1616
run: |
1717
go version
1818
test -z "$(go mod tidy && git status go.* --porcelain)"
1919
go mod verify
2020
21-
run-golangci:
21+
lint:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
2628
- name: Install Go
2729
uses: actions/setup-go@v3
2830
with:
29-
go-version: 1.17.x
31+
go-version: 1.20.x
3032
- name: Retrieve golangci-lint version
3133
run: |
32-
echo "::set-output name=Version::$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')"
34+
echo "Version=$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')" >> $GITHUB_OUTPUT
3335
id: version
3436
- name: golangci-lint
3537
uses: golangci/golangci-lint-action@v3
3638
with:
37-
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
3839
version: ${{ steps.version.outputs.Version }}
40+
only-new-issues: true

.golangci.yml

+90-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# v1.43.0
1+
# v1.52.2
22
# Please don't remove the first line. It is used in CI to determine the golangci version
33
run:
44
deadline: 5m
@@ -21,54 +21,109 @@ issues:
2121
linters:
2222
- cyclop
2323
- dupl
24-
- funlen
2524
- gocognit
25+
- funlen
2626
- lll
2727
- linters:
2828
- paralleltest # false positive: https://github.com/kunwardeep/paralleltest/issues/8.
2929
text: "does not use range value in test Run"
30+
- linters:
31+
- forbidigo
32+
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'
3033

3134
linters-settings:
35+
nolintlint:
36+
# Disable to ensure that nolint directives don't have a leading space. Default is true.
37+
allow-leading-space: false
38+
exhaustive:
39+
default-signifies-exhaustive: true
40+
govet:
41+
check-shadowing: true
3242
cyclop:
3343
max-complexity: 25
44+
maligned:
45+
suggest-new: true
3446
dupl:
3547
threshold: 150
36-
exhaustive:
37-
default-signifies-exhaustive: true
38-
funlen:
39-
lines: 80
40-
statements: 60
4148
goconst:
4249
min-len: 10
4350
min-occurrences: 4
44-
govet:
45-
check-shadowing: true
46-
maligned:
47-
suggest-new: true
51+
funlen:
52+
lines: 80
53+
statements: 60
54+
forbidigo:
55+
forbid:
56+
- '^(fmt\\.Print(|f|ln)|print|println)$'
57+
# Forbid everything in os, except os.Signal and os.SyscalError
58+
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?'
59+
# Forbid everything in syscall except the uppercase constants
60+
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
61+
- '^logrus\.Logger$'
4862

4963
linters:
50-
enable-all: true
51-
disable:
52-
- exhaustivestruct
53-
- gci
54-
- gochecknoinits
55-
- gocyclo # replaced by cyclop since it also calculates the package complexity
56-
- godot
57-
- godox
58-
- goerr113 # most of the errors here are meant for humans
59-
- goheader
60-
- golint # this linter is deprecated
61-
- gomnd
62-
- gomodguard
63-
- interfacer # deprecated
64-
- ireturn
65-
- maligned # replaced by govet 'fieldalignment'
66-
- nlreturn
67-
- scopelint # deprecated, replaced by exportloopref
68-
- tagliatelle
69-
- testpackage
70-
- thelper
71-
- varnamelen # disabled before the final decision in (https://github.com/grafana/k6/pull/2323)
72-
- wrapcheck # a little bit too much for k6, maybe after https://github.com/tomarrell/wrapcheck/issues/2 is fixed
73-
- wsl
64+
disable-all: true
65+
enable:
66+
- asasalint
67+
- asciicheck
68+
- bidichk
69+
- bodyclose
70+
- contextcheck
71+
- cyclop
72+
- depguard
73+
- dogsled
74+
- dupl
75+
- durationcheck
76+
- errcheck
77+
- errchkjson
78+
- errname
79+
- errorlint
80+
- exhaustive
81+
- exportloopref
82+
- forbidigo
83+
- forcetypeassert
84+
- funlen
85+
- gocheckcompilerdirectives
86+
- gochecknoglobals
87+
- gocognit
88+
- goconst
89+
- gocritic
90+
- gofmt
91+
- gofumpt
92+
- goimports
93+
- gomoddirectives
94+
- goprintffuncname
95+
- gosec
96+
- gosimple
97+
- govet
98+
- importas
99+
- ineffassign
100+
- lll
101+
- makezero
102+
- misspell
103+
- nakedret
104+
- nestif
105+
- nilerr
106+
- nilnil
107+
- noctx
108+
- nolintlint
109+
- nosprintfhostport
110+
- paralleltest
111+
- prealloc
112+
- predeclared
113+
- promlinter
114+
- revive
115+
- reassign
116+
- rowserrcheck
117+
- sqlclosecheck
118+
- staticcheck
119+
- stylecheck
120+
- tenv
121+
- tparallel
122+
- typecheck
123+
- unconvert
124+
- unparam
125+
- unused
126+
- usestdlibvars
127+
- wastedassign
128+
- whitespace
74129
fast: false

go.mod

+39-47
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,72 @@
11
module github.com/grafana/xk6-kubernetes
22

3-
go 1.18
3+
go 1.19
44

55
require (
6-
go.k6.io/k6 v0.41.0
7-
k8s.io/api v0.25.4
8-
k8s.io/apimachinery v0.25.4
9-
k8s.io/client-go v0.25.4
6+
go.k6.io/k6 v0.44.0
7+
k8s.io/api v0.27.1
8+
k8s.io/apimachinery v0.27.1
9+
k8s.io/client-go v0.27.1
1010
)
1111

1212
require (
13-
github.com/dop251/goja v0.0.0-20221003171542-5ea1285e6c91
13+
github.com/dop251/goja v0.0.0-20230427124612-428fc442ff5f
1414
github.com/sirupsen/logrus v1.9.0
15-
github.com/stretchr/testify v1.8.0
15+
github.com/stretchr/testify v1.8.2
1616
)
1717

1818
require (
19-
cloud.google.com/go v0.97.0 // indirect
20-
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
21-
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
22-
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
23-
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
24-
github.com/Azure/go-autorest/logger v0.2.1 // indirect
25-
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
26-
github.com/PuerkitoBio/purell v1.1.1 // indirect
27-
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
2819
github.com/davecgh/go-spew v1.1.1 // indirect
29-
github.com/dlclark/regexp2 v1.7.0 // indirect
30-
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
31-
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
32-
github.com/fatih/color v1.13.0 // indirect
33-
github.com/go-logr/logr v1.2.3 // indirect
34-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
35-
github.com/go-openapi/jsonreference v0.19.5 // indirect
36-
github.com/go-openapi/swag v0.19.14 // indirect
20+
github.com/dlclark/regexp2 v1.9.0 // indirect
21+
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
22+
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
23+
github.com/fatih/color v1.15.0 // indirect
24+
github.com/go-logr/logr v1.2.4 // indirect
25+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
26+
github.com/go-openapi/jsonreference v0.20.2 // indirect
27+
github.com/go-openapi/swag v0.22.3 // indirect
3728
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible // indirect
3829
github.com/gogo/protobuf v1.3.2 // indirect
39-
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
40-
github.com/golang/protobuf v1.5.2 // indirect
41-
github.com/google/gnostic v0.5.7-v3refs // indirect
42-
github.com/google/gofuzz v1.1.0 // indirect
43-
github.com/imdario/mergo v0.3.6 // indirect
30+
github.com/golang/protobuf v1.5.3 // indirect
31+
github.com/google/gnostic v0.6.9 // indirect
32+
github.com/google/go-cmp v0.5.9 // indirect
33+
github.com/google/gofuzz v1.2.0 // indirect
34+
github.com/google/pprof v0.0.0-20230426061923-93006964c1fc // indirect
35+
github.com/google/uuid v1.3.0 // indirect
36+
github.com/imdario/mergo v0.3.15 // indirect
4437
github.com/josharian/intern v1.0.0 // indirect
4538
github.com/json-iterator/go v1.1.12 // indirect
4639
github.com/mailru/easyjson v0.7.7 // indirect
4740
github.com/mattn/go-colorable v0.1.13 // indirect
48-
github.com/mattn/go-isatty v0.0.16 // indirect
41+
github.com/mattn/go-isatty v0.0.18 // indirect
4942
github.com/moby/spdystream v0.2.0 // indirect
5043
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5144
github.com/modern-go/reflect2 v1.0.2 // indirect
52-
github.com/mstoykov/atlas v0.0.0-20220808085829-90340e9998bd // indirect
45+
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
5346
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5447
github.com/onsi/ginkgo v1.16.5 // indirect
55-
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
5648
github.com/pkg/errors v0.9.1 // indirect
5749
github.com/pmezard/go-difflib v1.0.0 // indirect
5850
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
59-
github.com/spf13/afero v1.2.2 // indirect
51+
github.com/spf13/afero v1.9.5 // indirect
6052
github.com/spf13/pflag v1.0.5 // indirect
61-
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect
62-
golang.org/x/net v0.0.0-20221002022538-bcab6841153b // indirect
63-
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
64-
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
65-
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
66-
golang.org/x/text v0.3.7 // indirect
67-
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
53+
golang.org/x/crypto v0.8.0 // indirect
54+
golang.org/x/net v0.9.0 // indirect
55+
golang.org/x/oauth2 v0.7.0 // indirect
56+
golang.org/x/sys v0.7.0 // indirect
57+
golang.org/x/term v0.7.0 // indirect
58+
golang.org/x/text v0.9.0 // indirect
59+
golang.org/x/time v0.3.0 // indirect
6860
google.golang.org/appengine v1.6.7 // indirect
69-
google.golang.org/protobuf v1.28.0 // indirect
70-
gopkg.in/guregu/null.v3 v3.3.0 // indirect
61+
google.golang.org/protobuf v1.30.0 // indirect
62+
gopkg.in/guregu/null.v3 v3.5.0 // indirect
7163
gopkg.in/inf.v0 v0.9.1 // indirect
7264
gopkg.in/yaml.v2 v2.4.0 // indirect
7365
gopkg.in/yaml.v3 v3.0.1 // indirect
74-
k8s.io/klog/v2 v2.70.1 // indirect
75-
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
76-
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
77-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
66+
k8s.io/klog/v2 v2.90.1 // indirect
67+
k8s.io/kube-openapi v0.0.0-20230426210814-b0c0aaee3cc0 // indirect
68+
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
69+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
7870
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
79-
sigs.k8s.io/yaml v1.2.0 // indirect
71+
sigs.k8s.io/yaml v1.3.0 // indirect
8072
)

0 commit comments

Comments
 (0)