2018-11-29 02:03:41 +00:00
VERSION = $( shell cat version.txt)
2018-12-04 10:13:08 +00:00
SIGN_KEY = B76D61FAA6DB759466E83D9964B9C6AAE2D55278
2018-12-04 04:17:29 +00:00
BINARY_NAME = statping
2019-12-29 21:52:19 +00:00
GOBUILD = go build -a
2019-12-28 09:39:35 +00:00
GOVERSION = 1.13.5
2019-12-29 21:52:19 +00:00
XGO = xgo -go $( GOVERSION) --dest= build
2018-11-29 02:03:41 +00:00
BUILDVERSION = -ldflags " -X main.VERSION= ${ VERSION } -X main.COMMIT= $( TRAVIS_COMMIT) "
2019-12-29 19:12:47 +00:00
TRVIS_SECRET = CAVxMvW04wS/APA6QGjlWjLfTx5hc+TWwCKuBkMV2MioZSQGOTQBC4nITySUwepAFY25mI8zNV5oROOKzG0FxYvr2iIqKDkTTdVF1+XS2uyHfEKlsWMPErcqkGjRksDil75Pckz15uvvOYPndetK2QiamQkSf9U8dUJgzrPuV+UOFj6RO/kkEWhzmoyTdVdwIRKmiL8jINkvvFOWCAfg3WlBmucgYHHqjqeTn1kSeUJ+DV9lF8+ENq+74GZrnsq26UtskJexywDeFhhUYjWEvOFXQ19txB/JrvdZ2KSkYeuhHr1ZxlENSpQ/rySQqBvg7+XAl1RhQlL5V7/feXA+I/COqNYG5KqbDgeSUwGkZIumz1ITi24Lz4xATG5hnuRQkOIaO8/FGHAeQxU0JcdWlzS8M5RpvpN9tT12XSFDPYswFmkO+gGSEpu+2gSEbiaX7qocLLvZiMpkQxfOmItaUW5ZMXRvTWijhQTb2nyPOQ9JEabuAtAUrCwe7Enmc8P8ZasNZaJLJO53iQ8FyzrNFyAFwY5F87OQ/v3Hnjv0ADG8fDc4VUxlj8TweuRzETT8U2hchxqnK4BON2WMSj4d1V96pDuzb5fArtq5PTbI4VB7mZPriXYZEiKdfLEIufOYhg7uKdNRekMLkuJRr+ttH0Gyb+lILzSiHMHwxOH5bfM=
2018-12-19 19:07:05 +00:00
PUBLISH_BODY = '{ "request": { "branch": "master", "message": "Homebrew update version v${VERSION}", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
2020-01-01 10:31:13 +00:00
TRAVIS_BUILD_CMD = '{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "os": [ "linux" ], "language": "go", "go": [ "${GOVERSION}" ], "go_import_path": "github.com/hunterlong/statping", "install": true, "sudo": "required", "services": [ "docker" ], "env": { "VERSION": "${VERSION}", "secret": "$(TRVIS_SECRET)" }, "matrix": { "allow_failures": [ { "go": "master" } ], "fast_finish": true }, "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": "$(GH_TOKEN)", "file_glob": true, "file": "build/*", "skip_cleanup": true, "on": {"branch": "master"} } ], "notifications": { "email": false }, "before_script": ["gem install sass"], "script": [ "travis_wait 30 docker pull crazymax/xgo:$(GOVERSION)", "make release" ], "after_success": [], "after_deploy": [ "make publish-homebrew" ] } } }'
2018-12-04 04:17:29 +00:00
TEST_DIR = $( GOPATH) /src/github.com/hunterlong/statping
2019-12-29 21:52:19 +00:00
PATH := /usr/local/bin:$( GOPATH) /bin:$( PATH)
2018-08-15 08:08:50 +00:00
2018-12-04 04:17:29 +00:00
# build all arch's and release Statping
2019-12-28 09:27:59 +00:00
release : dev -deps
wget -O statping.gpg $( SIGN_URL)
gpg --import statping.gpg
make build-all
2018-08-17 08:28:15 +00:00
2018-11-09 01:41:51 +00:00
# build and push the images to docker hub
docker : docker -build -all docker -publish -all
2018-12-04 04:17:29 +00:00
# test all versions of Statping, golang testing and then cypress UI testing
2018-09-10 22:16:23 +00:00
test-all : dev -deps test
2018-08-17 08:28:15 +00:00
2018-12-04 04:17:29 +00:00
# test all versions of Statping, golang testing and then cypress UI testing
2018-09-10 22:16:23 +00:00
test-ui : dev -deps docker -build -dev cypress -test
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# testing to be ran on travis ci
travis-test : dev -deps cypress -install test coverage
2018-08-22 05:47:19 +00:00
2018-12-04 04:17:29 +00:00
# build and compile all arch's for Statping
2018-09-10 22:16:23 +00:00
build-all : build -mac build -linux build -windows build -alpine compress
2018-08-21 17:08:58 +00:00
2018-09-10 22:16:23 +00:00
# build all docker tags
2018-11-10 03:42:32 +00:00
docker-build-all : docker -build -latest
2018-09-05 10:54:57 +00:00
2018-09-10 22:16:23 +00:00
# push all docker tags built
2018-11-10 03:42:32 +00:00
docker-publish-all : docker -push -latest
2018-09-10 22:16:23 +00:00
2018-12-12 19:45:11 +00:00
snapcraft : clean snapcraft -build snapcraft -release
2018-12-04 19:13:24 +00:00
2018-12-04 04:17:29 +00:00
# build Statping for local arch
2018-08-17 16:13:20 +00:00
build : compile
2019-11-22 18:42:58 +00:00
go mod vendor
2018-08-17 16:13:20 +00:00
$( GOBUILD) $( BUILDVERSION) -o $( BINARY_NAME) -v ./cmd
2018-12-04 04:17:29 +00:00
# build Statping plugins
2018-09-10 09:01:04 +00:00
build-plugin :
2018-10-08 10:06:25 +00:00
$( GOBUILD) $( BUILDVERSION) -buildmode= plugin -o ./dev/plugin/example.so -v ./dev/plugin
2018-09-10 09:01:04 +00:00
2018-10-08 21:15:01 +00:00
test-plugin : clean
mkdir plugins
$( GOBUILD) $( BUILDVERSION) -buildmode= plugin -o ./dev/plugin/example.so -v ./dev/plugin
mv ./dev/plugin/example.so ./plugins/example.so
2018-12-04 05:57:11 +00:00
STATPING_DIR = $( TEST_DIR) go test -v -p= 1 $( BUILDVERSION) -coverprofile= coverage.out ./plugin
2018-10-08 21:15:01 +00:00
2018-12-04 04:17:29 +00:00
# build Statping debug app
2018-08-30 04:49:44 +00:00
build-debug : compile
$( GOBUILD) $( BUILDVERSION) -tags debug -o $( BINARY_NAME) -v ./cmd
2018-12-04 04:17:29 +00:00
# install Statping for local arch and move binary to gopath/src/bin/statping
2018-08-22 05:41:15 +00:00
install : build
2018-08-14 04:13:06 +00:00
mv $( BINARY_NAME) $( GOPATH) /bin/$( BINARY_NAME)
$( GOPATH) /bin/$( BINARY_NAME) version
2018-12-04 04:17:29 +00:00
# run Statping from local arch
2018-08-14 04:13:06 +00:00
run : build
2018-08-17 04:39:25 +00:00
./$( BINARY_NAME) --ip 0.0.0.0 --port 8080
2018-08-14 04:13:06 +00:00
2019-12-18 11:36:29 +00:00
# run Statping with Delve for debugging
rundlv :
2019-12-19 16:48:59 +00:00
lsof -ti:8080 | xargs kill
DB_CONN = sqlite DB_HOST = localhost DB_DATABASE = sqlite DB_PASS = none DB_USER = none GO_ENV = test \
dlv --listen= :2345 --headless= true --api-version= 2 --accept-multiclient exec ./statping
killdlv :
lsof -ti:2345 | xargs kill
2019-12-18 11:36:29 +00:00
builddlv :
$( GOBUILD) -gcflags "all=-N -l" -o ./$( BINARY_NAME) -v ./cmd
watch :
2019-12-19 16:48:59 +00:00
find . -print | grep -i '.*\.\(go\|gohtml\)' | justrun -v -c \
'go build -v -gcflags "all=-N -l" -o statping ./cmd && make rundlv &' \
-delay 10s -stdin \
-i= "Makefile,statping,statup.db,statup.db-journal,handlers/graphql/generated.go"
2019-12-18 11:36:29 +00:00
2018-09-10 22:16:23 +00:00
# compile assets using SASS and Rice. compiles scss -> css, and run rice embed-go
2018-12-20 00:53:14 +00:00
compile : generate
2018-08-16 06:22:20 +00:00
sass source/scss/base.scss source/css/base.css
2019-12-18 11:36:29 +00:00
cd source && rice embed-go
2018-08-21 06:54:39 +00:00
rm -rf .sass-cache
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# benchmark testing
2018-08-30 04:49:44 +00:00
benchmark :
cd handlers && go test -v -run= ^$ -bench= . -benchtime= 5s -memprofile= prof.mem -cpuprofile= prof.cpu
2018-09-10 22:16:23 +00:00
# view benchmark testing using pprof
2018-08-30 04:49:44 +00:00
benchmark-view :
go tool pprof handlers/handlers.test handlers/prof.cpu > top20
2018-12-04 04:17:29 +00:00
# test Statping golang tetsing files
2018-10-08 21:15:01 +00:00
test : clean compile install build -plugin
2018-12-04 05:57:11 +00:00
STATPING_DIR = $( TEST_DIR) go test -v -p= 1 $( BUILDVERSION) -coverprofile= coverage.out ./...
2018-08-16 01:15:14 +00:00
gocov convert coverage.out > coverage.json
2018-08-14 04:13:06 +00:00
2018-11-17 17:24:30 +00:00
test-api :
2018-12-04 04:17:29 +00:00
DB_CONN = sqlite DB_HOST = localhost DB_DATABASE = sqlite DB_PASS = none DB_USER = none statping &
2019-03-05 20:43:05 +00:00
sleep 300 && newman run source/tmpl/postman.json -e dev/postman_environment.json --delay-request 500
2018-11-17 17:24:30 +00:00
2018-09-10 22:16:23 +00:00
# report coverage to Coveralls
2018-08-14 05:10:51 +00:00
coverage :
$( GOPATH) /bin/goveralls -coverprofile= coverage.out -service= travis -repotoken $( COVERALLS)
2018-12-04 04:17:29 +00:00
# generate documentation for Statping functions
2018-08-16 01:07:02 +00:00
docs :
2019-02-06 18:51:30 +00:00
rm -f dev/README.md
printf "# Statping Dev Documentation\n" > dev/README.md
printf "This readme is automatically generated from the Golang documentation. [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/hunterlong/statping)\n\n" > dev/README.md
godocdown github.com/hunterlong/statping >> dev/README.md
godocdown github.com/hunterlong/statping/cmd >> dev/README.md
godocdown github.com/hunterlong/statping/core >> dev/README.md
godocdown github.com/hunterlong/statping/handlers >> dev/README.md
godocdown github.com/hunterlong/statping/notifiers >> dev/README.md
godocdown github.com/hunterlong/statping/plugin >> dev/README.md
godocdown github.com/hunterlong/statping/source >> dev/README.md
godocdown github.com/hunterlong/statping/types >> dev/README.md
godocdown github.com/hunterlong/statping/utils >> dev/README.md
2018-10-06 05:00:40 +00:00
gocov-html coverage.json > dev/COVERAGE.html
revive -formatter stylish > dev/LINT.md
2018-08-16 01:07:02 +00:00
2018-09-10 22:16:23 +00:00
#
2018-12-04 04:17:29 +00:00
# Build binary for Statping
2018-09-10 22:16:23 +00:00
#
2018-12-04 04:17:29 +00:00
# build Statping for Mac, 64 and 32 bit
2018-09-10 22:16:23 +00:00
build-mac : compile
2018-08-14 04:13:06 +00:00
mkdir build
2018-11-29 05:05:04 +00:00
$( XGO) $( BUILDVERSION) --targets= darwin/amd64,darwin/386 ./cmd
2018-09-10 22:16:23 +00:00
2018-12-04 04:17:29 +00:00
# build Statping for Linux 64, 32 bit, arm6/arm7
2018-09-10 22:16:23 +00:00
build-linux : compile
2018-11-29 05:05:04 +00:00
$( XGO) $( BUILDVERSION) --targets= linux/amd64,linux/386,linux/arm-7,linux/arm-6,linux/arm64 ./cmd
2018-08-16 06:22:20 +00:00
2018-09-10 22:16:23 +00:00
# build for windows 64 bit only
build-windows : compile
$( XGO) $( BUILDVERSION) --targets= windows-6.0/amd64 ./cmd
# build Alpine linux binary (used in docker images)
build-alpine : compile
2018-11-29 02:03:41 +00:00
$( XGO) --targets= linux/amd64 -ldflags= " -X main.VERSION= ${ VERSION } -X main.COMMIT= $( TRAVIS_COMMIT) -linkmode external -extldflags -static " -out alpine ./cmd
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
#
# Docker Makefile commands
#
2018-12-04 10:13:08 +00:00
docker-test :
docker-compose -f docker-compose.test.yml -p statping build
docker-compose -f docker-compose.test.yml -p statping up -d
docker logs -f statping_sut_1
docker wait statping_sut_1
2018-09-10 22:16:23 +00:00
# build :latest docker tag
2018-11-06 03:26:37 +00:00
docker-build-latest :
2018-12-04 04:17:29 +00:00
docker build --build-arg VERSION = ${ VERSION } -t hunterlong/statping:latest --no-cache -f Dockerfile .
docker tag hunterlong/statping:latest hunterlong/statping:v${ VERSION }
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# build :dev docker tag
2018-11-06 03:26:37 +00:00
docker-build-dev :
2018-12-04 04:17:29 +00:00
docker build --build-arg VERSION = ${ VERSION } -t hunterlong/statping:latest --no-cache -f Dockerfile .
docker tag hunterlong/statping:dev hunterlong/statping:dev-v${ VERSION }
2018-08-17 08:28:15 +00:00
2018-09-10 22:16:23 +00:00
# build Cypress UI testing :cypress docker tag
docker-build-cypress : clean
2019-05-14 19:13:52 +00:00
GOPATH = $( GOPATH) xgo -out statping -go $( GOVERSION) -ldflags " -X main.VERSION= ${ VERSION } -X main.COMMIT= $( TRAVIS_COMMIT) " --targets= linux/amd64 ./cmd
2018-12-04 04:17:29 +00:00
docker build -t hunterlong/statping:cypress -f dev/Dockerfile-cypress .
rm -f statping
2018-09-10 22:16:23 +00:00
2018-12-04 04:17:29 +00:00
# run hunterlong/statping:latest docker image
2018-09-10 22:16:23 +00:00
docker-run : docker -build -latest
2018-12-04 04:17:29 +00:00
docker run -it -p 8080:8080 hunterlong/statping:latest
2018-09-10 22:16:23 +00:00
2018-12-04 04:17:29 +00:00
# run hunterlong/statping:dev docker image
2018-09-10 22:16:23 +00:00
docker-run-dev : docker -build -dev
2018-12-04 04:17:29 +00:00
docker run -t -p 8080:8080 hunterlong/statping:dev
2018-09-10 22:16:23 +00:00
2018-12-04 04:17:29 +00:00
# run Cypress UI testing, hunterlong/statping:cypress docker image
2018-09-10 22:16:23 +00:00
docker-run-cypress : docker -build -cypress
2018-12-04 04:17:29 +00:00
docker run -t hunterlong/statping:cypress
2018-09-10 22:16:23 +00:00
2018-09-15 02:53:54 +00:00
# push the :base and :base-v{VERSION} tag to Docker hub
docker-push-base :
2018-12-04 04:17:29 +00:00
docker tag hunterlong/statping:base hunterlong/statping:base-v${ VERSION }
docker push hunterlong/statping:base
docker push hunterlong/statping:base-v${ VERSION }
2018-09-15 02:53:54 +00:00
2018-09-10 22:16:23 +00:00
# push the :dev tag to Docker hub
2018-08-21 03:11:40 +00:00
docker-push-dev :
2018-12-04 04:17:29 +00:00
docker push hunterlong/statping:dev
docker push hunterlong/statping:dev-v${ VERSION }
2018-09-06 21:46:45 +00:00
2018-09-10 22:16:23 +00:00
# push the :cypress tag to Docker hub
2018-09-06 21:46:45 +00:00
docker-push-cypress :
2018-12-04 04:17:29 +00:00
docker push hunterlong/statping:cypress
2018-08-19 00:37:00 +00:00
2018-09-10 22:16:23 +00:00
# push the :latest tag to Docker hub
2018-09-12 04:14:22 +00:00
docker-push-latest :
2018-12-04 08:15:33 +00:00
docker tag hunterlong/statping hunterlong/statping:dev
2018-12-04 04:17:29 +00:00
docker push hunterlong/statping:latest
2018-12-04 08:15:33 +00:00
docker push hunterlong/statping:dev
2018-12-04 04:17:29 +00:00
docker push hunterlong/statping:v${ VERSION }
2018-08-21 17:08:58 +00:00
2018-09-19 06:12:42 +00:00
docker-run-mssql :
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=PaSsW0rD123' -p 1433:1433 -d microsoft/mssql-server-linux
2018-09-10 22:16:23 +00:00
# create Postgres, and MySQL instance using Docker (used for testing)
2018-08-14 05:10:51 +00:00
databases :
2018-12-04 04:17:29 +00:00
docker run --name statping_postgres -p 5432:5432 -e POSTGRES_PASSWORD = password123 -e POSTGRES_USER = root -e POSTGRES_DB = root -d postgres
docker run --name statping_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD = password123 -e MYSQL_DATABASE = root -d mysql
2018-08-14 05:10:51 +00:00
sleep 30
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# install all required golang dependecies
2018-10-06 05:00:40 +00:00
dev-deps :
2019-12-29 21:52:19 +00:00
go get github.com/stretchr/testify/assert
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go install github.com/mattn/goveralls
go get github.com/rendon/testcli
go get github.com/robertkrimen/godocdown/godocdown
go get github.com/crazy-max/xgo
go get github.com/GeertJohan/go.rice
go get github.com/GeertJohan/go.rice/rice
go install github.com/GeertJohan/go.rice/rice
go get github.com/axw/gocov/gocov
go get github.com/matm/gocov-html
go get github.com/fatih/structs
go get github.com/ararog/timeago
go get gopkg.in/natefinch/lumberjack.v2
go get golang.org/x/crypto/bcrypt
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# remove files for a clean compile/build
2018-08-14 04:13:06 +00:00
clean :
2019-12-29 21:06:12 +00:00
rm -rf ./{ logs,assets,plugins,*.db,config.yml,.sass-cache,config.yml,statping,build,.sass-cache,index.html,vendor}
rm -rf cmd/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,*.html,*.json}
rm -rf core/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf handlers/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf notifiers/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf source/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf types/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf utils/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log}
rm -rf dev/{ logs,assets,plugins,*.db,config.yml,.sass-cache,*.log,test/app,plugin/*.so}
2018-11-29 04:47:35 +00:00
rm -rf { parts,prime,snap,stage}
2018-08-19 08:48:02 +00:00
rm -rf dev/test/cypress/videos
2018-08-25 16:10:28 +00:00
rm -f coverage.* sass
2018-11-07 09:28:46 +00:00
rm -f source/rice-box.go
2019-12-19 16:48:59 +00:00
rm -rf **/*.db-journal
2018-11-29 04:47:35 +00:00
rm -rf *.snap
2018-08-30 04:49:44 +00:00
find . -name "*.out" -type f -delete
find . -name "*.cpu" -type f -delete
find . -name "*.mem" -type f -delete
2018-12-19 19:07:05 +00:00
rm -rf build
2018-08-14 04:13:06 +00:00
2018-09-10 22:16:23 +00:00
# tag version using git
2018-08-14 04:13:06 +00:00
tag :
2018-11-29 04:47:35 +00:00
git tag v${ VERSION } --force
2018-08-14 04:13:06 +00:00
2018-12-20 00:53:14 +00:00
generate :
cd source && go generate
2019-06-06 17:51:42 +00:00
cd handlers/graphql && go generate
2018-12-20 00:53:14 +00:00
2018-09-10 22:16:23 +00:00
# compress built binaries into tar.gz and zip formats
2018-08-14 04:13:06 +00:00
compress :
2018-08-15 05:30:15 +00:00
cd build && mv alpine-linux-amd64 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-alpine.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-darwin-10.6-amd64 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -osx-x64.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-darwin-10.6-386 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -osx-x32.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-linux-amd64 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-x64.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-linux-386 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-x32.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-windows-6.0-amd64.exe $( BINARY_NAME) .exe
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME) .exe
cd build && zip $( BINARY_NAME) -windows-x64.zip $( BINARY_NAME) .exe statping.asc && rm -f $( BINARY_NAME) .exe statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-linux-arm-7 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-arm7.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-11-29 05:05:04 +00:00
cd build && mv cmd-linux-arm-6 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-arm6.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 05:30:15 +00:00
cd build && mv cmd-linux-arm64 $( BINARY_NAME)
2018-12-04 04:17:29 +00:00
cd build && gpg --default-key $( SIGN_KEY) --batch --detach-sign --output statping.asc --armor $( BINARY_NAME)
cd build && tar -czvf $( BINARY_NAME) -linux-arm64.tar.gz $( BINARY_NAME) statping.asc && rm -f $( BINARY_NAME) statping.asc
2018-08-15 08:08:50 +00:00
2018-09-10 22:16:23 +00:00
# push the :dev docker tag using curl
2018-08-16 06:22:20 +00:00
publish-dev :
curl -H "Content-Type: application/json" --data '{"docker_tag": "dev"}' -X POST $( DOCKER)
2018-09-10 22:16:23 +00:00
# update the homebrew application to latest for mac
2018-08-16 06:22:20 +00:00
publish-homebrew :
2018-12-04 04:17:29 +00:00
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/hunterlong%2Fhomebrew-statping/requests
2018-08-16 06:22:20 +00:00
2018-09-10 22:16:23 +00:00
# install NPM reuqirements for cypress testing
2018-08-17 08:28:15 +00:00
cypress-install :
2018-08-19 22:16:59 +00:00
cd dev/test && npm install
2018-08-16 06:22:20 +00:00
2018-09-10 22:16:23 +00:00
# run Cypress UI testing
2018-08-17 08:59:01 +00:00
cypress-test : clean cypress -install
2018-08-19 08:48:02 +00:00
cd dev/test && npm test
2018-08-17 01:43:12 +00:00
2019-12-29 21:01:53 +00:00
upload_to_s3 :
aws s3 cp ./source/css $( ASSETS_BKT) --recursive --exclude "*" --include "*.css"
aws s3 cp ./source/js $( ASSETS_BKT) --recursive --exclude "*" --include "*.js"
aws s3 cp ./source/font $( ASSETS_BKT) --recursive --exclude "*" --include "*.eot" --include "*.svg" --include "*.woff" --include "*.woff2" --include "*.ttf" --include "*.css"
aws s3 cp ./source/scss $( ASSETS_BKT) --recursive --exclude "*" --include "*.scss"
2019-12-29 21:30:25 +00:00
aws s3 cp ./install.sh $( ASSETS_BKT)
2019-12-29 21:01:53 +00:00
travis_s3_creds :
mkdir -p ~/.aws
echo " [default]\naws_access_key_id = ${ AWS_ACCESS_KEY_ID } \naws_secret_access_key = ${ AWS_SECRET_ACCESS_KEY } " > ~/.aws/credentials
2018-12-04 04:17:29 +00:00
# build Statping using a travis ci trigger
2019-12-29 21:01:53 +00:00
travis-build : travis_s 3_creds upload_to_s 3
2018-12-04 04:17:29 +00:00
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%2Fstatping/requests
2018-11-18 00:09:39 +00:00
curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $( DOCKER)
2018-08-17 16:13:20 +00:00
2018-12-04 19:13:24 +00:00
snapcraft-build : build -all
2018-11-29 04:47:35 +00:00
PWD = $( shell pwd )
cp build/$( BINARY_NAME) -linux-x64.tar.gz build/$( BINARY_NAME) -linux.tar.gz
2018-12-04 04:17:29 +00:00
snapcraft clean statping -s pull
2018-11-29 04:47:35 +00:00
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
2018-12-04 04:17:29 +00:00
snapcraft clean statping -s pull
2018-11-29 04:47:35 +00:00
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
2018-12-04 04:17:29 +00:00
snapcraft clean statping -s pull
2018-11-29 04:47:35 +00:00
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
2018-12-04 04:17:29 +00:00
snapcraft clean statping -s pull
2018-11-29 04:47:35 +00:00
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 :
2018-12-12 19:45:11 +00:00
snapcraft push statping_${ VERSION } _arm64.snap --release stable
snapcraft push statping_${ VERSION } _i386.snap --release stable
snapcraft push statping_${ VERSION } _armhf.snap --release stable
2018-11-28 22:35:49 +00:00
2018-11-29 21:31:41 +00:00
sign-all :
2018-12-04 19:13:24 +00:00
gpg --default-key $SIGN_KEY --detach-sign --armor statpinger
2018-11-29 21:31:41 +00:00
valid-sign :
2018-12-04 10:13:08 +00:00
gpg --verify statping.asc
2018-11-29 21:31:41 +00:00
2018-09-10 22:16:23 +00:00
# install xgo and pull the xgo docker image
2018-08-19 08:48:02 +00:00
xgo-install : clean
2019-11-05 19:27:49 +00:00
go get github.com/crazy-max/xgo
docker pull crazy-max/xgo:${ GOVERSION }
2018-08-19 08:48:02 +00:00
2018-12-20 05:01:03 +00:00
heroku :
git push heroku master
heroku container:push web
heroku container:release web
2019-12-31 09:20:42 +00:00
checkall :
golangci-lint run ./...
2018-12-04 19:13:24 +00:00
.PHONY : all build build -all build -alpine test -all test test -api docker
2019-12-29 21:01:53 +00:00
.SILENT : travis_s 3_creds