Skip to content

Commit 37483bd

Browse files
committed
initial commit
0 parents  commit 37483bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4980
-0
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Bundle xk6 extensions
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Build
18+
id: build
19+
uses: szkiba/xk6bundler@v0
20+
with:
21+
with: github.com/grafana/xk6-python=/github/workspace

.github/workflows/docs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: docs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
docs:
9+
name: docs
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pages: write
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.x"
26+
27+
- name: Generate API doc
28+
run: |
29+
pip install -r docs/requirements.txt
30+
sphinx-build -b html docs build/docs
31+
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
- name: Upload artifact
35+
uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: "build/docs"
38+
- name: Deploy to GitHub Pages
39+
id: deployment
40+
uses: actions/deploy-pages@v4

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: lint
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
push:
7+
paths:
8+
- "**/*.go"
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
lint:
15+
name: lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: "1.22"
27+
28+
- name: Go linter
29+
uses: golangci/golangci-lint-action@v6
30+
with:
31+
version: v1.57
32+
args: --timeout=30m
33+
install-mode: binary

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
jobs:
8+
release:
9+
name: Bundle xk6 extensions
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Check out code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Build
21+
id: build
22+
uses: szkiba/xk6bundler@v0
23+
with:
24+
with: github.com/grafana/xk6-python=/github/workspace
25+
26+
- name: Create Release
27+
uses: softprops/action-gh-release@v2
28+
with:
29+
files: dist/*.tar.gz

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: test
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
test:
7+
strategy:
8+
matrix:
9+
platform:
10+
- ubuntu-latest
11+
- macos-latest
12+
- windows-latest
13+
runs-on: ${{matrix.platform}}
14+
steps:
15+
- name: Install Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: "1.22"
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Test
26+
run: go test -count 1 -race ./...

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
coverage.txt
3+
k6
4+
__pycache__
5+
env
6+
_build

.golangci.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# v1.57.2
2+
# Please don't remove the first line. It uses in CI to determine the golangci version
3+
run:
4+
timeout: 5m
5+
6+
issues:
7+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
8+
max-issues-per-linter: 0
9+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
10+
max-same-issues: 0
11+
12+
# We want to try and improve the comments in the k6 codebase, so individual
13+
# non-golint items from the default exclusion list will gradually be added
14+
# to the exclude-rules below
15+
exclude-use-default: false
16+
17+
exclude-rules:
18+
# Exclude duplicate code and function length and complexity checking in test
19+
# files (due to common repeats and long functions in test code)
20+
- path: _(test|gen)\.go
21+
linters:
22+
- cyclop
23+
- dupl
24+
- gocognit
25+
- funlen
26+
- lll
27+
- forcetypeassert
28+
- path: js\/modules\/k6\/html\/.*\.go
29+
text: "exported: exported "
30+
linters:
31+
- revive
32+
- path: js\/modules\/k6\/http\/.*_test\.go
33+
linters:
34+
# k6/http module's tests are quite complex because they often have several nested levels.
35+
# The module is in maintainance mode, so we don't intend to port the tests to a parallel version.
36+
- paralleltest
37+
- tparallel
38+
- linters:
39+
- staticcheck # Tracked in https://github.com/grafana/xk6-grpc/issues/14
40+
text: "The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated."
41+
- linters:
42+
- forbidigo
43+
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'
44+
45+
linters-settings:
46+
exhaustive:
47+
default-signifies-exhaustive: true
48+
cyclop:
49+
max-complexity: 25
50+
dupl:
51+
threshold: 150
52+
goconst:
53+
min-len: 10
54+
min-occurrences: 4
55+
funlen:
56+
lines: 80
57+
statements: 60
58+
forbidigo:
59+
forbid:
60+
- '^(fmt\\.Print(|f|ln)|print|println)$'
61+
# Forbid everything in os, except os.Signal and os.SyscalError
62+
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?'
63+
# Forbid everything in syscall except the uppercase constants
64+
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
65+
- '^logrus\.Logger$'
66+
67+
linters:
68+
disable-all: true
69+
enable:
70+
- asasalint
71+
- asciicheck
72+
- bidichk
73+
- bodyclose
74+
- contextcheck
75+
- cyclop
76+
- dogsled
77+
- dupl
78+
- durationcheck
79+
- errcheck
80+
- errchkjson
81+
- errname
82+
- errorlint
83+
- exhaustive
84+
- exportloopref
85+
- forbidigo
86+
- forcetypeassert
87+
- funlen
88+
- gocheckcompilerdirectives
89+
- gochecknoglobals
90+
- gocognit
91+
- goconst
92+
- gocritic
93+
- gofmt
94+
- gofumpt
95+
- goimports
96+
- gomoddirectives
97+
- goprintffuncname
98+
- gosec
99+
- gosimple
100+
- govet
101+
- importas
102+
- ineffassign
103+
- interfacebloat
104+
- lll
105+
- makezero
106+
- misspell
107+
- nakedret
108+
- nestif
109+
- nilerr
110+
- nilnil
111+
- noctx
112+
- nolintlint
113+
- nosprintfhostport
114+
- paralleltest
115+
- prealloc
116+
- predeclared
117+
- promlinter
118+
- revive
119+
- reassign
120+
- rowserrcheck
121+
- sqlclosecheck
122+
- staticcheck
123+
- stylecheck
124+
- tenv
125+
- tparallel
126+
- typecheck
127+
- unconvert
128+
- unparam
129+
- unused
130+
- usestdlibvars
131+
- wastedassign
132+
- whitespace
133+
fast: false

0 commit comments

Comments
 (0)