mirror of https://github.com/statping/statping
makefile with travis - logs
parent
2109e2822f
commit
155a98ac92
|
@ -0,0 +1,11 @@
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile-dev
|
||||||
|
Makefile
|
||||||
|
.travis.yml
|
||||||
|
.travis
|
||||||
|
servers
|
||||||
|
build
|
||||||
|
logs
|
||||||
|
coverage.out
|
35
.travis.yml
35
.travis.yml
|
@ -34,19 +34,19 @@ matrix:
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- git config --local user.name "hunterlong"
|
- git config --local user.name "hunterlong"
|
||||||
- git config --local user.email "info@socialeck.com"
|
- git config --local user.email "info@socialeck.com"
|
||||||
- git tag "v$VERSION" --force
|
- make tag
|
||||||
deploy:
|
deploy:
|
||||||
- provider: releases
|
- provider: releases
|
||||||
api_key: $GH_TOKEN
|
api_key: $GH_TOKEN
|
||||||
file:
|
file:
|
||||||
- "cmd/build/statup-osx-x64.tar.gz"
|
- "build/statup-osx-x64.tar.gz"
|
||||||
- "cmd/build/statup-osx-x32.tar.gz"
|
- "build/statup-osx-x32.tar.gz"
|
||||||
- "cmd/build/statup-linux-x64.tar.gz"
|
- "build/statup-linux-x64.tar.gz"
|
||||||
- "cmd/build/statup-linux-x32.tar.gz"
|
- "build/statup-linux-x32.tar.gz"
|
||||||
- "cmd/build/statup-linux-arm64.tar.gz"
|
- "build/statup-linux-arm64.tar.gz"
|
||||||
- "cmd/build/statup-linux-arm7.tar.gz"
|
- "build/statup-linux-arm7.tar.gz"
|
||||||
- "cmd/build/statup-linux-alpine.tar.gz"
|
- "build/statup-linux-alpine.tar.gz"
|
||||||
- "cmd/build/statup-windows-x64.zip"
|
- "build/statup-windows-x64.zip"
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
@ -55,24 +55,15 @@ notifications:
|
||||||
before_script:
|
before_script:
|
||||||
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||||
- psql -c 'create database test;' -U postgres
|
- psql -c 'create database test;' -U postgres
|
||||||
- go get github.com/stretchr/testify/assert
|
- make deps
|
||||||
- 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/karalabe/xgo
|
|
||||||
- go get github.com/GeertJohan/go.rice
|
|
||||||
- go get github.com/GeertJohan/go.rice/rice
|
|
||||||
- cd cmd && go get && cd $GOPATH/src/github.com/hunterlong/statup
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- /bin/bash -c .travis/compile.sh
|
- make test
|
||||||
- go test -v ./... -p 1 -ldflags="-X main.VERSION=$VERSION" -covermode=count -coverprofile=coverage.out
|
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then make coverage; fi
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $COVERALLS; fi
|
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then travis_wait 30 docker pull karalabe/xgo-latest; fi
|
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then travis_wait 30 docker pull karalabe/xgo-latest; fi
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then /bin/bash -c .travis/build.sh; fi
|
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then make release; fi
|
||||||
|
|
||||||
after_deploy:
|
after_deploy:
|
||||||
- /bin/bash -c .travis/deploy.sh
|
- /bin/bash -c .travis/deploy.sh
|
||||||
|
|
25
Makefile
25
Makefile
|
@ -1,5 +1,4 @@
|
||||||
VERSION=0.37
|
VERSION=0.37
|
||||||
GOPATH=$(HOME)/go
|
|
||||||
GOCMD=/usr/local/bin/go
|
GOCMD=/usr/local/bin/go
|
||||||
GOBUILD=$(GOCMD) build
|
GOBUILD=$(GOCMD) build
|
||||||
GOCLEAN=$(GOCMD) clean
|
GOCLEAN=$(GOCMD) clean
|
||||||
|
@ -14,7 +13,7 @@ PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
|
||||||
|
|
||||||
all: deps compile install clean
|
all: deps compile install clean
|
||||||
|
|
||||||
release: build-all compress
|
release: deps build-all compress
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
|
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
|
||||||
|
@ -30,14 +29,15 @@ compile:
|
||||||
cd source && $(GOPATH)/bin/rice embed-go
|
cd source && $(GOPATH)/bin/rice embed-go
|
||||||
$(GOPATH)/bin/wt compile source/scss/base.scss -b source/css
|
$(GOPATH)/bin/wt compile source/scss/base.scss -b source/css
|
||||||
|
|
||||||
test: test-env
|
test: compile test-env
|
||||||
$(GOTEST) ./... -p 1 -ldflags="-X main.VERSION=$(VERSION)" -coverprofile=coverage.out -v
|
$(GOTEST) ./... -p 1 -ldflags="-X main.VERSION=$(VERSION)" -coverprofile=coverage.out -v
|
||||||
|
|
||||||
test-all: test-env
|
test-all: compile test-env databases
|
||||||
docker run --name statup_postgres -p 5432:5432 -e POSTGRES_PASSWORD=password123 -e POSTGRES_USER=root -e POSTGRES_DB=root -d postgres
|
|
||||||
docker run --name statup_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password123 -e MYSQL_DATABASE=root -d mysql
|
|
||||||
$(GOTEST) ./... -p 1 -ldflags="-X main.VERSION=$(VERSION)" -coverprofile=coverage.out -v
|
$(GOTEST) ./... -p 1 -ldflags="-X main.VERSION=$(VERSION)" -coverprofile=coverage.out -v
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
||||||
|
|
||||||
build-all: clean compile
|
build-all: clean compile
|
||||||
mkdir build
|
mkdir build
|
||||||
$(XGO) $(BUILDVERSION) --targets=darwin/amd64 ./cmd
|
$(XGO) $(BUILDVERSION) --targets=darwin/amd64 ./cmd
|
||||||
|
@ -56,10 +56,15 @@ docker-dev:
|
||||||
$(DOCKER) build -t hunterlong/statup:dev -f Dockerfile-dev .
|
$(DOCKER) build -t hunterlong/statup:dev -f Dockerfile-dev .
|
||||||
|
|
||||||
docker-run: docker
|
docker-run: docker
|
||||||
$(DOCKER) run -it -p 8080:8080 hunterlong/statup:latest
|
$(DOCKER) run -t -p 8080:8080 hunterlong/statup:latest
|
||||||
|
|
||||||
docker-dev-run: docker-dev
|
docker-dev-run: docker-dev
|
||||||
$(DOCKER) run -it -p 8080:8080 hunterlong/statup:dev
|
$(DOCKER) run -t -p 8080:8080 hunterlong/statup:dev
|
||||||
|
|
||||||
|
databases:
|
||||||
|
$(DOCKER) run --name statup_postgres -p 5432:5432 -e POSTGRES_PASSWORD=password123 -e POSTGRES_USER=root -e POSTGRES_DB=root -d postgres
|
||||||
|
$(DOCKER) run --name statup_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password123 -e MYSQL_DATABASE=root -d mysql
|
||||||
|
sleep 30
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
$(GOGET) github.com/wellington/wellington/wt
|
$(GOGET) github.com/wellington/wellington/wt
|
||||||
|
@ -121,6 +126,4 @@ compress:
|
||||||
mv build/cmd-linux-arm-7 build/$(BINARY_NAME)
|
mv build/cmd-linux-arm-7 build/$(BINARY_NAME)
|
||||||
tar -czvf build/$(BINARY_NAME)-linux-arm7.tar.gz build/$(BINARY_NAME) && rm -f build/$(BINARY_NAME)
|
tar -czvf build/$(BINARY_NAME)-linux-arm7.tar.gz build/$(BINARY_NAME) && rm -f build/$(BINARY_NAME)
|
||||||
mv build/cmd-linux-arm64 build/$(BINARY_NAME)
|
mv build/cmd-linux-arm64 build/$(BINARY_NAME)
|
||||||
tar -czvf build/$(BINARY_NAME)-linux-arm64.tar.gz build/$(BINARY_NAME) && rm -f build/$(BINARY_NAME)
|
tar -czvf build/$(BINARY_NAME)-linux-arm64.tar.gz build/$(BINARY_NAME) && rm -f build/$(BINARY_NAME)
|
||||||
|
|
||||||
.PHONY: deps compile build-all
|
|
|
@ -319,6 +319,7 @@ HTML, BODY {
|
||||||
transform: scale(1); }
|
transform: scale(1); }
|
||||||
100% {
|
100% {
|
||||||
transform: scale(1); } }
|
transform: scale(1); } }
|
||||||
|
|
||||||
.pulse {
|
.pulse {
|
||||||
animation-name: pulse_animation;
|
animation-name: pulse_animation;
|
||||||
animation-duration: 1500ms;
|
animation-duration: 1500ms;
|
||||||
|
@ -335,6 +336,7 @@ HTML, BODY {
|
||||||
100% {
|
100% {
|
||||||
transform: scale(2);
|
transform: scale(2);
|
||||||
opacity: 0; } }
|
opacity: 0; } }
|
||||||
|
|
||||||
.pulse-glow {
|
.pulse-glow {
|
||||||
animation-name: glow-grown;
|
animation-name: glow-grown;
|
||||||
animation-duration: 100ms;
|
animation-duration: 100ms;
|
||||||
|
@ -357,66 +359,49 @@ HTML, BODY {
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
HTML, BODY {
|
HTML, BODY {
|
||||||
background-color: #fcfcfc; }
|
background-color: #fcfcfc; }
|
||||||
|
|
||||||
.sm-container {
|
.sm-container {
|
||||||
margin-top: 40px !important;
|
margin-top: 40px !important;
|
||||||
padding: 0 !important; }
|
padding: 0 !important; }
|
||||||
|
|
||||||
.list-group-item H5 {
|
.list-group-item H5 {
|
||||||
font-size: 0.9rem; }
|
font-size: 0.9rem; }
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
padding: 0 !important; }
|
padding: 0 !important; }
|
||||||
|
|
||||||
.navbar {
|
.navbar {
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 0; }
|
margin-bottom: 0; }
|
||||||
|
|
||||||
.btn-sm {
|
.btn-sm {
|
||||||
line-height: 0.9rem;
|
line-height: 0.9rem;
|
||||||
font-size: 0.65rem; }
|
font-size: 0.65rem; }
|
||||||
|
|
||||||
.full-col-12 {
|
.full-col-12 {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 0px; }
|
padding-right: 0px; }
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0rem;
|
border-radius: 0rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: #ffffff; }
|
background-color: #ffffff; }
|
||||||
|
|
||||||
.card-body {
|
.card-body {
|
||||||
font-size: 6pt;
|
font-size: 6pt;
|
||||||
padding: 5px 5px; }
|
padding: 5px 5px; }
|
||||||
|
|
||||||
.lg_number {
|
.lg_number {
|
||||||
font-size: 1.5rem; }
|
font-size: 1.5rem; }
|
||||||
|
|
||||||
.stats_area {
|
.stats_area {
|
||||||
margin-top: 1.5rem !important;
|
margin-top: 1.5rem !important;
|
||||||
margin-bottom: 1.5rem !important; }
|
margin-bottom: 1.5rem !important; }
|
||||||
|
|
||||||
.stats_area .col-4 {
|
.stats_area .col-4 {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
font-size: 0.6rem; }
|
font-size: 0.6rem; }
|
||||||
|
|
||||||
.list-group-item {
|
.list-group-item {
|
||||||
border-top: 1px solid #e4e4e4;
|
border-top: 1px solid #e4e4e4;
|
||||||
border: 0px; }
|
border: 0px; }
|
||||||
|
|
||||||
.list-group-item:first-child {
|
.list-group-item:first-child {
|
||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-top-right-radius: 0; }
|
border-top-right-radius: 0; }
|
||||||
|
|
||||||
.list-group-item:last-child {
|
.list-group-item:last-child {
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
border-bottom-left-radius: 0; }
|
border-bottom-left-radius: 0; }
|
||||||
|
|
||||||
.list-group-item P {
|
.list-group-item P {
|
||||||
font-size: 0.7rem; } }
|
font-size: 0.7rem; } }
|
||||||
|
|
||||||
/*# sourceMappingURL=base.css.map */
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -28,20 +28,20 @@ func Assets() {
|
||||||
|
|
||||||
func CompileSASS(folder string) error {
|
func CompileSASS(folder string) error {
|
||||||
sassBin := os.Getenv("SASS")
|
sassBin := os.Getenv("SASS")
|
||||||
shell := os.Getenv("CMD_FILE")
|
|
||||||
|
|
||||||
scssFile := fmt.Sprintf("%v/%v", folder, "assets/scss/base.scss")
|
scssFile := fmt.Sprintf("%v/%v", folder, "assets/scss/base.scss")
|
||||||
baseFile := fmt.Sprintf("%v/%v", folder, "assets/css/base.css")
|
baseFile := fmt.Sprintf("%v/%v", folder, "assets/css/base.css")
|
||||||
|
|
||||||
utils.Log(1, fmt.Sprintf("Compiling SASS %v into %v", scssFile, baseFile))
|
utils.Log(1, fmt.Sprintf("Compiling SASS %v into %v", scssFile, baseFile))
|
||||||
command := fmt.Sprintf("%v %v %v", sassBin, scssFile, baseFile)
|
command := fmt.Sprintf("%v %v %v", sassBin, scssFile, baseFile)
|
||||||
testCmd := exec.Command(shell, command)
|
testCmd := exec.Command("bash", "-c", command)
|
||||||
_, err := testCmd.Output()
|
out, err := testCmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Log(3, fmt.Sprintf("Failed to compile assets with SASS %v", err))
|
utils.Log(3, fmt.Sprintf("Failed to compile assets with SASS %v", err))
|
||||||
utils.Log(3, fmt.Sprintf("%v %v %v", sassBin, scssFile, baseFile))
|
utils.Log(3, fmt.Sprintf("%v %v %v", sassBin, scssFile, baseFile))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
utils.Log(1, string(out))
|
||||||
utils.Log(1, "SASS Compiling is complete!")
|
utils.Log(1, "SASS Compiling is complete!")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func TestCreateAssets(t *testing.T) {
|
||||||
|
|
||||||
func TestCompileSASS(t *testing.T) {
|
func TestCompileSASS(t *testing.T) {
|
||||||
t.SkipNow()
|
t.SkipNow()
|
||||||
os.Setenv("SASS", "sass")
|
//os.Setenv("SASS", "sass")
|
||||||
os.Setenv("CMD_FILE", dir+"/cmd.sh")
|
os.Setenv("CMD_FILE", dir+"/cmd.sh")
|
||||||
assert.Nil(t, CompileSASS(dir))
|
assert.Nil(t, CompileSASS(dir))
|
||||||
assert.True(t, HasAssets(dir))
|
assert.True(t, HasAssets(dir))
|
||||||
|
|
10
utils/log.go
10
utils/log.go
|
@ -19,9 +19,13 @@ var (
|
||||||
|
|
||||||
func InitLogs() error {
|
func InitLogs() error {
|
||||||
var err error
|
var err error
|
||||||
|
_, err = os.Stat(Directory + "/logs")
|
||||||
if _, err := os.Stat(Directory + "/logs"); os.IsNotExist(err) {
|
if err != nil {
|
||||||
os.Mkdir(Directory+"/logs", 0777)
|
if os.IsNotExist(err) {
|
||||||
|
os.Mkdir(Directory+"/logs", 0777)
|
||||||
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.Create(Directory + "/logs/statup.log")
|
file, err := os.Create(Directory + "/logs/statup.log")
|
||||||
|
|
Loading…
Reference in New Issue