add drone runner

This commit is contained in:
Xuu 2020-08-17 09:40:10 -06:00
parent d7572abc72
commit f6c568b15a
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
4 changed files with 43 additions and 25 deletions

28
.drone.yml Normal file
View File

@ -0,0 +1,28 @@
---
kind: pipeline
type: exec
name: default
platform:
os: linux
arch: amd64
steps:
- name: Setup
commands:
- make setup
- name: Test
commands:
- make test
- name: Build Release
commands:
- cd debian && make release
- cd debian && make build
- name: deploy
commands:
- cd debian && make copy
- cd debian && make deploy
...

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "assets/src/vendor/sour-is"]
path = assets/src/vendor/sour-is
url = git@git.dn42.us:xuu/souris-react.git
branch = master

View File

@ -17,23 +17,23 @@ endef
export DUMMY_BINDATA export DUMMY_BINDATA
all: $(BINARY) all: $(BINARY)
clean: clean:
rm -rf $(BINARY) $(ROUTE_ASSET) $(DOCS_ASSET) rm -rf $(BINARY) $(ROUTE_ASSET) $(DOCS_ASSET)
setup: setup:
git submodule update
cd assets; npm i cd assets; npm i
fmt: fmt:
go fmt ./... go fmt ./...
test:
run: $(BINARY) go test ./...
go vet ./...
run: $(BINARY)
./$(BINARY) -vv serve ./$(BINARY) -vv serve
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET) $(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET)
go vet ./... # go vet ./...
go test ./... # go test ./...
go build "sour.is/x/paste/cmd/paste" go build "sour.is/x/paste/cmd/paste"
$(ROUTE_ASSET): $(ROUTE_FILES) $(ROUTE_ASSET): $(ROUTE_FILES)
@ -41,17 +41,14 @@ $(ROUTE_ASSET): $(ROUTE_FILES)
rm -rf build ../public; \ rm -rf build ../public; \
npm run build; \ npm run build; \
cp -r build ../public cp -r build ../public
go generate "sour.is/x/paste/src/routes" go generate "sour.is/x/paste/src/routes"
$(DOCS_ASSET): $(DOCS_FILES) $(SOURCE) $(DOCS_ASSET): $(DOCS_FILES) $(SOURCE)
echo "$$DUMMY_BINDATA" > src/docs/bindata.go echo "$$DUMMY_BINDATA" > src/docs/bindata.go
go generate "sour.is/x/paste/cmd/paste" go generate "sour.is/x/paste/cmd/paste"
go generate "sour.is/x/paste/src/docs" go generate "sour.is/x/paste/src/docs"
deploy: $(SOURCE) $(ROUTE_ASSET) deploy: $(SOURCE) $(ROUTE_ASSET)
cd debian && make cd debian && make
.PHONEY: all clean deploy run setup .PHONEY: all clean build deploy run setup
# DO NOT DELETE # DO NOT DELETE

19
debian/Makefile vendored
View File

@ -11,25 +11,22 @@ clean:
rm -r BUILD/* rm -r BUILD/*
release: release:
export RELEASE=`cat RELEASE`; \
echo `expr $${RELEASE} + 1` > RELEASE echo `expr $${RELEASE} + 1` > RELEASE
git commit -am "release version $${RELEASE}"
git tag -am "release version $${RELEASE}"
git push --tags
build: build:
export VERSION=`cat VERSION`; \
export RELEASE=`cat RELEASE`; \
export DATE=`date -u +%FT%TZ`; \
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \
rm -rf ./$${BUILD}; \ rm -rf ./$${BUILD}; \
cp -r ROOT "$${BUILD}"; \ cp -r ROOT "$${BUILD}"; \
sed -i'.tmp' "s_Version:.*_Version: $${VERSION}-$${RELEASE}_" "$${BUILD}/DEBIAN/control" sed -i'.tmp' "s_Version:.*_Version: $${VERSION}-$${RELEASE}_" "$${BUILD}/DEBIAN/control"
export VERSION=`cat VERSION`; \ export DATE=`date -u +%FT%TZ`; \
export RELEASE=`cat RELEASE`; \ export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \
export DATE=`date -u +%FT%TZ`; \ env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
export BUILD="BUILD/$(NAME)_$${VERSION}-$${RELEASE}"; \ -ldflags "-X main.AppVersion=$${VERSION}-$${RELEASE} -X main.AppBuild=$${DATE}"\
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \ sour.is/x/paste/cmd/paste; \
-ldflags "-X main.AppVersion=$${VERSION}-$${RELEASE} -X main.AppBuild=$${DATE}"\
sour.is/x/paste/cmd/paste; \
dpkg -b $${BUILD}; dpkg -b $${BUILD};
copy: copy: