Browse Source

Added .drone.yml and refactored Makefile

pull/2010/head
Thomas Boerger 9 years ago
parent
commit
893139a643
  1. 86
      .drone.yml
  2. 3
      .gitignore
  3. 79
      Makefile

86
.drone.yml

@ -0,0 +1,86 @@
clone:
path: github.com/gogits/gogs
build:
general:
image: golang:$$GO_VERSION
environment:
- TAGS=pam sqlite cert
commands:
- apt-get update -qq && apt-get install -y libpam-dev zip
- make deps
- make test
- make build
release:
image: golang:1.5
environment:
- TAGS=pam sqlite cert
commands:
- apt-get update -qq && apt-get install -y libpam-dev zip
- make deps
- make release
when:
repo: gogits/gogs
branch: master
matrix:
GO_VERSION: 1.5
publish:
github_release:
api_key: $$GITHUB_TOKEN
files:
- dist/*.tgz
- dist/*.zip
when:
repo: gogits/gogs
event: tag
matrix:
GO_VERSION: 1.5
docker:
username: $$DOCKER_USERNAME
password: $$DOCKER_PASSWORD
email: $$DOCKER_EMAIL
repo: gogs/gogs
tag: $${TAG##v}
when:
repo: gogits/gogs
event: tag
matrix:
GO_VERSION: 1.5
docker:
username: $$DOCKER_USERNAME
password: $$DOCKER_PASSWORD
email: $$DOCKER_EMAIL
repo: gogs/gogs
tag: $${BRANCH/master/latest}
when:
repo: gogits/gogs
branch: [develop, master]
matrix:
GO_VERSION: 1.5
notify:
gitter:
webhook: https://webhooks.gitter.im/e/c52d2013f36e28b35f71
when:
repo: gogits/gogs
email:
host: $$EMAIL_HOST
port: $$EMAIL_PORT
username: $$EMAIL_USERNAME
password: $$EMAIL_PASSWORD
from: drone@gogs.io
recipients:
- u@gogs.io
when:
repo: gogits/gogs
matrix:
GO_VERSION:
- 1.3
- 1.4
- 1.5

3
.gitignore vendored

@ -36,4 +36,5 @@ docker/docker/init_gogs.sh
gogs.sublime-project gogs.sublime-project
gogs.sublime-workspace gogs.sublime-workspace
.tags* .tags*
release dist/
bin/

79
Makefile

@ -1,35 +1,56 @@
LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')" LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)" LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)"
DATA_FILES := $(shell find conf | sed 's/ /\\ /g') DATA_FILES ?= $(shell find conf | sed 's/ /\\ /g')
LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less) LESS_FILES ?= $(wildcard public/less/gogs.less public/less/_*.less)
GENERATED := modules/bindata/bindata.go public/css/gogs.css
TAGS = "" GENERATED ?= modules/bindata/bindata.go public/css/gogs.css
RELEASE_ROOT = "release" TAGS ?=
RELEASE_GOGS = "release/gogs"
NOW = $(shell date -u '+%Y%m%d%I%M%S')
.PHONY: build pack release bindata clean DIST := dist
BIN := bin
FILES := templates public scripts LICENSE README.md README_ZH.md
RELEASES ?= $(DIST)/gogs-linux-amd64.tgz \
$(DIST)/gogs-linux-386.tgz \
$(DIST)/gogs-linux-arm.tgz \
$(DIST)/gogs-darwin-amd64.tgz \
$(DIST)/gogs-darwin-386.tgz \
$(DIST)/gogs-darwin-arm.tgz \
$(DIST)/gogs-freebsd-amd64.tgz \
$(DIST)/gogs-freebsd-386.tgz \
$(DIST)/gogs-freebsd-arm.tgz \
$(DIST)/gogs-openbsd-amd64.tgz \
$(DIST)/gogs-openbsd-386.tgz \
$(DIST)/gogs-openbsd-arm.tgz \
$(DIST)/gogs-windows-amd64.zip \
$(DIST)/gogs-windows-386.zip
.PHONY: clean test deps gofmt govet build install
.IGNORE: public/css/gogs.css .IGNORE: public/css/gogs.css
build: $(GENERATED) clean:
go install -v -ldflags '$(LDFLAGS)' -tags '$(TAGS)' go clean -i ./...
cp '$(GOPATH)/bin/gogs' . rm -rf $(BIN) $(DIST)
test:
@echo "Tests are not integrated!" # go test -tags '$(TAGS)' -cover ./...
deps:
go get -tags '$(TAGS)' -d -t ./...
gofmt:
go fmt ./...
govet: govet:
go tool vet -composites=false -methods=false -structtags=false . go tool vet -composites=false -methods=false -structtags=false .
pack: build: install
rm -rf $(RELEASE_GOGS) cp $(GOPATH)/bin/gogs .
mkdir -p $(RELEASE_GOGS)
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
release: build pack install:
go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
bindata: modules/bindata/bindata.go bindata: modules/bindata/bindata.go
@ -41,8 +62,22 @@ less: public/css/gogs.css
public/css/gogs.css: $(LESS_FILES) public/css/gogs.css: $(LESS_FILES)
lessc $< $@ lessc $< $@
clean: release: $(RELEASES)
go clean -i ./...
$(BIN)/%/gogs/gogs: GOOS=$(firstword $(subst -, ,$*))
$(BIN)/%/gogs/gogs: GOARCH=$(subst .exe,,$(word 2,$(subst -, ,$*)))
$(BIN)/%/gogs/gogs:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)' -o $@
cp -r $(FILES) $(BIN)/$*/gogs
$(DIST)/gogs-%.tgz: GOOS=$(firstword $(subst -, ,$*))
$(DIST)/gogs-%.tgz: GOARCH=$(subst .exe,,$(word 2,$(subst -, ,$*)))
$(DIST)/gogs-%.tgz: $(BIN)/%/gogs/gogs
mkdir -p $(DIST)
tar -czf $@ --directory=$(BIN)/$* gogs
clean-mac: clean $(DIST)/gogs-%.zip: GOOS=$(firstword $(subst -, ,$*))
find . -name ".DS_Store" -print0 | xargs -0 rm $(DIST)/gogs-%.zip: GOARCH=$(subst .exe,,$(word 2,$(subst -, ,$*)))
$(DIST)/gogs-%.zip: $(BIN)/%/gogs/gogs
@mkdir -p $(DIST)
(cd $(BIN)/$* && zip -r - gogs) > $@

Loading…
Cancel
Save