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

19
debian/Makefile vendored
View File

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