Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
szkiba committed Sep 24, 2023
0 parents commit 7202b43
Show file tree
Hide file tree
Showing 59 changed files with 4,956 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

name: lint
on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: REUSE linter
uses: fsfe/reuse-action@v2
with:
args: lint
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: false
- name: Go linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
args: --timeout=30m
install-mode: binary
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

name: release
on:
push:
tags:
- "v*"
permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: "1.20.0"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

name: test
on: [push, pull_request, workflow_dispatch]

jobs:
test:
name: Test
strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{matrix.platform}}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Checkout code
uses: actions/checkout@v3

- name: Test
uses: magefile/mage-action@v1
with:
version: latest
args: test
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

/.bin
/dist
/build
/.k6x
/k6x
/k6
129 changes: 129 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# v1.54.1
# 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 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
- gocognit
- funlen
- lll
- linters:
- staticcheck # Tracked in https://github.com/grafana/xk6-grpc/issues/14
text: "The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated."
- 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
- 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
- interfacebloat
- 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
3 changes: 3 additions & 0 deletions .golangci.yml.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2023 Iván SZKIBA

SPDX-License-Identifier: AGPL-3.0-only
63 changes: 63 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

project_name: k6x
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos: [ 'darwin', 'linux', 'windows' ]
goarch: [ 'amd64', 'arm64' ]
ldflags:
- '-s -w -X {{.ModulePath}}/internal/cmd._version={{.Version}} -X {{.ModulePath}}/internal/cmd._appname={{.ProjectName}}'
source:
enabled: true
name_template: '{{ .ProjectName }}_{{ .Version }}_source'

archives:
- id: bundle
format: tar.gz
format_overrides:
- goos: windows
format: zip
nfpms:
- package_name: '{{.ProjectName}}'
vendor: Iván Szkiba
maintainer: Iván Szkiba <iszkiba@gmail.com>
description: |-
Automatic k6 provisioning with extensions.
license: MIT
formats: [ 'deb', 'rpm' ]
umask: 0o022
overrides:
deb:
contents:
- src: LICENSE
dst: /usr/share/doc/{{.ProjectName}}/copyright
- src: README.md
dst: /usr/share/doc/{{.ProjectName}}/README.md
rpm:
contents:
- src: LICENSE
dst: /usr/share/doc/{{.ProjectName}}/LICENSE
- src: README.md
dst: /usr/share/doc/{{.ProjectName}}/README.md

checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'

snapshot:
name_template: "{{ incpatch .Version }}-next+{{.ShortCommit}}{{if .IsGitDirty}}.dirty{{else}}{{end}}"

changelog:
sort: asc
abbrev: -1
filters:
exclude:
- '^chore:'
- '^docs:'
- '^test:'
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2023 Iván SZKIBA
#
# SPDX-License-Identifier: AGPL-3.0-only

repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.54.1
hooks:
- id: golangci-lint

- repo: https://github.com/fsfe/reuse-tool
rev: v2.1.0
hooks:
- id: reuse
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-mod-tidy
- id: go-build-mod
- id: go-test-mod
15 changes: 15 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-FileCopyrightText: 2023 Iván SZKIBA
//
// SPDX-License-Identifier: AGPL-3.0-only

export default {
printWidth: 128,
tabWidth: 2,
useTabs: false,
singleQuote: false,
trailingComma: "none",
bracketSpacing: true,
semi: false,
bracketSameLine: true,
singleAttributePerLine: false
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.formatTool": "golines",
"go.buildTags": "mage"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2023 Iván SZKIBA

SPDX-License-Identifier: AGPL-3.0-only
Loading

0 comments on commit 7202b43

Please sign in to comment.