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 29
Enable build via GitHub Actions #12
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,42 @@ | ||
name: Build | ||
|
||
on: | ||
# Enable manually triggering this workflow via the API or web UI | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
jobs: | ||
build-with-xk6: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Get module name | ||
run: | | ||
echo "::set-output name=Module::$(go list -m)" | ||
id: module-name | ||
- name: Verify builds with xk6 | ||
run: | | ||
go install go.k6.io/xk6/cmd/xk6@latest | ||
xk6 build --with ${{ steps.module-name.outputs.Module }}=. | ||
|
||
run-unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Run unit tests | ||
run: go test -v -cover -race ./... |
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,47 @@ | ||
name: Lint | ||
|
||
on: | ||
# Enable manually triggering this workflow via the API or web UI | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
jobs: | ||
check-modules: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Check module dependencies | ||
run: | | ||
go version | ||
test -z "$(go mod tidy && git status go.* --porcelain)" | ||
go mod verify | ||
|
||
run-golangci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Retrieve golangci-lint version | ||
run: | | ||
echo "::set-output name=Version::$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')" | ||
id: version | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||
version: ${{ steps.version.outputs.Version }} | ||
only-new-issues: true |
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 |
---|---|---|
@@ -1 +1,8 @@ | ||
k6 | ||
k6.exe | ||
|
||
.DS_Store | ||
.idea | ||
.vscode | ||
|
||
vendor |
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,84 @@ | ||
# v1.47.2 | ||
# Please don't remove the first line. It is used 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 added | ||
# 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 | ||
- funlen | ||
- gocognit | ||
- lll | ||
- linters: | ||
- paralleltest # false positive: https://github.com/kunwardeep/paralleltest/issues/8. | ||
text: "does not use range value in test Run" | ||
|
||
linters-settings: | ||
cyclop: | ||
max-complexity: 25 | ||
dupl: | ||
threshold: 150 | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
funlen: | ||
lines: 80 | ||
statements: 60 | ||
goconst: | ||
min-len: 10 | ||
min-occurrences: 4 | ||
govet: | ||
check-shadowing: true | ||
maligned: | ||
suggest-new: true | ||
nolintlint: | ||
# Disable to ensure that nolint directives don't have a leading space. Default is true. | ||
allow-leading-space: false | ||
|
||
linters: | ||
enable-all: true | ||
disable: | ||
- decorder | ||
- execinquery | ||
- exhaustivestruct | ||
- exhaustruct | ||
- gci | ||
- gochecknoinits | ||
- gocyclo # replaced by cyclop since it also calculates the package complexity | ||
- godot | ||
- godox | ||
- goerr113 # most of the errors here are meant for humans | ||
- goheader | ||
- golint # this linter is deprecated | ||
- gomnd | ||
- gomodguard | ||
- grouper | ||
- interfacer # deprecated | ||
- ireturn | ||
- maintidx | ||
- maligned # replaced by govet 'fieldalignment' | ||
- nlreturn | ||
- nonamedreturns | ||
- nosnakecase | ||
- scopelint # deprecated, replaced by exportloopref | ||
- tagliatelle | ||
- testpackage | ||
- thelper | ||
- varnamelen | ||
- wrapcheck # a little bit too much for k6, maybe after https://github.com/tomarrell/wrapcheck/issues/2 is fixed | ||
- wsl | ||
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,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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,8 @@ | |
> It may also break in the future as xk6 evolves. USE AT YOUR OWN RISK! | ||
> Any issues with the tool should be raised [here](https://github.com/grafana/xk6-amqp/issues). | ||
|
||
</br> | ||
</br> | ||
|
||
<div align="center"> | ||
|
||
# xk6-amqp | ||
AMQP xk6 plugin. Built for [k6](https://go.k6.io/k6) using [xk6](https://github.com/grafana/xk6). | ||
|
||
</div> | ||
A k6 extension for publishing and consuming of messages [AMQP](https://www.amqp.org/) queues and exchanges. | ||
|
||
## Build | ||
|
||
|
@@ -23,24 +16,24 @@ To build a `k6` binary with this extension, first ensure you have the prerequisi | |
|
||
Then: | ||
|
||
1. Download `xk6`: | ||
1. Download [xk6](https://github.com/grafana/xk6): | ||
```bash | ||
$ go install go.k6.io/xk6/cmd/xk6@latest | ||
``` | ||
|
||
2. Build the binary: | ||
2. [Build the k6 binary](https://github.com/grafana/xk6#command-usage): | ||
```bash | ||
$ xk6 build --with github.com/grafana/xk6-amqp@latest | ||
``` | ||
## Development | ||
To make development a little smoother, use the `Makefile` in the root folder. The default target will format your code, run tests, and create a `k6` binary with your local code rather than from GitHub. | ||
|
||
To make development a little smoother, you may run the build script provided in the root folder. It will create a k6 binary with your local code rather than from GitHub. | ||
|
||
```bash | ||
$ ./build.sh && ./k6 run my-test-script.js | ||
```shell | ||
git clone [email protected]:grafana/xk6-amqp.git | ||
cd xk6-amqp | ||
make | ||
``` | ||
|
||
|
||
## Example | ||
|
||
```javascript | ||
|
@@ -125,4 +118,4 @@ default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 | |
|
||
``` | ||
|
||
Inspect examples folder for more details. | ||
Inspect examples folder for more details. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to update this list with the one from the current k6
master
branch - maybe just copy the whole file ;)