VERSION=$(shell cat version.txt) SIGN_KEY=B76D61FAA6DB759466E83D9964B9C6AAE2D55278 BINARY_NAME=statping GOBUILD=go build -a GOVERSION=1.13.5 XGO=xgo -go $(GOVERSION) --dest=build BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT)" TRVIS_SECRET=lRqWSt5BoekFK6+padJF+b77YkGdispPXEUKNuD7/Hxb7yJMoI8T/n8xZrTHtCZPdjtpy7wIlJCezNoYEZB3l2GnD6Y1QEZEXF7MIxP7hwsB/uSc5/lgdGW0ZLvTBfv6lwI/GjQIklPBW/4xcKJtj4s1YBP7xvqyIb/lDN7TiOqAKF4gqRVVfsxvlkm7j4TiPCXtz17hYQfU8kKBbd+vd3PuZgdWqs//5RwKk3Ld8QR8zoo9xXQVC5NthiyVbHznzczBsHy2cRZZoWxyi7eJM1HrDw8Jn/ivJONIHNv3RgFVn2rAoKu1X8F6FyuvPO0D2hWC62mdO/e0kt4X0mn9/6xlLSKwrHir67UgNVQe3tvlH0xNKh+yNZqR5x9t0V54vNks6Pgbhas5EfLHoWn5cF4kbJzqkXeHjt1msrsqpA3HKbmtwwjJr4Slotfiu22mAhqLSOV+xWV+IxrcNnrEq/Pa+JAzU12Uyxs8swaLJGPRAlWnJwzL9HK5aOpN0sGTuSEsTwj0WxeMMRx25YEq3+LZOgwOy3fvezmeDnKuBZa6MVCoMMpx1CRxMqAOlTGZXHjj+ZPmqDUUBpzAsFSzIdVRgcnDlLy7YRiz3tVWa1G5S07l/VcBN7ZgvCwOWZ0QgOH0MxkoDfhrfoMhNO6MBFDTRKCEl4TroPEhcInmXU8= 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": { "os": [ "linux" ], "language": "go", "go": [ "${GOVERSION}" ], "go_import_path": "github.com/hunterlong/statping", "install": true, "sudo": "required", "services": [ "docker" ], "env": { "VERSION": "${VERSION}", "secure": "${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": "$$TAG_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" ] } } }' TEST_DIR=$(GOPATH)/src/github.com/hunterlong/statping PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH) up: docker-base docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml up -d --remove-orphans --build down: docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml down --volumes logs: docker logs statping --follow console: docker exec -t -i statping /bin/sh docker-base: docker build -t hunterlong/statping:base -f Dockerfile.base --build-arg VERSION=${VERSION} . docker-latest: docker-base docker build -t hunterlong/statping:latest --build-arg VERSION=${VERSION} . docker-vue: docker build -t hunterlong/statping:vue --build-arg VERSION=${VERSION} . top: docker-compose -f docker-compose.yml -f dev/docker-compose.full.yml top frontend-build: cd frontend && rm -rf dist && yarn build rm -rf source/dist && cp -r frontend/dist source/ && cp -r frontend/src/assets/scss source/dist/ cp -r source/tmpl/*.* source/dist/ # compile assets using SASS and Rice. compiles scss -> css, and run rice embed-go compile: generate cd source && rice embed-go build: $(GOBUILD) $(BUILDVERSION) -o $(BINARY_NAME) ./cmd install: mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME) generate: cd source && go generate cd handlers/graphql && go generate # remove files for a clean compile/build clean: 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} rm -rf {parts,prime,snap,stage} rm -rf dev/test/cypress/videos rm -f coverage.* sass rm -f source/rice-box.go rm -rf **/*.db-journal rm -rf *.snap find . -name "*.out" -type f -delete find . -name "*.cpu" -type f -delete find . -name "*.mem" -type f -delete rm -rf {build,tmp,docker} # install all required golang dependecies dev-deps: 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 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 .PHONY: all build build-all build-alpine test-all test test-api docker frontend up down .SILENT: travis_s3_creds