mirror of https://github.com/statping/statping
parent
8b40250841
commit
9c6233e3e7
|
@ -43,7 +43,7 @@ jobs:
|
||||||
run: make clean compile
|
run: make clean compile
|
||||||
|
|
||||||
- name: Upload Compiled Frontend (rice-box.go)
|
- name: Upload Compiled Frontend (rice-box.go)
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
@ -92,7 +92,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
@ -160,7 +160,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
@ -204,21 +204,26 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Go mods
|
- name: Download Go mods
|
||||||
run: make test-deps
|
if: steps.golangcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
go mod download
|
||||||
|
go mod verify
|
||||||
|
make test-deps
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
|
||||||
- name: Build with xgo
|
- name: Build Binaries
|
||||||
run: |
|
env:
|
||||||
[ ! -d "source/dist" ] && exit 2
|
VERSION: ${{ env.VERSION }}
|
||||||
make build-mac
|
COMMIT: $GITHUB_SHA
|
||||||
|
run: make build-mac
|
||||||
|
|
||||||
- name: Upload MacOSX Builds
|
- name: Upload MacOSX Builds
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: darwin-builds
|
name: darwin-builds
|
||||||
path: ./build
|
path: ./build
|
||||||
|
@ -230,9 +235,13 @@ jobs:
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.14.2'
|
go-version: '1.14.2'
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Libraries
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install libc-dev gcc-multilib build-essential musl-dev gcc g++ -y
|
||||||
|
|
||||||
- name: Setting ENV's
|
- name: Setting ENV's
|
||||||
run: |
|
run: |
|
||||||
echo "::add-path::$(go env GOPATH)/bin"
|
echo "::add-path::$(go env GOPATH)/bin"
|
||||||
|
@ -241,21 +250,28 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Go mods
|
- name: Download Go mods
|
||||||
run: make test-deps
|
if: steps.golangcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
go mod download
|
||||||
|
go mod verify
|
||||||
|
make test-deps
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
|
||||||
- name: Build with xgo
|
- name: Build Binaries
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
|
COMMIT: $GITHUB_SHA
|
||||||
run: |
|
run: |
|
||||||
[ ! -d "source/dist" ] && exit 2
|
go env
|
||||||
make build-linux
|
make build-linux
|
||||||
|
|
||||||
- name: Upload Linux Builds
|
- name: Upload Linux Builds
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: linux-builds
|
name: linux-builds
|
||||||
path: ./build
|
path: ./build
|
||||||
|
@ -267,7 +283,6 @@ jobs:
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.14.2'
|
go-version: '1.14.2'
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setting ENV's
|
- name: Setting ENV's
|
||||||
|
@ -278,21 +293,26 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Go mods
|
- name: Download Go mods
|
||||||
run: make test-deps
|
if: steps.golangcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
go mod download
|
||||||
|
go mod verify
|
||||||
|
make test-deps
|
||||||
|
|
||||||
- name: Download Compiled Frontend (rice-box.go)
|
- name: Download Compiled Frontend (rice-box.go)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: static-rice-box
|
name: static-rice-box
|
||||||
path: ./source
|
path: ./source
|
||||||
|
|
||||||
- name: Build with xgo
|
- name: Build Binaries
|
||||||
run: |
|
env:
|
||||||
[ ! -d "source/dist" ] && exit 2
|
VERSION: ${{ env.VERSION }}
|
||||||
make build-win
|
COMMIT: $GITHUB_SHA
|
||||||
|
run: make build-win
|
||||||
|
|
||||||
- name: Upload Windows Builds
|
- name: Upload Windows Builds
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: windows-builds
|
name: windows-builds
|
||||||
path: ./build
|
path: ./build
|
||||||
|
@ -311,25 +331,22 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Download Linux Builds
|
- name: Download Linux Builds
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: linux-builds
|
name: linux-builds
|
||||||
path: ./build
|
path: ./linux
|
||||||
|
|
||||||
- name: Download MacOSX Builds
|
- name: Download MacOSX Builds
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: darwin-builds
|
name: darwin-builds
|
||||||
path: ./build
|
path: ./darwin
|
||||||
|
|
||||||
- name: Download Windows Builds
|
- name: Download Windows Builds
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: windows-builds
|
name: windows-builds
|
||||||
path: ./build
|
path: ./windows
|
||||||
|
|
||||||
- name: Compress Files
|
|
||||||
run: make compress
|
|
||||||
|
|
||||||
- name: Upload Linux Release
|
- name: Upload Linux Release
|
||||||
id: upload-linux-asset
|
id: upload-linux-asset
|
||||||
|
@ -342,12 +359,17 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
files: |
|
files: |
|
||||||
releases/statping-linux-386.tar.gz
|
linux/statping-freebsd-386.tar.gz
|
||||||
releases/statping-linux-amd64.tar.gz
|
linux/statping-freebsd-amd64.tar.gz
|
||||||
releases/statping-linux-arm64.tar.gz
|
linux/statping-freebsd-arm.tar.gz
|
||||||
releases/statping-linux-arm-7.tar.gz
|
linux/statping-linux-386.tar.gz
|
||||||
releases/statping-linux-arm-6.tar.gz
|
linux/statping-linux-amd64.tar.gz
|
||||||
releases/statping-linux-arm-5.tar.gz
|
linux/statping-linux-arm.tar.gz
|
||||||
|
linux/statping-linux-arm64.tar.gz
|
||||||
|
linux/statping-openbsd-386.tar.gz
|
||||||
|
linux/statping-openbsd-amd64.tar.gz
|
||||||
|
linux/statping-openbsd-arm.tar.gz
|
||||||
|
linux/statping-openbsd-arm64.tar.gz
|
||||||
|
|
||||||
- name: Upload MaxOSX Release
|
- name: Upload MaxOSX Release
|
||||||
id: upload-darwin-asset
|
id: upload-darwin-asset
|
||||||
|
@ -360,8 +382,8 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
files: |
|
files: |
|
||||||
releases/statping-darwin-386.tar.gz
|
darwin/statping-darwin-386.tar.gz
|
||||||
releases/statping-darwin-amd64.tar.gz
|
darwin/statping-darwin-amd64.tar.gz
|
||||||
|
|
||||||
- name: Upload Windows Release
|
- name: Upload Windows Release
|
||||||
id: upload-windows-asset
|
id: upload-windows-asset
|
||||||
|
@ -374,8 +396,9 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
files: |
|
files: |
|
||||||
releases/statping-windows-386.zip
|
windows/statping-windows-386.zip
|
||||||
releases/statping-windows-amd64.zip
|
windows/statping-windows-amd64.zip
|
||||||
|
windows/statping-windows-arm.zip
|
||||||
|
|
||||||
docker-release:
|
docker-release:
|
||||||
needs: upload-release
|
needs: upload-release
|
||||||
|
@ -388,14 +411,6 @@ jobs:
|
||||||
run: echo ::set-env name=VERSION::$(cat version.txt)
|
run: echo ::set-env name=VERSION::$(cat version.txt)
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- uses: azure/docker-login@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Release Docker images
|
|
||||||
run: make docker-manifest
|
|
||||||
|
|
||||||
- name: Base Docker Image
|
- name: Base Docker Image
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
with:
|
with:
|
||||||
|
@ -405,6 +420,20 @@ jobs:
|
||||||
dockerfile: Dockerfile.base
|
dockerfile: Dockerfile.base
|
||||||
tags: "base"
|
tags: "base"
|
||||||
|
|
||||||
|
- name: Latest/Version Docker Image
|
||||||
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
|
env:
|
||||||
|
VERSION: ${{ env.VERSION }}
|
||||||
|
ARCH: amd64
|
||||||
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||||
|
with:
|
||||||
|
name: statping/statping
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
tags: "latest,v${{ env.VERSION }}"
|
||||||
|
buildargs: VERSION,ARCH
|
||||||
|
|
||||||
sentry-release:
|
sentry-release:
|
||||||
needs: upload-release
|
needs: upload-release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
102
Makefile
102
Makefile
|
@ -2,17 +2,16 @@ VERSION=$(shell cat version.txt)
|
||||||
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
|
SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278
|
||||||
BINARY_NAME=statping
|
BINARY_NAME=statping
|
||||||
GOBUILD=go build -a
|
GOBUILD=go build -a
|
||||||
GOVERSION=1.14.2
|
GOVERSION=1.14.0
|
||||||
XGO=xgo -go $(GOVERSION) --dest=build
|
XGO=xgo -go $(GOVERSION) --dest=build
|
||||||
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION}"
|
BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)"
|
||||||
TRVIS_SECRET=O3/2KTOV8krv+yZ1EB/7D1RQRe6NdpFUEJNJkMS/ollYqmz3x2mCO7yIgIJKCKguLXZxjM6CxJcjlCrvUwibL+8BBp7xJe4XFIOrjkPvbbVPry4HkFZCf2GfcUK6o4AByQ+RYqsW2F17Fp9KLQ1rL3OT3eLTwCAGKx3tlY8y+an43zkmo5dN64V6sawx26fh6XTfww590ey+ltgQTjf8UPNup2wZmGvMo9Hwvh/bYR/47bR6PlBh6vhlKWyotKf2Fz1Bevbu0zc35pee5YlsrHR+oSF+/nNd/dOij34BhtqQikUR+zQVy9yty8SlmneVwD3yOENvlF+8roeKIXb6P6eZnSMHvelhWpAFTwDXq2N3d/FIgrQtLxsAFTI3nTHvZgs6OoTd6dA0wkhuIGLxaL3FOeztCdxP5J/CQ9GUcTvifh5ArGGwYxRxQU6rTgtebJcNtXFISP9CEUR6rwRtb6ax7h6f1SbjUGAdxt+r2LbEVEk4ZlwHvdJ2DtzJHT5DQtLrqq/CTUgJ8SJFMkrJMp/pPznKhzN4qvd8oQJXygSXX/gz92MvoX0xgpNeLsUdAn+PL9KketfR+QYosBz04d8k05E+aTqGaU7FUCHPTLwlOFvLD8Gbv0zsC/PWgSLXTBlcqLEz5PHwPVHTcVzspKj/IyYimXpCSbvu1YOIjyc=
|
TRVIS_SECRET=O3/2KTOV8krv+yZ1EB/7D1RQRe6NdpFUEJNJkMS/ollYqmz3x2mCO7yIgIJKCKguLXZxjM6CxJcjlCrvUwibL+8BBp7xJe4XFIOrjkPvbbVPry4HkFZCf2GfcUK6o4AByQ+RYqsW2F17Fp9KLQ1rL3OT3eLTwCAGKx3tlY8y+an43zkmo5dN64V6sawx26fh6XTfww590ey+ltgQTjf8UPNup2wZmGvMo9Hwvh/bYR/47bR6PlBh6vhlKWyotKf2Fz1Bevbu0zc35pee5YlsrHR+oSF+/nNd/dOij34BhtqQikUR+zQVy9yty8SlmneVwD3yOENvlF+8roeKIXb6P6eZnSMHvelhWpAFTwDXq2N3d/FIgrQtLxsAFTI3nTHvZgs6OoTd6dA0wkhuIGLxaL3FOeztCdxP5J/CQ9GUcTvifh5ArGGwYxRxQU6rTgtebJcNtXFISP9CEUR6rwRtb6ax7h6f1SbjUGAdxt+r2LbEVEk4ZlwHvdJ2DtzJHT5DQtLrqq/CTUgJ8SJFMkrJMp/pPznKhzN4qvd8oQJXygSXX/gz92MvoX0xgpNeLsUdAn+PL9KketfR+QYosBz04d8k05E+aTqGaU7FUCHPTLwlOFvLD8Gbv0zsC/PWgSLXTBlcqLEz5PHwPVHTcVzspKj/IyYimXpCSbvu1YOIjyc=
|
||||||
PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
|
PUBLISH_BODY='{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
|
||||||
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.14, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 10.17.0", "nvm use 10.17.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }'
|
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "merge_mode": "replace", "language": "go", "go": 1.14, "install": true, "sudo": "required", "services": ["docker"], "env": { "secure": "${TRVIS_SECRET}" }, "before_deploy": ["git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [{ "provider": "releases", "api_key": "$$GITHUB_TOKEN", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": { "branch": "master" } }], "before_script": ["rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install stable", "nvm install 10.17.0", "nvm use 10.17.0 --default", "npm install -g sass yarn cross-env", "pip install --user awscli"], "script": ["make release"], "after_success": [], "after_deploy": ["make post-release"] } } }'
|
||||||
TEST_DIR=$(GOPATH)/src/github.com/statping/statping
|
TEST_DIR=$(GOPATH)/src/github.com/statping/statping
|
||||||
PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
|
PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
|
||||||
OS = freebsd linux openbsd
|
OS = freebsd linux openbsd
|
||||||
LINUX_ARCHS = 386 amd64 arm-7 arm-6 arm64 arm-5
|
ARCHS = 386 arm amd64 arm64
|
||||||
BASIC_ARCHS = 386 amd64
|
|
||||||
|
|
||||||
all: clean yarn-install compile docker-base docker-vue build-all
|
all: clean yarn-install compile docker-base docker-vue build-all
|
||||||
|
|
||||||
|
@ -56,9 +55,7 @@ test-api:
|
||||||
test-deps:
|
test-deps:
|
||||||
go get golang.org/x/tools/cmd/cover
|
go get golang.org/x/tools/cmd/cover
|
||||||
go get github.com/mattn/goveralls
|
go get github.com/mattn/goveralls
|
||||||
go get github.com/GeertJohan/go.rice
|
|
||||||
go get github.com/GeertJohan/go.rice/rice
|
go get github.com/GeertJohan/go.rice/rice
|
||||||
go get -u github.com/crazy-max/xgo
|
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
go get -d -v -t ./...
|
go get -d -v -t ./...
|
||||||
|
@ -154,38 +151,47 @@ install-local: build
|
||||||
generate:
|
generate:
|
||||||
cd source && go generate
|
cd source && go generate
|
||||||
|
|
||||||
compress:
|
|
||||||
mkdir releases || true;
|
|
||||||
@for arch in $(LINUX_ARCHS);\
|
|
||||||
do \
|
|
||||||
echo "Compressing v${VERSION} for linux-$$arch"; \
|
|
||||||
mkdir -p build/statping-linux-$$arch-bin/; \
|
|
||||||
chmod +x build/statping-linux-$$arch && mv build/statping-linux-$$arch build/statping-linux-$$arch-bin/statping; \
|
|
||||||
tar -czf releases/statping-linux-$$arch.tar.gz -C build/statping-linux-$$arch-bin statping; \
|
|
||||||
done
|
|
||||||
@for arch in $(BASIC_ARCHS);\
|
|
||||||
do \
|
|
||||||
echo "Compressing v${VERSION} for darwin-$$arch"; \
|
|
||||||
mkdir -p build/statping-darwin-$$arch-bin/; \
|
|
||||||
chmod +x build/statping-darwin-10.6-$$arch && mv build/statping-darwin-10.6-$$arch build/statping-darwin-$$arch-bin/statping; \
|
|
||||||
tar -czf releases/statping-darwin-$$arch.tar.gz -C build/statping-darwin-$$arch-bin statping; \
|
|
||||||
done
|
|
||||||
@for arch in $(BASIC_ARCHS);\
|
|
||||||
do \
|
|
||||||
echo "Compressing v${VERSION} for windows-$$arch"; \
|
|
||||||
mkdir -p build/statping-windows-$$arch-bin/; \
|
|
||||||
chmod +x build/statping-windows-6.0-$$arch.exe && mv build/statping-windows-6.0-$$arch.exe build/statping-windows-$$arch-bin/statping.exe; \
|
|
||||||
zip -j releases/statping-windows-$$arch.zip build/statping-windows-$$arch-bin/statping.exe; \
|
|
||||||
done
|
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
xgo -go=$(GOVERSION) -dest=build -pkg=cmd -ldflags="-s -w -extldflags -static -X main.VERSION=${VERSION}" -targets="linux/amd64,linux/386,linux/arm-7,linux/arm-6,linux/arm64,linux/arm" -out=statping ./
|
mkdir build || true
|
||||||
|
export PWD=`pwd`
|
||||||
|
@for arch in $(ARCHS);\
|
||||||
|
do \
|
||||||
|
for os in $(OS);\
|
||||||
|
do \
|
||||||
|
echo "Building v$$VERSION for $$os-$$arch"; \
|
||||||
|
mkdir -p releases/statping-$$os-$$arch/; \
|
||||||
|
GO111MODULE="on" GOOS=$$os GOARCH=$$arch go build -a -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)" -o releases/statping-$$os-$$arch/statping ${PWD}/cmd || true; \
|
||||||
|
chmod +x releases/statping-$$os-$$arch/statping || true; \
|
||||||
|
tar -czf releases/statping-$$os-$$arch.tar.gz -C releases/statping-$$os-$$arch statping || true; \
|
||||||
|
done \
|
||||||
|
done
|
||||||
|
find ./releases/ -name "*.tar.gz" -type f -size +1M -exec mv "{}" build/ \;
|
||||||
|
|
||||||
build-mac:
|
build-mac:
|
||||||
xgo -go=$(GOVERSION) -dest=build -pkg=cmd -ldflags="-s -w -X main.VERSION=${VERSION}" -targets="darwin/amd64,darwin/386" -out=statping ./
|
mkdir build || true
|
||||||
|
export PWD=`pwd`
|
||||||
|
@for arch in $(ARCHS);\
|
||||||
|
do \
|
||||||
|
echo "Building v$$VERSION for darwin-$$arch"; \
|
||||||
|
mkdir -p releases/statping-darwin-$$arch/; \
|
||||||
|
GO111MODULE="on" GOOS=darwin GOARCH=$$arch go build -a -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)" -o releases/statping-darwin-$$arch/statping ${PWD}/cmd || true; \
|
||||||
|
chmod +x releases/statping-darwin-$$arch/statping || true; \
|
||||||
|
tar -czf releases/statping-darwin-$$arch.tar.gz -C releases/statping-darwin-$$arch statping || true; \
|
||||||
|
done
|
||||||
|
find ./releases/ -name "*.tar.gz" -type f -size +1M -exec mv "{}" build/ \;
|
||||||
|
|
||||||
build-win:
|
build-win:
|
||||||
xgo -go=$(GOVERSION) -dest=build -pkg=cmd -ldflags="-s -w -extldflags -static -X main.VERSION=${VERSION}" -targets="windows-6.0/amd64,windows-6.0/386" -out=statping ./
|
mkdir build || true
|
||||||
|
export PWD=`pwd`
|
||||||
|
@for arch in $(ARCHS);\
|
||||||
|
do \
|
||||||
|
echo "Building v$$VERSION for windows-$$arch"; \
|
||||||
|
mkdir -p releases/statping-windows-$$arch/; \
|
||||||
|
GO111MODULE="on" GOOS=windows GOARCH=$$arch go build -a -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)" -o releases/statping-windows-$$arch/statping.exe ${PWD}/cmd || true; \
|
||||||
|
chmod +x releases/statping-windows-$$arch/statping.exe || true; \
|
||||||
|
zip -j releases/statping-windows-$$arch.zip releases/statping-windows-$$arch/statping.exe || true; \
|
||||||
|
done
|
||||||
|
find ./releases/ -name "*.zip" -type f -size +1M -exec mv "{}" build/ \;
|
||||||
|
|
||||||
# remove files for a clean compile/build
|
# remove files for a clean compile/build
|
||||||
clean:
|
clean:
|
||||||
|
@ -226,7 +232,7 @@ print_details:
|
||||||
@echo \==== Monitoring and IDE ====
|
@echo \==== Monitoring and IDE ====
|
||||||
@echo \Grafana: http://localhost:3000 \(username: admin, password: admin\)
|
@echo \Grafana: http://localhost:3000 \(username: admin, password: admin\)
|
||||||
|
|
||||||
build-all: clean compile build-linux build-mac build-win compress
|
build-all: clean compile build-linux build-mac build-win
|
||||||
|
|
||||||
coverage: test-deps
|
coverage: test-deps
|
||||||
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
||||||
|
@ -256,34 +262,8 @@ docker-build-dev:
|
||||||
docker build --build-arg VERSION=${VERSION} -t hunterlong/statping:latest --no-cache -f Dockerfile .
|
docker build --build-arg VERSION=${VERSION} -t hunterlong/statping:latest --no-cache -f Dockerfile .
|
||||||
docker tag hunterlong/statping:dev hunterlong/statping:dev-v${VERSION}
|
docker tag hunterlong/statping:dev hunterlong/statping:dev-v${VERSION}
|
||||||
|
|
||||||
docker:
|
|
||||||
@for arch in $(LINUX_ARCHS);\
|
|
||||||
do \
|
|
||||||
echo "Docker build v${VERSION} statping/statping:$$arch-latest"; \
|
|
||||||
docker build --build-arg VERSION=${VERSION} --build-arg ARCH=$$arch -t statping/statping:$$arch-latest --no-cache -f Dockerfile . > /dev/null; \
|
|
||||||
docker push statping/statping:$$arch-latest; \
|
|
||||||
done
|
|
||||||
|
|
||||||
docker-manifest: docker
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create statping/statping:latest \
|
|
||||||
--amend statping/statping:amd64-latest \
|
|
||||||
--amend statping/statping:386-latest \
|
|
||||||
--amend statping/statping:arm-5-latest \
|
|
||||||
--amend statping/statping:arm-6-latest \
|
|
||||||
--amend statping/statping:arm-7-latest \
|
|
||||||
--amend statping/statping:arm64-latest
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:amd64-latest --arch amd64 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:386-latest --arch 386 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:arm-5-latest --arch arm --variant v5 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:arm-6-latest --arch arm --variant v6 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:arm-7-latest --arch arm --variant v7 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate statping/statping:latest statping/statping:arm64-latest --arch arm64 --variant v8 --os linux
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect statping/statping:latest
|
|
||||||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge statping/statping:latest
|
|
||||||
|
|
||||||
post-release: frontend-build upload_to_s3 publish-homebrew dockerhub
|
post-release: frontend-build upload_to_s3 publish-homebrew dockerhub
|
||||||
|
|
||||||
|
|
||||||
# update the homebrew application to latest for mac
|
# update the homebrew application to latest for mac
|
||||||
publish-homebrew:
|
publish-homebrew:
|
||||||
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(PUBLISH_BODY) https://api.travis-ci.com/repo/statping%2Fhomebrew-statping/requests
|
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(PUBLISH_BODY) https://api.travis-ci.com/repo/statping%2Fhomebrew-statping/requests
|
||||||
|
@ -332,5 +312,5 @@ postman: clean compile
|
||||||
newman run -e dev/postman_environment.json dev/postman.json
|
newman run -e dev/postman_environment.json dev/postman.json
|
||||||
killall statping
|
killall statping
|
||||||
|
|
||||||
.PHONY: all build build-alpine test-all test test-api docker frontend up down print_details lite sentry-release snapcraft build-linux build-mac build-win build-all postman
|
.PHONY: all build build-all build-alpine test-all test test-api docker frontend up down print_details lite sentry-release snapcraft build-linux build-mac build-win build-all postman
|
||||||
.SILENT: travis_s3_creds
|
.SILENT: travis_s3_creds
|
||||||
|
|
Loading…
Reference in New Issue