2017-11-28 06:30:04 +01:00
|
|
|
APP := miniflux
|
2018-01-05 07:04:18 +01:00
|
|
|
VERSION=$(shell git rev-parse --short HEAD)
|
|
|
|
BUILD_DATE=`date +%FT%T%z`
|
2017-11-28 06:30:04 +01:00
|
|
|
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
|
|
|
|
DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2017-12-27 21:17:01 +01:00
|
|
|
.PHONY: linux linux-arm darwin build run clean test lint integration-test clean-integration-test
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2017-12-27 21:17:01 +01:00
|
|
|
linux:
|
2017-11-20 06:10:04 +01:00
|
|
|
@ go generate
|
2018-01-05 07:04:18 +01:00
|
|
|
@ GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/miniflux/miniflux/version.Version=$(VERSION)' -X 'github.com/miniflux/miniflux/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-amd64 main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2017-12-27 21:17:01 +01:00
|
|
|
linux-arm:
|
|
|
|
@ go generate
|
2018-01-05 07:04:18 +01:00
|
|
|
@ GOOS=linux GOARCH=arm64 go build -ldflags="-X 'github.com/miniflux/miniflux/version.Version=$(VERSION)' -X 'github.com/miniflux/miniflux/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-arm64 main.go
|
|
|
|
@ GOOS=linux GOARCH=arm go build -ldflags="-X 'github.com/miniflux/miniflux/version.Version=$(VERSION)' -X 'github.com/miniflux/miniflux/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-arm main.go
|
2017-12-27 21:17:01 +01:00
|
|
|
|
|
|
|
darwin:
|
2017-11-20 06:10:04 +01:00
|
|
|
@ go generate
|
2018-01-05 07:04:18 +01:00
|
|
|
@ GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'github.com/miniflux/miniflux/version.Version=$(VERSION)' -X 'github.com/miniflux/miniflux/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-darwin-amd64 main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2017-12-27 21:17:01 +01:00
|
|
|
build: linux linux-arm darwin
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
run:
|
|
|
|
@ go generate
|
|
|
|
@ go run main.go
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@ rm -f $(APP)-*
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test -cover -race ./...
|
2017-11-25 19:40:23 +01:00
|
|
|
|
2017-11-28 06:30:04 +01:00
|
|
|
lint:
|
|
|
|
@ golint -set_exit_status ${PKG_LIST}
|
|
|
|
|
2017-11-25 19:40:23 +01:00
|
|
|
integration-test:
|
|
|
|
psql -U postgres -c 'drop database if exists miniflux_test;'
|
|
|
|
psql -U postgres -c 'create database miniflux_test;'
|
|
|
|
DATABASE_URL=$(DB_URL) go run main.go -migrate
|
|
|
|
DATABASE_URL=$(DB_URL) ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run main.go -create-admin
|
|
|
|
go build -o miniflux-test main.go
|
|
|
|
DATABASE_URL=$(DB_URL) ./miniflux-test >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
|
|
|
|
while ! echo exit | nc localhost 8080; do sleep 1; done >/dev/null
|
|
|
|
go test -v -tags=integration || cat /tmp/miniflux.log
|
|
|
|
|
|
|
|
clean-integration-test:
|
|
|
|
@ kill -9 `cat /tmp/miniflux.pid`
|
|
|
|
@ rm -f /tmp/miniflux.pid /tmp/miniflux.log
|
|
|
|
@ rm miniflux-test
|
|
|
|
@ psql -U postgres -c 'drop database if exists miniflux_test;'
|