2017-11-28 00:30:04 -05:00
|
|
|
APP := miniflux
|
2019-03-14 23:54:05 -04:00
|
|
|
DOCKER_IMAGE := miniflux/miniflux
|
2018-10-29 01:22:48 -04: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 00:30:04 -05:00
|
|
|
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
|
|
|
|
DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
|
2017-11-20 00:10:04 -05:00
|
|
|
|
2019-10-21 22:10:17 -04:00
|
|
|
export PGPASSWORD := postgres
|
2018-12-28 16:58:01 -05:00
|
|
|
export GO111MODULE=on
|
|
|
|
|
2019-03-14 23:54:05 -04:00
|
|
|
.PHONY: generate \
|
|
|
|
miniflux \
|
|
|
|
linux-amd64 \
|
|
|
|
linux-armv8 \
|
|
|
|
linux-armv7 \
|
|
|
|
linux-armv6 \
|
|
|
|
linux-armv5 \
|
|
|
|
linux-x86 \
|
|
|
|
darwin-amd64 \
|
|
|
|
freebsd-amd64 \
|
|
|
|
freebsd-x86 \
|
|
|
|
openbsd-amd64 \
|
|
|
|
openbsd-x86 \
|
|
|
|
netbsd-x86 \
|
|
|
|
netbsd-amd64 \
|
|
|
|
windows-amd64 \
|
|
|
|
windows-x86 \
|
|
|
|
build \
|
|
|
|
run \
|
|
|
|
clean \
|
|
|
|
test \
|
|
|
|
lint \
|
|
|
|
integration-test \
|
|
|
|
clean-integration-test \
|
2019-11-27 01:22:55 -05:00
|
|
|
docker-image \
|
2019-03-14 23:54:05 -04:00
|
|
|
docker-images \
|
|
|
|
docker-manifest
|
2018-12-02 14:09:06 -05:00
|
|
|
|
|
|
|
generate:
|
2018-12-28 16:58:01 -05:00
|
|
|
@ go generate -mod=vendor
|
2017-11-20 00:10:04 -05:00
|
|
|
|
2018-12-02 16:35:13 -05:00
|
|
|
miniflux: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ go build -ldflags=$(LD_FLAGS) -o $(APP) main.go
|
2018-12-02 16:35:13 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
linux-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-amd64 main.go
|
2018-09-16 22:14:44 -04:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
linux-armv8: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=arm64 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv8 main.go
|
2018-09-16 22:14:44 -04:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
linux-armv7: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=arm GOARM=7 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv7 main.go
|
2018-09-16 22:14:44 -04:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
linux-armv6: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=arm GOARM=6 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv6 main.go
|
2017-12-27 15:17:01 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
linux-armv5: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=arm GOARM=5 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-armv5 main.go
|
2017-11-20 00:10:04 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
darwin-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=darwin GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-darwin-amd64 main.go
|
2018-03-18 23:44:13 -04:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
freebsd-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=freebsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-amd64 main.go
|
2018-10-23 22:29:50 -04:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
openbsd-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=openbsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-openbsd-amd64 main.go
|
2018-12-01 21:11:25 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
windows-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=windows GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-windows-amd64 main.go
|
2017-11-20 00:10:04 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
build: linux-amd64 linux-armv8 linux-armv7 linux-armv6 linux-armv5 darwin-amd64 freebsd-amd64 openbsd-amd64 windows-amd64
|
|
|
|
|
2019-01-01 16:22:45 -05:00
|
|
|
# NOTE: unsupported targets
|
|
|
|
netbsd-amd64: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=netbsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-netbsd-amd64 main.go
|
2019-03-14 23:54:05 -04:00
|
|
|
|
2019-01-01 16:22:45 -05:00
|
|
|
linux-x86: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=linux GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-linux-x86 main.go
|
2019-01-01 16:22:45 -05:00
|
|
|
|
|
|
|
freebsd-x86: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=freebsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-x86 main.go
|
2019-01-01 16:22:45 -05:00
|
|
|
|
|
|
|
netbsd-x86: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=netbsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-netbsd-x86 main.go
|
2019-01-01 16:22:45 -05:00
|
|
|
|
|
|
|
openbsd-x86: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=openbsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-freebsd-x86 main.go
|
2019-01-01 16:22:45 -05:00
|
|
|
|
|
|
|
windows-x86: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ GOOS=windows GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-windows-x86 main.go
|
2019-01-01 16:22:45 -05:00
|
|
|
|
2018-12-02 14:09:06 -05:00
|
|
|
run: generate
|
2020-04-25 23:55:33 -04:00
|
|
|
@ go run main.go -debug
|
2017-11-20 00:10:04 -05:00
|
|
|
|
|
|
|
clean:
|
2018-12-02 16:35:13 -05:00
|
|
|
@ rm -f $(APP)-* $(APP)
|
2017-11-20 00:10:04 -05:00
|
|
|
|
|
|
|
test:
|
2020-04-25 23:55:33 -04:00
|
|
|
go test -cover -race -count=1 ./...
|
2017-11-25 13:40:23 -05:00
|
|
|
|
2017-11-28 00:30:04 -05:00
|
|
|
lint:
|
2019-10-21 22:10:17 -04:00
|
|
|
golint -set_exit_status ${PKG_LIST}
|
2017-11-28 00:30:04 -05:00
|
|
|
|
2017-11-25 13:40:23 -05:00
|
|
|
integration-test:
|
|
|
|
psql -U postgres -c 'drop database if exists miniflux_test;'
|
|
|
|
psql -U postgres -c 'create database miniflux_test;'
|
2020-04-25 23:55:33 -04:00
|
|
|
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
|
2018-01-29 23:58:11 -05:00
|
|
|
DATABASE_URL=$(DB_URL) ./miniflux-test -debug >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
|
2017-11-25 13:40:23 -05:00
|
|
|
while ! echo exit | nc localhost 8080; do sleep 1; done >/dev/null
|
2020-04-25 23:55:33 -04:00
|
|
|
go test -v -tags=integration -count=1 miniflux.app/tests
|
2017-11-25 13:40:23 -05: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;'
|
2019-03-14 23:54:05 -04:00
|
|
|
|
2019-11-27 01:22:55 -05:00
|
|
|
docker-image:
|
2019-12-28 14:23:25 -05:00
|
|
|
docker build -t $(DOCKER_IMAGE):$(VERSION) \
|
|
|
|
--build-arg APP_VERSION=$(VERSION) \
|
|
|
|
--build-arg APP_ARCH=amd64 \
|
|
|
|
--build-arg BASE_IMAGE_ARCH=amd64 .
|
2019-11-27 01:22:55 -05:00
|
|
|
|
2019-03-14 23:54:05 -04:00
|
|
|
docker-images:
|
2019-12-28 14:23:25 -05:00
|
|
|
docker build -t $(DOCKER_IMAGE):amd64-$(VERSION) \
|
|
|
|
--build-arg APP_VERSION=$(VERSION) \
|
|
|
|
--build-arg APP_ARCH=amd64 \
|
|
|
|
--build-arg BASE_IMAGE_ARCH=amd64 .
|
|
|
|
docker tag $(DOCKER_IMAGE):amd64-$(VERSION) $(DOCKER_IMAGE):amd64-latest
|
|
|
|
|
|
|
|
docker build -t $(DOCKER_IMAGE):arm32v6-$(VERSION) \
|
|
|
|
--build-arg APP_VERSION=$(VERSION) \
|
|
|
|
--build-arg APP_ARCH=armv6 \
|
|
|
|
--build-arg BASE_IMAGE_ARCH=arm32v6 .
|
|
|
|
docker tag $(DOCKER_IMAGE):arm32v6-$(VERSION) $(DOCKER_IMAGE):arm32v6-latest
|
|
|
|
|
|
|
|
docker build -t $(DOCKER_IMAGE):arm32v7-$(VERSION) \
|
|
|
|
--build-arg APP_VERSION=$(VERSION) \
|
|
|
|
--build-arg APP_ARCH=armv7 \
|
|
|
|
--build-arg BASE_IMAGE_ARCH=arm32v7 .
|
|
|
|
docker tag $(DOCKER_IMAGE):arm32v7-$(VERSION) $(DOCKER_IMAGE):arm32v7-latest
|
|
|
|
|
|
|
|
docker build -t $(DOCKER_IMAGE):arm64v8-$(VERSION) \
|
|
|
|
--build-arg APP_VERSION=$(VERSION) \
|
|
|
|
--build-arg APP_ARCH=armv8 \
|
|
|
|
--build-arg BASE_IMAGE_ARCH=arm64v8 .
|
|
|
|
docker tag $(DOCKER_IMAGE):arm64v8-$(VERSION) $(DOCKER_IMAGE):arm64v8-latest
|
2019-03-14 23:54:05 -04:00
|
|
|
|
|
|
|
docker-manifest:
|
|
|
|
for version in $(VERSION) latest; do \
|
|
|
|
docker push $(DOCKER_IMAGE):amd64-$${version} && \
|
|
|
|
docker push $(DOCKER_IMAGE):arm32v6-$${version} && \
|
2019-09-22 13:16:59 -04:00
|
|
|
docker push $(DOCKER_IMAGE):arm32v7-$${version} && \
|
2019-03-14 23:54:05 -04:00
|
|
|
docker push $(DOCKER_IMAGE):arm64v8-$${version} && \
|
|
|
|
docker manifest create --amend $(DOCKER_IMAGE):$${version} \
|
|
|
|
$(DOCKER_IMAGE):amd64-$${version} \
|
|
|
|
$(DOCKER_IMAGE):arm32v6-$${version} \
|
2019-09-22 13:16:59 -04:00
|
|
|
$(DOCKER_IMAGE):arm32v7-$${version} \
|
2019-03-14 23:54:05 -04:00
|
|
|
$(DOCKER_IMAGE):arm64v8-$${version} && \
|
|
|
|
docker manifest annotate $(DOCKER_IMAGE):$${version} \
|
|
|
|
$(DOCKER_IMAGE):arm32v6-$${version} --os linux --arch arm --variant v6 && \
|
2019-09-22 13:16:59 -04:00
|
|
|
docker manifest annotate $(DOCKER_IMAGE):$${version} \
|
|
|
|
$(DOCKER_IMAGE):arm32v7-$${version} --os linux --arch arm --variant v7 && \
|
2019-03-14 23:54:05 -04:00
|
|
|
docker manifest annotate $(DOCKER_IMAGE):$${version} \
|
|
|
|
$(DOCKER_IMAGE):arm64v8-$${version} --os linux --arch arm64 --variant v8 && \
|
|
|
|
docker manifest push --purge $(DOCKER_IMAGE):$${version} ;\
|
|
|
|
done
|