1
0
Fork 0
mirror of https://gitea.com/jolheiser/sip synced 2024-05-28 10:36:05 +02:00

Add Drone and releases (#2)

Move comment to appease linter

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Add Drone and releases

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/jolheiser/sip/pulls/2
This commit is contained in:
John Olheiser 2020-02-18 15:51:10 +00:00
parent 427ecdb7f1
commit 5929bebe01
4 changed files with 128 additions and 1 deletions

73
.drone.yml Normal file
View File

@ -0,0 +1,73 @@
---
kind: pipeline
name: compliance
platform:
os: linux
arch: arm64
trigger:
event:
- pull_request
steps:
- name: build
pull: always
image: golang:1.13
environment:
GOPROXY: https://goproxy.cn
commands:
- go test -race
- go build
- name: check
pull: always
image: golang:1.13
environment:
GOPROXY: https://goproxy.cn
commands:
- make lint
---
kind: pipeline
name: release
platform:
os: linux
arch: amd64
trigger:
branch:
- master
event:
- push
- tag
steps:
- name: fetch-tags
pull: always
image: docker:git
commands:
- git fetch --tags --force
- name: release
pull: always
image: techknowlogick/xgo:latest
environment:
GOPROXY: https://goproxy.cn
commands:
- export PATH=$PATH:$GOPATH/bin
- make release
- name: gitea
pull: always
image: plugins/gitea-release:1
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.com
files:
- "dist/release/*"
when:
event:
- tag

View File

@ -1,4 +1,6 @@
DIST := dist
GO ?= go
SHASUM ?= shasum -a 256
ifneq ($(DRONE_TAG),)
VERSION ?= $(subst v,,$(DRONE_TAG))
@ -32,4 +34,53 @@ fmt:
.PHONY: test
test:
$(GO) test -race ./...
$(GO) test -race ./...
.PHONY: release
release: release-dirs check-xgo release-windows release-linux release-darwin release-copy release-compress release-check
.PHONY: check-xgo
check-xgo:
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u src.techknowlogick.com/xgo; \
fi
.PHONY: release-dirs
release-dirs:
mkdir -p $(DIST)/binaries $(DIST)/release
.PHONY: release-windows
release-windows:
xgo -dest $(DIST)/binaries -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out sip-$(VERSION) .
ifeq ($(CI),drone)
cp /build/* $(DIST)/binaries
endif
.PHONY: release-linux
release-linux:
xgo -dest $(DIST)/binaries -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out sip-$(VERSION) .
ifeq ($(CI),drone)
cp /build/* $(DIST)/binaries
endif
.PHONY: release-darwin
release-darwin:
xgo -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out sip-$(VERSION) .
ifeq ($(CI),drone)
cp /build/* $(DIST)/binaries
endif
.PHONY: release-copy
release-copy:
cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done;
.PHONY: release-check
release-check:
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
.PHONY: release-compress
release-compress:
@hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/ulikunitz/xz/cmd/gxz; \
fi
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;

View File

@ -1,6 +1,8 @@
# Sip (alternative)
CLI for interacting with Gitea
[![Build Status](https://drone.gitea.com/api/badges/jolheiser/sip/status.svg)](https://drone.gitea.com/jolheiser/sip)
### Features
Understands the concepts of an origin vs remote repository.

View File

@ -14,6 +14,7 @@ var (
cfg *config
// Config items
Origin string
Upstream string
Tokens []Token