From 24b2f4303c1939379f0deaa743ba249ba3a33096 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Wed, 28 Nov 2018 20:47:35 -0800 Subject: [PATCH] version control and snapcraft --- .gitignore | 4 ++++ .travis.yml | 9 +++++++-- Makefile | 28 +++++++++++++++++++++++----- snapcraft.yaml | 6 ++++-- version.txt | 2 +- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 402c82c0..37fe32a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ .idea +snap +prime +stage +parts core/rice-box.go config.yml statup.db diff --git a/.travis.yml b/.travis.yml index 0a739413..c1f079fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ services: env: global: + - PATH=/snap/bin:$PATH - DB_HOST=localhost - DB_USER=travis - DB_PASS= @@ -39,6 +40,8 @@ before_deploy: after_deploy: - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make publish-homebrew; fi + - snapcraft login --with "$SNAP_TOKEN" + - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make snapcraft; fi deploy: - provider: releases @@ -60,10 +63,10 @@ branches: before_install: - curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o $GOPATH/bin/dep - chmod +x $GOPATH/bin/dep - - npm install -g sass - - npm install -g newman install: + - npm install -g sass + - npm install -g newman - make dev-deps - make dep - make install @@ -79,3 +82,5 @@ script: after_success: - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make travis-build; fi + - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make snapcraft; fi + - sudo snap install snapcraft --classic diff --git a/Makefile b/Makefile index e42c7638..8628f738 100644 --- a/Makefile +++ b/Makefile @@ -229,10 +229,12 @@ clean: rm -rf source/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log} rm -rf types/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log} rm -rf utils/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log} + rm -rf {parts,prime,snap,stage} rm -rf dev/test/cypress/videos rm -f coverage.* sass rm -f source/rice-box.go rm -f *.db-journal + rm -rf *.snap find . -name "*.out" -type f -delete find . -name "*.cpu" -type f -delete find . -name "*.mem" -type f -delete @@ -240,7 +242,7 @@ clean: # tag version using git tag: - git tag "v${VERSION}" --force + git tag v${VERSION} --force # compress built binaries into tar.gz and zip formats compress: @@ -282,10 +284,26 @@ travis-build: curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(TRAVIS_BUILD_CMD) https://api.travis-ci.com/repo/hunterlong%2Fstatup/requests curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER) -snapcraft: - snapcraft clean statup -s pull && snapcraft --target-arch=amd64 - snapcraft clean statup -s pull && snapcraft --target-arch=arm64 - snapcraft clean statup -s pull && snapcraft --target-arch=i386 +snapcraft: snapcraft-build snapcraft-release + +snapcraft-build: + PWD=$(shell pwd) + cp build/$(BINARY_NAME)-linux-x64.tar.gz build/$(BINARY_NAME)-linux.tar.gz + snapcraft clean statup -s pull + docker run --rm -v ${PWD}:/build -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=amd64" + cp build/$(BINARY_NAME)-linux-x32.tar.gz build/$(BINARY_NAME)-linux.tar.gz + snapcraft clean statup -s pull + docker run --rm -v ${PWD}:/build -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=i386" + cp build/$(BINARY_NAME)-linux-arm64.tar.gz build/$(BINARY_NAME)-linux.tar.gz + snapcraft clean statup -s pull + docker run --rm -v ${PWD}:/build -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=arm64" + cp build/$(BINARY_NAME)-linux-arm7.tar.gz build/$(BINARY_NAME)-linux.tar.gz + snapcraft clean statup -s pull + docker run --rm -v ${PWD}:/build -w /build --env VERSION=${VERSION} snapcore/snapcraft bash -c "apt update && snapcraft --target-arch=armhf" + rm -f build/$(BINARY_NAME)-linux.tar.gz + +snapcraft-release: + snapcraft push *.snap --release edge # install xgo and pull the xgo docker image xgo-install: clean diff --git a/snapcraft.yaml b/snapcraft.yaml index 97056730..35ea5df4 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -16,10 +16,12 @@ grade: stable parts: statup: plugin: dump - source: https://github.com/hunterlong/statup/releases/download/latest/statup-linux-x64.tar.gz + source: ./build/statup-linux.tar.gz apps: statup: command: statup plugs: - - home \ No newline at end of file + - home + - network-bind + - network \ No newline at end of file diff --git a/version.txt b/version.txt index 238ede83..b563764e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.79.91 \ No newline at end of file +0.79.92 \ No newline at end of file