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