👷 Updated CI/CD configs by Makefile
This commit is contained in:
parent
8655ce36bf
commit
af1ebed585
|
@ -0,0 +1,25 @@
|
|||
SHELL:=/bin/bash
|
||||
PROJECT_NAME=indieauth
|
||||
VERSION=$(shell cat VERSION)
|
||||
GO_BUILD_ENV=CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
||||
GO_FILES=$(shell go list ./... | grep -v /vendor/)
|
||||
|
||||
build:
|
||||
$(GO_BUILD_ENV) go build .
|
||||
|
||||
run:
|
||||
go run .
|
||||
|
||||
clean:
|
||||
go clean
|
||||
|
||||
test:
|
||||
go test -race -cover ./...
|
||||
|
||||
dep:
|
||||
go mod download
|
||||
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: build run clean test dep lint
|
|
@ -8,17 +8,17 @@ steps:
|
|||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
commands:
|
||||
- go test -v -cover -race ./...
|
||||
commands:
|
||||
- make test
|
||||
- name: build
|
||||
image: golang
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
commands:
|
||||
- go build -ldflags "-extldflags '-static'" -o ./indieauth ./cmd/indieauth
|
||||
- make build
|
||||
depends_on:
|
||||
- test
|
||||
volumes:
|
||||
- name: deps
|
||||
temp: {}
|
||||
temp: {}
|
||||
|
|
|
@ -17,12 +17,11 @@ before_script:
|
|||
stages:
|
||||
- test
|
||||
- build
|
||||
- deploy
|
||||
|
||||
test:
|
||||
stage: test
|
||||
before_script:
|
||||
- go get gotest.tools/gotestsum
|
||||
- go install gotest.tools/gotestsum@latest
|
||||
script:
|
||||
- gotestsum --junitfile report.xml --format testname
|
||||
artifacts:
|
||||
|
@ -33,7 +32,7 @@ test:
|
|||
cover:
|
||||
stage: test
|
||||
before_script:
|
||||
- go get github.com/t-yuki/gocover-cobertura
|
||||
- go install github.com/t-yuki/gocover-cobertura@latest
|
||||
script:
|
||||
- go test -coverprofile=coverage.txt -covermode count $REPO_NAME/...
|
||||
- gocover-cobertura < coverage.txt > coverage.xml
|
||||
|
@ -44,18 +43,7 @@ cover:
|
|||
build:
|
||||
stage: build
|
||||
script:
|
||||
- go build -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/indieauth $REPO_NAME/cmd/indieauth
|
||||
- make build
|
||||
artifacts:
|
||||
paths:
|
||||
- indieauth
|
||||
|
||||
pages:
|
||||
image: alpine:latest
|
||||
stage: deploy
|
||||
script:
|
||||
- mv website public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
Loading…
Reference in New Issue