From e10778c432f49ac7ccd86c9a2c7f130a055c0c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 16 Aug 2021 11:48:11 +0200 Subject: [PATCH] ci: add Jenkinsfile that runs lint and test targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a simple `Jenkinsfile` that runs `make lint` and `make test`. Had to also add a `deps` target that runs `lint-install` to install missing `golangci-lint`. Jobs folder: https://ci.status.im/job/go-waku/ Resolves: https://github.com/status-im/go-waku/issues/11 Signed-off-by: Jakub SokoĊ‚owski --- Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++ Makefile | 7 ++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..0f0026a4 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,35 @@ +pipeline { + agent { + label 'linux' + } + + options { + timestamps() + buildDiscarder(logRotator( + numToKeepStr: '10', + daysToKeepStr: '30', + )) + } + + environment { + GOPATH = "${env.HOME}/go" + PATH = "${env.PATH}:${env.GOPATH}/bin" + } + + stages { + stage('Deps') { + steps { sh 'make deps' } + } + + stage('Lint') { + steps { sh 'make lint' } + } + + stage('Test') { + steps { sh 'make test' } + } + } + post { + always { cleanWs() } + } +} diff --git a/Makefile b/Makefile index 58d74210..546d2b82 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,17 @@ all: build +deps: lint-install + build: go build -o build/waku waku.go +lint-install: + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ + bash -s -- -b $(shell go env GOPATH)/bin v1.41.1 + lint: @echo "lint" @golangci-lint --exclude=SA1019 run ./... --deadline=5m test: go test -v -failfast ./... -