You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. APP := miniflux
  2. VERSION=$(shell git rev-parse --short HEAD)
  3. BUILD_DATE=`date +%FT%T%z`
  4. PKG_LIST := $(shell go list ./... | grep -v /vendor/)
  5. DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
  6. .PHONY: linux-amd64 linux-armv8 linux-armv7 linux-armv6 linux-armv5 darwin freebsd build run clean test lint integration-test clean-integration-test
  7. linux-amd64:
  8. @ go generate
  9. @ GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-amd64 main.go
  10. linux-armv8:
  11. @ go generate
  12. @ GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-armv8 main.go
  13. linux-armv7:
  14. @ go generate
  15. @ GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-armv7 main.go
  16. linux-armv6:
  17. @ go generate
  18. @ GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-armv6 main.go
  19. linux-armv5:
  20. @ go generate
  21. @ GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-linux-armv5 main.go
  22. darwin:
  23. @ go generate
  24. @ GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-darwin-amd64 main.go
  25. freebsd:
  26. @ go generate
  27. @ GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" -o $(APP)-freebsd-amd64 main.go
  28. build: linux-amd64 linux-armv8 linux-armv7 linux-armv6 linux-armv5 darwin freebsd
  29. run:
  30. @ go generate
  31. @ go run main.go -debug
  32. clean:
  33. @ rm -f $(APP)-*
  34. test:
  35. go test -cover -race ./...
  36. lint:
  37. @ golint -set_exit_status ${PKG_LIST}
  38. integration-test:
  39. psql -U postgres -c 'drop database if exists miniflux_test;'
  40. psql -U postgres -c 'create database miniflux_test;'
  41. DATABASE_URL=$(DB_URL) go run main.go -migrate
  42. DATABASE_URL=$(DB_URL) ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run main.go -create-admin
  43. go build -o miniflux-test main.go
  44. DATABASE_URL=$(DB_URL) ./miniflux-test -debug >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
  45. while ! echo exit | nc localhost 8080; do sleep 1; done >/dev/null
  46. go test -v -tags=integration miniflux.app/tests || cat /tmp/miniflux.log
  47. clean-integration-test:
  48. @ kill -9 `cat /tmp/miniflux.pid`
  49. @ rm -f /tmp/miniflux.pid /tmp/miniflux.log
  50. @ rm miniflux-test
  51. @ psql -U postgres -c 'drop database if exists miniflux_test;'