From 623a9eb4bf1fffb2b673d0c86e9e8637643b4a1c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 10 Nov 2020 04:54:59 +0800 Subject: [PATCH] `make test-instance` Support for MacOS & different architectures (#450) detect arch only on linux fix `make test-instance:` Support for MacOS & different architectures Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/450 Reviewed-by: mrsdizzie Reviewed-by: Andrew Thornton Co-Authored-By: 6543 <6543@obermui.de> Co-Committed-By: 6543 <6543@obermui.de> --- Makefile | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ad589e9..48140c6 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,30 @@ GITEA_SDK_TEST_URL ?= http://localhost:3000 GITEA_SDK_TEST_USERNAME ?= test01 GITEA_SDK_TEST_PASSWORD ?= test01 + +GITEA_DL := https://dl.gitea.io/gitea/master/gitea-master- +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + GITEA_DL := $(GITEA_DL)linux- + + UNAME_P := $(shell uname -p) + ifeq ($(UNAME_P),unknown) + GITEA_DL := $(GITEA_DL)amd64 + endif + ifeq ($(UNAME_P),x86_64) + GITEA_DL := $(GITEA_DL)amd64 + endif + ifneq ($(filter %86,$(UNAME_P)),) + GITEA_DL := $(GITEA_DL)386 + endif + ifneq ($(filter arm%,$(UNAME_P)),) + GITEA_DL := $(GITEA_DL)arm-5 + endif +endif +ifeq ($(UNAME_S),Darwin) + GITEA_DL := $(GITEA_DL)darwin-10.6-amd64 +endif + .PHONY: all all: clean test build @@ -57,7 +81,7 @@ test: test-instance: rm -f -r ${WORK_DIR}/test 2> /dev/null; \ mkdir -p ${WORK_DIR}/test/conf/ ${WORK_DIR}/test/data/ - wget "https://dl.gitea.io/gitea/master/gitea-master-linux-amd64" -O ${WORK_DIR}/test/gitea-master; \ + wget ${GITEA_DL} -O ${WORK_DIR}/test/gitea-master; \ chmod +x ${WORK_DIR}/test/gitea-master; \ echo "[security]" > ${WORK_DIR}/test/conf/app.ini; \ echo "INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NTg4MzY4ODB9.LoKQyK5TN_0kMJFVHWUW0uDAyoGjDP6Mkup4ps2VJN4" >> ${WORK_DIR}/test/conf/app.ini; \