This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading dependencies and adding standard CI
Fixes #14 Signed-off-by: Paul Balogh <[email protected]>
- Loading branch information
Showing
13 changed files
with
439 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: CI | ||
on: | ||
# Enable manually triggering this workflow via the API or web UI | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.x | ||
- name: Retrieve golangci-lint version | ||
run: | | ||
echo "Version=$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')" >> $GITHUB_OUTPUT | ||
id: version | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: ${{ steps.version.outputs.Version }} | ||
only-new-issues: true | ||
|
||
test-go-versions: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go-version: [1.18.x, 1.19.x, 1.20.x, tip] | ||
platform: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go ${{ matrix.go-version }} | ||
if: matrix.go-version != 'tip' | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Install Go stable | ||
if: matrix.go-version == 'tip' | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.x | ||
- name: Install Go tip | ||
shell: bash | ||
if: matrix.go-version == 'tip' | ||
run: | | ||
go install golang.org/dl/gotip@latest | ||
gotip download | ||
echo "GOROOT=$HOME/sdk/gotip" >> "$GITHUB_ENV" | ||
echo "GOPATH=$HOME/go" >> "$GITHUB_ENV" | ||
echo "$HOME/go/bin" >> "$GITHUB_PATH" | ||
echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH" | ||
- name: Run tests | ||
run: | | ||
which go | ||
go version | ||
go test -race -timeout 800s ./... | ||
test-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.x | ||
- name: Check build | ||
run: | | ||
go version | ||
pwd && ls -l | ||
go install go.k6.io/xk6/cmd/xk6@master | ||
MODULE_NAME=`go list -m` | ||
GOPRIVATE="go.k6.io/k6" xk6 build \ | ||
--output ./k6ext \ | ||
--with $MODULE_NAME="." | ||
./k6ext version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea/ | ||
.DS_Store | ||
k6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# v1.52.2 | ||
# Please don't remove the first line. It uses in CI to determine the golangci version | ||
run: | ||
deadline: 5m | ||
|
||
issues: | ||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
max-issues-per-linter: 0 | ||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
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 | ||
# to the exclude-rules below | ||
exclude-use-default: false | ||
|
||
exclude-rules: | ||
# Exclude duplicate code and function length and complexity checking in test | ||
# files (due to common repeats and long functions in test code) | ||
- path: _(test|gen)\.go | ||
linters: | ||
- cyclop | ||
- dupl | ||
- gocognit | ||
- funlen | ||
- lll | ||
- linters: | ||
- paralleltest # false positive: https://github.com/kunwardeep/paralleltest/issues/8. | ||
text: "does not use range value in test Run" | ||
- linters: | ||
- forbidigo | ||
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden' | ||
|
||
linters-settings: | ||
nolintlint: | ||
# Disable to ensure that nolint directives don't have a leading space. Default is true. | ||
allow-leading-space: false | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
govet: | ||
check-shadowing: true | ||
cyclop: | ||
max-complexity: 25 | ||
maligned: | ||
suggest-new: true | ||
dupl: | ||
threshold: 150 | ||
goconst: | ||
min-len: 10 | ||
min-occurrences: 4 | ||
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: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- contextcheck | ||
- cyclop | ||
- depguard | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level of experience, | ||
nationality, personal appearance, race, religion, or sexual identity and | ||
orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting our Developer Relations team, [email protected]. | ||
|
||
All complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
MAKEFLAGS += --silent | ||
|
||
all: clean format test build | ||
|
||
## help: Prints a list of available build targets. | ||
help: | ||
echo "Usage: make <OPTIONS> ... <TARGETS>" | ||
echo "" | ||
echo "Available targets are:" | ||
echo '' | ||
sed -n 's/^##//p' ${PWD}/Makefile | column -t -s ':' | sed -e 's/^/ /' | ||
echo | ||
echo "Targets run by default are: `sed -n 's/^all: //p' ./Makefile | sed -e 's/ /, /g' | sed -e 's/\(.*\), /\1, and /'`" | ||
|
||
## clean: Removes any previously created build artifacts. | ||
clean: | ||
rm -f ./k6 | ||
|
||
## build: Builds a custom 'k6' with the local extension. | ||
build: | ||
go install go.k6.io/xk6/cmd/xk6@latest | ||
xk6 build --with $(shell go list -m)=. | ||
|
||
## format: Applies Go formatting to code. | ||
format: | ||
go fmt ./... | ||
|
||
## test: Executes any unit tests. | ||
test: | ||
go test -cover -race ./... | ||
|
||
.PHONY: build clean format help test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.