Add format and check targets + integrate into CI
This commit is contained in:
parent
3b1dfb7562
commit
980f2f7684
@ -2,6 +2,11 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: coopcloud.tech/abra
|
name: coopcloud.tech/abra
|
||||||
steps:
|
steps:
|
||||||
|
- name: make check
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make check
|
||||||
|
|
||||||
- name: make build
|
- name: make build
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
commands:
|
commands:
|
||||||
@ -16,6 +21,7 @@ steps:
|
|||||||
accesstoken:
|
accesstoken:
|
||||||
from_secret: autono_bot_access_token
|
from_secret: autono_bot_access_token
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- make check
|
||||||
- make build
|
- make build
|
||||||
when:
|
when:
|
||||||
status:
|
status:
|
||||||
|
8
Makefile
8
Makefile
@ -4,7 +4,7 @@ GOPATH := $(shell go env GOPATH)
|
|||||||
LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'"
|
LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'"
|
||||||
VERSION := $(shell cat ./version)
|
VERSION := $(shell cat ./version)
|
||||||
|
|
||||||
all: run install build clean
|
all: run install build clean format check
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go run -ldflags=$(LDFLAGS) $(ABRA)
|
go run -ldflags=$(LDFLAGS) $(ABRA)
|
||||||
@ -17,3 +17,9 @@ build:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm '$(GOPATH)/bin/abra'
|
rm '$(GOPATH)/bin/abra'
|
||||||
|
|
||||||
|
format:
|
||||||
|
gofmt -s -w .
|
||||||
|
|
||||||
|
check:
|
||||||
|
test -z $$(gofmt -l .) || (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
|
||||||
|
Reference in New Issue
Block a user