2017-11-28 06:30:04 +01:00
|
|
|
APP := miniflux
|
2018-10-29 06:22:48 +01:00
|
|
|
VERSION := $(shell git rev-parse --short HEAD)
|
|
|
|
BUILD_DATE := `date +%FT%T%z`
|
|
|
|
LD_FLAGS := "-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'"
|
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
|
|
|
|
2018-12-28 22:58:01 +01:00
|
|
|
export GO111MODULE=on
|
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
.PHONY: generate
|
2018-12-02 22:35:13 +01:00
|
|
|
.PHONY: miniflux
|
2018-12-02 20:09:06 +01:00
|
|
|
.PHONY: linux-amd64
|
|
|
|
.PHONY: linux-armv8
|
|
|
|
.PHONY: linux-armv7
|
|
|
|
.PHONY: linux-armv6
|
|
|
|
.PHONY: linux-armv5
|
|
|
|
.PHONY: darwin-amd64
|
|
|
|
.PHONY: freebsd-amd64
|
|
|
|
.PHONY: openbsd-amd64
|
|
|
|
.PHONY: windows-amd64
|
2019-01-01 22:22:45 +01:00
|
|
|
.PHONY: netbsd-amd64
|
|
|
|
.PHONY: linux-x86
|
|
|
|
.PHONY: darwin-x86
|
|
|
|
.PHONY: freebsd-x86
|
|
|
|
.PHONY: netbsd-x86
|
|
|
|
.PHONY: openbsd-x86
|
|
|
|
.PHONY: windows-x86
|
2018-12-02 20:09:06 +01:00
|
|
|
.PHONY: build run clean test lint integration-test clean-integration-test
|
|
|
|
|
|
|
|
generate:
|
2018-12-28 22:58:01 +01:00
|
|
|
@ go generate -mod=vendor
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2018-12-02 22:35:13 +01:00
|
|
|
miniflux: generate
|
|
|
|
@ go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP) main.go
|
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
linux-amd64: generate
|
|
|
|
@ GOOS=linux GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-amd64 main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
linux-armv8: generate
|
|
|
|
@ GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv8 main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
linux-armv7: generate
|
|
|
|
@ GOOS=linux GOARCH=arm GOARM=7 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv7 main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
linux-armv6: generate
|
|
|
|
@ GOOS=linux GOARCH=arm GOARM=6 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv6 main.go
|
2017-12-27 21:17:01 +01:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
linux-armv5: generate
|
|
|
|
@ GOOS=linux GOARCH=arm GOARM=5 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv5 main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
darwin-amd64: generate
|
|
|
|
@ GOOS=darwin GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-darwin-amd64 main.go
|
2018-03-19 04:44:13 +01:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
freebsd-amd64: generate
|
|
|
|
@ GOOS=freebsd GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-amd64 main.go
|
2018-10-24 04:29:50 +02:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
openbsd-amd64: generate
|
|
|
|
@ GOOS=openbsd GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-openbsd-amd64 main.go
|
2018-12-02 03:11:25 +01:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
windows-amd64: generate
|
|
|
|
@ GOOS=windows GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-windows-amd64 main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
build: linux-amd64 linux-armv8 linux-armv7 linux-armv6 linux-armv5 darwin-amd64 freebsd-amd64 openbsd-amd64 windows-amd64
|
|
|
|
|
2019-01-01 22:22:45 +01:00
|
|
|
# NOTE: unsupported targets
|
|
|
|
netbsd-amd64: generate
|
|
|
|
@ GOOS=netbsd GOARCH=amd64 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-netbsd-amd64 main.go
|
|
|
|
|
|
|
|
linux-x86: generate
|
|
|
|
@ GOOS=linux GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-linux-x86 main.go
|
|
|
|
|
|
|
|
darwin-x86: generate
|
|
|
|
@ GOOS=darwin GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-darwin-x86 main.go
|
|
|
|
|
|
|
|
freebsd-x86: generate
|
|
|
|
@ GOOS=freebsd GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-x86 main.go
|
|
|
|
|
|
|
|
netbsd-x86: generate
|
|
|
|
@ GOOS=netbsd GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-netbsd-x86 main.go
|
|
|
|
|
|
|
|
openbsd-x86: generate
|
|
|
|
@ GOOS=openbsd GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-x86 main.go
|
|
|
|
|
|
|
|
windows-x86: generate
|
|
|
|
@ GOOS=windows GOARCH=386 go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP)-windows-x86 main.go
|
|
|
|
|
2018-12-02 20:09:06 +01:00
|
|
|
run: generate
|
2018-12-28 22:58:01 +01:00
|
|
|
@ go run -mod=vendor main.go -debug
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
clean:
|
2018-12-02 22:35:13 +01:00
|
|
|
@ rm -f $(APP)-* $(APP)
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
test:
|
2018-12-28 22:58:01 +01:00
|
|
|
go test -mod=vendor -cover -race -count=1 ./...
|
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;'
|
2018-12-28 22:58:01 +01:00
|
|
|
DATABASE_URL=$(DB_URL) go run -mod=vendor main.go -migrate
|
|
|
|
DATABASE_URL=$(DB_URL) ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run -mod=vendor main.go -create-admin
|
|
|
|
go build -mod=vendor -o miniflux-test main.go
|
2018-01-30 05:58:11 +01:00
|
|
|
DATABASE_URL=$(DB_URL) ./miniflux-test -debug >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
|
2017-11-25 19:40:23 +01:00
|
|
|
while ! echo exit | nc localhost 8080; do sleep 1; done >/dev/null
|
2018-12-28 22:58:01 +01:00
|
|
|
go test -mod=vendor -v -tags=integration -count=1 miniflux.app/tests || cat /tmp/miniflux.log
|
2017-11-25 19:40:23 +01:00
|
|
|
|
|
|
|
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;'
|