Skip to content

Commit

Permalink
Merge pull request #52 from grafana/chore/standartization
Browse files Browse the repository at this point in the history
Standartization
  • Loading branch information
oleiade authored Aug 22, 2023
2 parents 52945be + e267ef5 commit 77d9598
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 194 deletions.
23 changes: 2 additions & 21 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,6 @@ on:
- v*
pull_request:

defaults:
run:
shell: bash

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Run tests
run: |
set -x
which go
go version
export GOMAXPROCS=2
args=("-p" "2" "-race")
go test "${args[@]}" -timeout 800s ./...
checks:
uses: grafana/k6-ci/.github/workflows/all.yml@main
45 changes: 0 additions & 45 deletions .github/workflows/lint.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@

# Dependency directories (remove the comment below to include it)
# vendor/

./k6

# we use the config from the main k6's repository
# https://github.com/grafana/k6/blob/master/.golangci.yml
.golangci.yml
128 changes: 0 additions & 128 deletions .golangci.yml

This file was deleted.

1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @grafana/k6-core
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
MAKEFLAGS += --silent
GOLANGCI_CONFIG ?= .golangci.yml

all: clean lint 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 /'`"

## build: Builds a custom 'k6' with the local extension.
build:
xk6 build --with $(shell go list -m)=.

## linter-config: Checks if the linter config exists, if not, downloads it from the main k6 repository.
linter-config:
test -s "${GOLANGCI_CONFIG}" || (echo "No linter config, downloading from main k6 repository..." && curl --silent --show-error --fail --no-location https://raw.githubusercontent.com/grafana/k6/master/.golangci.yml --output "${GOLANGCI_CONFIG}")

## check-linter-version: Checks if the linter version is the same as the one specified in the linter config.
check-linter-version:
(golangci-lint version | grep "version $(shell head -n 1 .golangci.yml | tr -d '\# ')") || echo "Your installation of golangci-lint is different from the one that is specified in k6's linter config (there it's $(shell head -n 1 .golangci.yml | tr -d '\# ')). Results could be different in the CI."

## test: Executes any tests.
test:
go test -race -timeout 30s ./...

## lint: Runs the linters.
lint: linter-config check-linter-version
echo "Running linters..."
golangci-lint run --out-format=tab ./...

## check: Runs the linters and tests.
check: lint test

## clean: Removes any previously created artifacts/downloads.
clean:
echo "Cleaning up..."
rm -f ./k6
rm .golangci.yml

.PHONY: test lint check build clean linter-config check-linter-version

0 comments on commit 77d9598

Please sign in to comment.