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

Makefile 3.5 kB

9 years ago
9 years ago
Add basic integration test infrastructure (and new endpoint `/api/v1/version` for testing it) (#741) * Implement '/api/v1/version' * Cleanup and various fixes * Enhance run.sh * Add install_test.go * Add parameter utils.Config for testing handlers * Re-organize TestVersion.go * Rename functions * handling process cleanup properly * Fix missing function renaming * Cleanup the 'retry' logic * Cleanup * Remove unneeded logging code * Logging messages tweaking * Logging message tweaking * Fix logging messages * Use 'const' instead of hardwired numbers * We don't really need retries anymore * Move constant ServerHttpPort to install_test.go * Restore mistakenly removed constant * Add required comments to make the linter happy. * Fix comments and naming to address linter's complaints * Detect Gitea executale version automatically * Remove tests/run.sh, `go test` suffices. * Make `make build` a prerequisite of `make test` * Do not sleep before trying * Speedup the server pinging loop * Use defined const instead of hardwired numbers * Remove redundant error handling * Use a dedicated target for running code.gitea.io/tests * Do not make 'test' depend on 'build' target * Rectify the excluded package list * Remove redundant 'exit 1' * Change the API to allow passing test.T to test handlers * Make testing.T an embedded field * Use assert.Equal to comparing results * Add copyright info * Parametrized logging output * Use tmpdir instead * Eliminate redundant casting * Remove unneeded variable * Fix last commit * Add missing copyright info * Replace fmt.Fprintf with fmt.Fprint * rename the xtest to integration-test * Use Symlink instead of hard-link for cross-device linking * Turn debugging logs on * Follow the existing framework for APIs * Output logs only if test.v is true * Re-order import statements * Enhance the error message * Fix comment which breaks the linter's rule * Rename 'integration-test' to 'e2e-test' for saving keystrokes * Add comment to avoid possible confusion * Rename tests -> integration-tests Also change back the Makefile to use `make integration-test`. * Use tests/integration for now * tests/integration -> integrations Slightly flattened directory hierarchy is better. * Update Makefile accordingly * Fix a missing change in Makefile * govendor update code.gitea.io/sdk/gitea * Fix comment of struct fields * Fix conditional nonsense * Fix missing updates regarding version string changes * Make variable naming more consistent * Check http status code * Rectify error messages
8 years ago
Add basic integration test infrastructure (and new endpoint `/api/v1/version` for testing it) (#741) * Implement '/api/v1/version' * Cleanup and various fixes * Enhance run.sh * Add install_test.go * Add parameter utils.Config for testing handlers * Re-organize TestVersion.go * Rename functions * handling process cleanup properly * Fix missing function renaming * Cleanup the 'retry' logic * Cleanup * Remove unneeded logging code * Logging messages tweaking * Logging message tweaking * Fix logging messages * Use 'const' instead of hardwired numbers * We don't really need retries anymore * Move constant ServerHttpPort to install_test.go * Restore mistakenly removed constant * Add required comments to make the linter happy. * Fix comments and naming to address linter's complaints * Detect Gitea executale version automatically * Remove tests/run.sh, `go test` suffices. * Make `make build` a prerequisite of `make test` * Do not sleep before trying * Speedup the server pinging loop * Use defined const instead of hardwired numbers * Remove redundant error handling * Use a dedicated target for running code.gitea.io/tests * Do not make 'test' depend on 'build' target * Rectify the excluded package list * Remove redundant 'exit 1' * Change the API to allow passing test.T to test handlers * Make testing.T an embedded field * Use assert.Equal to comparing results * Add copyright info * Parametrized logging output * Use tmpdir instead * Eliminate redundant casting * Remove unneeded variable * Fix last commit * Add missing copyright info * Replace fmt.Fprintf with fmt.Fprint * rename the xtest to integration-test * Use Symlink instead of hard-link for cross-device linking * Turn debugging logs on * Follow the existing framework for APIs * Output logs only if test.v is true * Re-order import statements * Enhance the error message * Fix comment which breaks the linter's rule * Rename 'integration-test' to 'e2e-test' for saving keystrokes * Add comment to avoid possible confusion * Rename tests -> integration-tests Also change back the Makefile to use `make integration-test`. * Use tests/integration for now * tests/integration -> integrations Slightly flattened directory hierarchy is better. * Update Makefile accordingly * Fix a missing change in Makefile * govendor update code.gitea.io/sdk/gitea * Fix comment of struct fields * Fix conditional nonsense * Fix missing updates regarding version string changes * Make variable naming more consistent * Check http status code * Rectify error messages
8 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. DIST := dist
  2. IMPORT := code.gitea.io/gitea
  3. ifeq ($(OS), Windows_NT)
  4. EXECUTABLE := gitea.exe
  5. else
  6. EXECUTABLE := gitea
  7. endif
  8. BINDATA := modules/{options,public,templates}/bindata.go
  9. STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
  10. JAVASCRIPTS :=
  11. LDFLAGS := -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')" -X "main.Tags=$(TAGS)"
  12. TARGETS ?= linux/*,darwin/*,windows/*
  13. PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell go list ./... | grep -v /vendor/))
  14. SOURCES ?= $(shell find . -name "*.go" -type f)
  15. TAGS ?=
  16. ifneq ($(DRONE_TAG),)
  17. VERSION ?= $(subst v,,$(DRONE_TAG))
  18. else
  19. ifneq ($(DRONE_BRANCH),)
  20. VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
  21. else
  22. VERSION ?= master
  23. endif
  24. endif
  25. .PHONY: all
  26. all: build
  27. .PHONY: clean
  28. clean:
  29. go clean -i ./...
  30. rm -rf $(EXECUTABLE) $(DIST) $(BINDATA)
  31. .PHONY: fmt
  32. fmt:
  33. find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w
  34. .PHONY: vet
  35. vet:
  36. go vet $(PACKAGES)
  37. .PHONY: generate
  38. generate:
  39. @hash go-bindata > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  40. go get -u github.com/jteeuwen/go-bindata/...; \
  41. fi
  42. go generate $(PACKAGES)
  43. .PHONY: errcheck
  44. errcheck:
  45. @hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  46. go get -u github.com/kisielk/errcheck; \
  47. fi
  48. errcheck $(PACKAGES)
  49. .PHONY: lint
  50. lint:
  51. @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  52. go get -u github.com/golang/lint/golint; \
  53. fi
  54. for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
  55. .PHONY: integrations
  56. integrations: TAGS=bindata sqlite
  57. integrations: build
  58. go test code.gitea.io/gitea/integrations
  59. .PHONY: test
  60. test:
  61. for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
  62. .PHONY: test-mysql
  63. test-mysql:
  64. @echo "Not integrated yet!"
  65. .PHONY: test-pgsql
  66. test-pgsql:
  67. @echo "Not integrated yet!"
  68. .PHONY: check
  69. check: test
  70. .PHONY: install
  71. install: $(wildcard *.go)
  72. go install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
  73. .PHONY: build
  74. build: $(EXECUTABLE)
  75. $(EXECUTABLE): $(SOURCES)
  76. go build -i -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
  77. .PHONY: docker
  78. docker:
  79. docker run -ti --rm -v $(CURDIR):/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" webhippie/golang:edge make clean generate build
  80. docker build -t gitea/gitea:latest .
  81. .PHONY: release
  82. release: release-dirs release-build release-copy release-check
  83. .PHONY: release-dirs
  84. release-dirs:
  85. mkdir -p $(DIST)/binaries $(DIST)/release
  86. .PHONY: release-build
  87. release-build:
  88. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  89. go get -u github.com/karalabe/xgo; \
  90. fi
  91. xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets '$(TARGETS)' -out $(EXECUTABLE)-$(VERSION) .
  92. ifeq ($(CI),drone)
  93. mv /build/* $(DIST)/binaries
  94. endif
  95. .PHONY: release-copy
  96. release-copy:
  97. $(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
  98. .PHONY: release-check
  99. release-check:
  100. cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
  101. .PHONY: javascripts
  102. javascripts: public/js/index.js
  103. .IGNORE: public/js/index.js
  104. public/js/index.js: $(JAVASCRIPTS)
  105. cat $< >| $@
  106. .PHONY: stylesheets
  107. stylesheets: public/css/index.css
  108. .IGNORE: public/css/index.css
  109. public/css/index.css: $(STYLESHEETS)
  110. lessc $< $@
  111. .PHONY: assets
  112. assets: javascripts stylesheets