-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use k6foundry for building * remove unnecessary step in ci * do not run release jobs on pull requests --------- Signed-off-by: Pablo Chacin <[email protected]>
- Loading branch information
1 parent
c09451f
commit 0b160fa
Showing
40 changed files
with
3,956 additions
and
2,880 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,8 @@ xk6 build [<k6_version>] | |
- `--with` can be used multiple times to add extensions by specifying the Go module name and optionally its version, similar to `go get`. Module name is required, but specific version and/or local replacement are optional. For an up-to-date list of k6 extensions, head to our [extensions page](https://k6.io/docs/extensions/). | ||
- `--replace` can be used multiple times to add replacements by specifying the Go module name and the replacement module, similar to `go mod edit -replace=`. Version of the replacement can be specified with the `@version` suffix in the replacement path. | ||
|
||
Versions can be anything compatible with `go get`. | ||
|
||
Examples: | ||
|
||
```bash | ||
|
@@ -167,36 +169,16 @@ xk6 run -u 10 -d 10s test.js | |
|
||
The race detector can be enabled by setting the env variable `XK6_RACE_DETECTOR=1` or through the `XK6_BUILD_FLAGS` env variable. | ||
|
||
|
||
## Library usage | ||
|
||
```go | ||
builder := xk6.Builder{ | ||
K6Version: "v0.35.0", | ||
Extensions: []xk6.Dependency{ | ||
{ | ||
PackagePath: "github.com/grafana/xk6-browser", | ||
Version: "v0.1.1", | ||
}, | ||
}, | ||
} | ||
err := builder.Build(context.Background(), "./k6") | ||
``` | ||
|
||
Versions can be anything compatible with `go get`. | ||
|
||
|
||
## Environment variables | ||
|
||
Because the subcommands and flags are constrained to benefit rapid extension prototyping, xk6 does read some environment variables to take cues for its behavior and/or configuration when there is no room for flags. | ||
|
||
- `K6_VERSION` sets the version of k6 to build. | ||
- `XK6_BUILD_FLAGS` sets any go build flags if needed. Defaults to '-ldflags=-w -s'. | ||
- `XK6_RACE_DETECTOR=1` enables the Go race detector in the build. | ||
- `XK6_BUILD_FLAGS` sets any go build flags if needed. Defaults to '-ldflags=-w -s -trim'. | ||
- `XK6_RACE_DETECTOR=1` enables the Go race detector in the build. Forces `GCO_ENABLED=1`. | ||
- `XK6_SKIP_CLEANUP=1` causes xk6 to leave build artifacts on disk after exiting. | ||
- `XK6_K6_REPO` optionally sets the path to the main k6 repository. This is useful when building with k6 forks. | ||
|
||
|
||
## Keeping dependencies in sync | ||
|
||
We recommend extension maintainers to keep dependencies in common with k6 core in the same version k6 core uses. This guarantees binary compatibility of the JS runtime, and ensures uses will not have to face unforeseen build-time errors when compiling several extensions together with xk6. | ||
|
@@ -207,6 +189,21 @@ The [`go-depsync`](https://github.com/grafana/go-depsync/) tool can check for th | |
/your/extension$ go-depsync --parent go.k6.io/k6 | ||
``` | ||
|
||
## Library usage | ||
|
||
> !Breaking change: since v0.14.0 `xk6.Builder.Build` function no longer reads environment variables to complete missing attributes. Use `xk6.FromOSEnv()` to create a builder from environment variables and then complete or override attributes as needed. | ||
```go | ||
// create builder with defaults from environment variables | ||
builder := xk6.FromOSEnv() | ||
|
||
// complete/override attributes | ||
builder.K6Version = "v0.35.0", | ||
builder.Extensions = []string{"github.com/grafana/[email protected]"}, | ||
|
||
err := builder.Build(context.Background(), log. "./k6") | ||
``` | ||
|
||
--- | ||
|
||
> This project originally forked from the [xcaddy](https://github.com/caddyserver/xcaddy) project. **Thank you!** |
Oops, something went wrong.