diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..88d4989 --- /dev/null +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/build/ci/.drone.yml b/build/ci/.drone.yml index 90e36ad..71d0879 100644 --- a/build/ci/.drone.yml +++ b/build/ci/.drone.yml @@ -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: {} \ No newline at end of file + temp: {} diff --git a/build/ci/.gitlab-ci.yml b/build/ci/.gitlab-ci.yml index 38f6c4a..5f301b1 100644 --- a/build/ci/.gitlab-ci.yml +++ b/build/ci/.gitlab-ci.yml @@ -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 \ No newline at end of file