Skip to content

Commit

Permalink
Merge pull request #25 from grafana/paul/update-ci
Browse files Browse the repository at this point in the history
Chore: update CI and compose versions
  • Loading branch information
javaducky authored Jul 20, 2023
2 parents 0f71d79 + 1975a64 commit 797aed4
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 49 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.20.x
- name: Retrieve golangci-lint version
run: |
echo "Version=$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')" >> $GITHUB_OUTPUT
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [1.18.x, 1.19.x, 1.20.x, tip]
go-version: [1.19.x, 1.20.x, tip]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
run: |
which go
go version
go test -race -timeout 800s ./...
go test -race -timeout 60s ./...
test-build:
runs-on: ubuntu-latest
Expand All @@ -80,15 +80,16 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- name: Check build
run: |
go version
pwd && ls -l
go install go.k6.io/xk6/cmd/xk6@master
go install go.k6.io/xk6/cmd/xk6@latest
MODULE_NAME=$(go list -m)
GOPRIVATE="go.k6.io/k6" xk6 build \
xk6 build \
--output ./k6ext \
--with github.com/grafana/xk6-output-timescaledb="."
--with $MODULE_NAME="."
./k6ext version
114 changes: 77 additions & 37 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v1.47.2
# v1.53.3
# Please don't remove the first line. It uses in CI to determine the golangci version
run:
deadline: 5m
Expand All @@ -10,7 +10,7 @@ issues:
max-same-issues: 0

# We want to try and improve the comments in the k6 codebase, so individual
# non-golint items from the default exclusion list will gradually be addded
# non-golint items from the default exclusion list will gradually be added
# to the exclude-rules below
exclude-use-default: false

Expand All @@ -25,8 +25,8 @@ issues:
- funlen
- lll
- linters:
- paralleltest # false positive: https://github.com/kunwardeep/paralleltest/issues/8.
text: "does not use range value in test Run"
- forbidigo
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'

linters-settings:
nolintlint:
Expand All @@ -48,38 +48,78 @@ linters-settings:
funlen:
lines: 80
statements: 60
forbidigo:
forbid:
- '^(fmt\\.Print(|f|ln)|print|println)$'
# Forbid everything in os, except os.Signal and os.SyscalError
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?'
# Forbid everything in syscall except the uppercase constants
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
- '^logrus\.Logger$'

linters:
enable-all: true
disable:
- nlreturn
- gci
- gochecknoinits
- godot
- godox
- gomodguard
- testpackage
- wsl
- gomnd
- goerr113 # most of the errors here are meant for humans
- goheader
- exhaustivestruct
- thelper
- gocyclo # replaced by cyclop since it also calculates the package complexity
- maligned # replaced by govet 'fieldalignment'
- interfacer # deprecated
- scopelint # deprecated, replaced by exportloopref
- wrapcheck # a little bit too much for k6, maybe after https://github.com/tomarrell/wrapcheck/issues/2 is fixed
- golint # this linter is deprecated
- varnamelen
- ireturn
- tagliatelle
- exhaustruct
- execinquery
- maintidx
- grouper
- decorder
- nonamedreturns
- nosnakecase
- containedctx
fast: false
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- cyclop
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gocheckcompilerdirectives
- gochecknoglobals
- gocognit
- goconst
- gocritic
- gofmt
- gofumpt
- goimports
- gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- lll
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- revive
- reassign
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tenv
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
fast: false
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Clone the repo to get started and follow these steps:

3. Start the docker compose environment.
```shell
docker-compose up -d
docker compose up -d
```

```shell
Expand All @@ -71,7 +71,7 @@ Clone the repo to get started and follow these steps:

4. Use the k6 Docker image to run the k6 script and send metrics to the TimescaleDB container started on the previous step. You must [set the `testid` tag](https://k6.io/docs/using-k6/tags-and-groups/#test-wide-tags) with a unique identifier to segment the metrics into discrete test runs for the [Grafana dashboards](#dashboards).
```shell
docker-compose run --rm -T k6 run -<samples/http_2.js --tag testid=<SOME-ID>
docker compose run --rm -T k6 run -<samples/http_2.js --tag testid=<SOME-ID>
```
For convenience, the `docker-run.sh` can be used to simply:
```shell
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ networks:

services:
timescaledb:
image: timescale/timescaledb:latest-pg12
image: timescale/timescaledb:latest-pg15
command: postgres -c shared_preload_libraries=timescaledb
networks:
- k6
Expand All @@ -22,7 +22,7 @@ services:
- POSTGRES_PASSWORD=k6

grafana:
image: grafana/grafana:8.2.6
image: grafana/grafana:10.0.2
networks:
- grafana
- timescaledb
Expand Down
2 changes: 1 addition & 1 deletion docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ fi
SCRIPT_NAME=$1
TAG_NAME="$(basename -s .js $SCRIPT_NAME)-$(date +%s)"

docker-compose run --rm -T k6 run -<$SCRIPT_NAME --tag testid=$TAG_NAME
docker compose run --rm -T k6 run -<$SCRIPT_NAME --tag testid=$TAG_NAME

0 comments on commit 797aed4

Please sign in to comment.