cypress testing - makefile - sass - dep

pull/49/head
Hunter Long 2018-08-17 01:28:15 -07:00
parent 52684c5d81
commit 65998c59f6
33 changed files with 2329 additions and 171 deletions

31
.dev/Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM golang:1.10.3-alpine
LABEL maintainer "Hunter Long (https://github.com/hunterlong)"
# Statup 'test' image for running a full test using the production environment
ENV VERSION=$(VERSION)
RUN apk add --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget
RUN wget -q https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
chmod +x dep-linux-amd64 && \
mv dep-linux-amd64 /usr/local/bin/dep
WORKDIR $GOPATH/src/github.com/hunterlong/statup
COPY . .
RUN wget -q https://assets.statup.io/sass && \
chmod +x sass && \
mv sass /usr/local/bin/sass
RUN dep ensure && \
go get github.com/GeertJohan/go.rice/rice
RUN cd cmd && go build -ldflags "-X main.VERSION=$VERSION" && mv cmd /usr/local/bin/statup
ENV IS_DOCKER=true
WORKDIR /app
ADD ./Makefile .
EXPOSE 8080
ENTRYPOINT statup

12
.dev/test/cypress.json Normal file
View File

@ -0,0 +1,12 @@
{
"projectId": "bi8mhr",
"env": {
"DB_HOST": "localhost",
"DB_USER": "root",
"DB_DATABASE": "root",
"DB_PORT": "5432",
"DB_PASS": "password123",
"GO_ENV": "production"
},
"chromeWebSecurity": false
}

View File

@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@ -0,0 +1,48 @@
context('Setup Process', () => {
// it('should go to setup Statup with Postgres', () => {
// cy.visit('http://localhost:8080')
// cy.get('select[name=db_connection]').select('postgres')
// cy.get('input[name="db_host"]').clear().type(Cypress.env('DB_HOST'))
// cy.get('input[name="db_port"]').clear().type('5432')
// cy.get('input[name="db_user"]').clear().type(Cypress.env('DB_USER'))
// if (Cypress.env('TRAVIS')==="yes") {
// cy.get('input[name="db_password"]').clear()
// } else {
// cy.get('input[name="db_password"]').clear().type(Cypress.env('DB_PASS'))
// }
// cy.get('input[name="db_database"]').clear().type(Cypress.env('DB_DATABASE'))
// cy.get('input[name="project"]').clear().type('Demo Tester')
// cy.get('input[name="description"]').clear().type('This is a test from Crypress!')
// cy.get('input[name="domain"]').clear().type('http://localhost:8080')
// cy.get('input[name="username"]').clear().type('admin')
// cy.get('input[name="email"]').clear().type('info@domain.com')
// cy.get('input[name="password"]').clear().type('admin')
// cy.scrollTo('bottom')
// cy.get('#setup_button').click().wait(10000)
// cy.get('.header-title').should('contain', 'Demo Tester')
// cy.get('.header-desc').should('contain', 'This is a test from Crypress!')
// cy.scrollTo('bottom')
// cy.get('.service_li').should('have.length', 5)
// cy.get('.card').should('have.length', 5)
// })
it('should go to setup Statup with SQLite', () => {
cy.visit('http://localhost:8080')
cy.get('select[name=db_connection]').select('sqlite')
cy.get('input[name="project"]').clear().type('Demo Tester')
cy.get('input[name="description"]').clear().type('This is a test from Crypress!')
cy.get('input[name="domain"]').clear().type('http://localhost:8080')
cy.get('input[name="username"]').clear().type('admin')
cy.get('input[name="email"]').clear().type('info@domain.com')
cy.get('input[name="password"]').clear().type('admin')
cy.scrollTo('bottom')
cy.get('#setup_button').click().wait(10000)
cy.get('.header-title').should('contain', 'Demo Tester')
cy.get('.header-desc').should('contain', 'This is a test from Crypress!')
cy.scrollTo('bottom')
cy.get('.service_li').should('have.length', 5)
cy.get('.card').should('have.length', 5)
})
})

View File

@ -0,0 +1,39 @@
context('Asset Tests', () => {
beforeEach(function () {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should create local assets', () => {
cy.visit('http://localhost:8080/settings/build')
cy.get('#v-pills-style-tab').click()
cy.wait(500)
cy.get(':nth-child(2) > .CodeMirror-line').should('contain', '$background-color')
})
it('should save assets form', () => {
cy.request({method: 'POST', url: 'http://localhost:8080/settings/css', form: true, body: {
variables: '$tester: #bababa',
theme: '@import \'variables\'; .test-var { color: $tester; }'
}})
})
it('should check css file', () => {
cy.request('http://localhost:8080/css/base.css').its('body').should('contain', '.test-var')
})
it('should delete assets', () => {
cy.visit('http://localhost:8080/settings')
cy.get('#v-pills-style-tab').click()
cy.wait(500)
cy.get('.btn-danger').click()
})
it('should check css file after delete', () => {
cy.request('http://localhost:8080/css/base.css').its('body').should('contain', 'BODY')
})
});

View File

@ -0,0 +1,24 @@
context('Dashboard Tests', () => {
beforeEach(function() {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should view logs', () => {
cy.visit('http://localhost:8080/settings')
cy.get(':nth-child(5) > .nav-link').click()
cy.wait(10000)
cy.get('#live_logs').should('contain', 'Service')
})
it('should view help', () => {
cy.visit('http://localhost:8080/settings')
cy.get(':nth-child(6) > .nav-link').click()
cy.title().should('eq', 'Statup | Help')
cy.get('.col-12 > :nth-child(1)').should('contain', 'Statup')
})
});

View File

@ -0,0 +1,34 @@
context('Service Tests', () => {
beforeEach(function () {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should view services', () => {
cy.visit('http://localhost:8080/services')
cy.get('tr').should('have.length', 6)
cy.title().should('eq', 'Statup | Services')
})
it('should create services', () => {
cy.visit('http://localhost:8080/services')
cy.get('input[name="name"]').type('Google.com')
cy.get('input[name="domain"]').type('https://google.com')
cy.get('input[name="interval"]').type('30')
cy.get('form').submit()
cy.title().should('eq', 'Statup | Services')
cy.get('tr').should('have.length', 7)
})
it('should delete a service', () => {
cy.visit('http://localhost:8080/services')
cy.get(':nth-child(5) > .text-right > .btn-group > .btn-danger').click()
cy.title().should('eq', 'Statup | Services')
cy.get('tr').should('have.length', 6)
})
});

View File

@ -0,0 +1,25 @@
context('Settings Forms', () => {
beforeEach(function() {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should edit main settings', () => {
cy.visit('http://localhost:8080/settings')
cy.get('input[name="project"]').clear().type('Project Updated')
cy.get('input[name="description"]').clear().type('This is an awesome page')
cy.get('input[name="domain"]').clear().type('http://0.0.0.0:8080')
cy.get('textarea[name="footer"]').clear().type('This is a custom footer')
cy.get('#v-pills-home > form').submit()
cy.title().should('eq', 'Statup | Settings')
cy.get('input[name="project"]').should('have.value', 'Project Updated')
cy.get('input[name="description"]').should('have.value', 'This is an awesome page')
cy.get('input[name="domain"]').should('have.value', 'http://0.0.0.0:8080')
cy.get('.footer').should('contain', 'This is a custom footer')
})
});

View File

@ -0,0 +1,32 @@
context('User Testing', () => {
beforeEach(function () {
cy.visit('http://localhost:8080/dashboard')
cy.get('input[name="username"]').type('admin')
cy.get('input[name="password"]').type('admin')
cy.get('form').submit()
})
it('should view users', () => {
cy.visit('http://localhost:8080/users')
cy.get('tr').should('have.length', 2)
cy.title().should('eq', 'Statup | Users')
})
it('should create a new user', () => {
cy.visit('http://localhost:8080/users')
cy.get('input[name="username"]').type('hunterlong')
cy.get('input[name="email"]').type('info@yayaya.com')
cy.get('input[name="password"]').type('admin')
cy.get('input[name="password_confirm"]').type('admin')
cy.get('form').submit()
cy.get('tr').should('have.length', 3)
})
it('should delete a user', () => {
cy.visit('http://localhost:8080/users')
cy.get('#user_2 > .btn-group > .btn-danger').click()
cy.get('tr').should('have.length', 2)
})
});

View File

@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

View File

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1617
.dev/test/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
.dev/test/package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "statup-testing",
"version": "1.0.0",
"description": "Statup Application Testing using Cypress!",
"main": "index.js",
"dependencies": {
"cypress": "^3.1.0"
},
"devDependencies": {
"start-server-and-test": "^1.7.0"
},
"scripts": {
"start": "curl -I -X GET http://localhost:8080/robots.txt",
"cy:run-video": "cypress run --record --key $CYPRESS_KEY",
"cy:run": "cypress run",
"test": "bash -c \"./test.sh\"",
"testnovid": "cypress run",
"open": "cypress open"
},
"author": "Hunter Long",
"license": "ISC"
}

5
.dev/test/release.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
RELEASE_MASTER='{ "request": { "branch": "master", "config": { "script": "make docker-run-test", "services": ["docker"], "before_script": [], "after_deploy": [], "after_success": ["make publish-homebrew", "make publish-latest"], "deploy": [], "before_deploy": [], "env": { "VERSION": "$(VERSION)" } } } }'
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(RELEASE_MASTER) https://api.travis-ci.com/repo/hunterlong%2Fstatup/requests

13
.dev/test/test.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
DIR=`pwd`
DOCKER=/usr/local/bin/docker
$DOCKER build -t hunterlong/statup:dev -f ../Dockerfile ../../
$DOCKER run -it -d -p 8080:8080 -v $DIR/app:/app --name statup_dev hunterlong/statup:dev
./node_modules/.bin/start-server-and-test start http://localhost:8080/robots.txt cy:run
$DOCKER stop statup_dev || true && $DOCKER rm -f statup_dev || true
rm -rf $DIR/app

View File

@ -11,3 +11,5 @@
!/Makefile
!/README.md
!/LICENSE
!/Gopkg.lock
!/Gopkg.toml

5
.gitignore vendored
View File

@ -14,3 +14,8 @@ assets
*.log
.env
logs
.dev/test/node_modules
.dev/test/cypress/videos
.dev/test/cypress/screenshots
.dev/test/app
source/rice-box.go

View File

@ -1,28 +0,0 @@
FROM golang:1.10.3-alpine
LABEL MAINTAINER = 'Hunter Long (https://github.com/hunterlong)'
# Statup 'test' image for running a full test using the production environment
RUN apk add --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers
RUN wget -q https://assets.statup.io/sass && \
chmod +x sass && \
mv sass /usr/local/bin/sass
RUN sass -v
WORKDIR $GOPATH/src/github.com/hunterlong/statup
COPY . .
RUN make deps
RUN make compile
RUN make install
ENV VERSION=$(VERSION)
ENV IS_DOCKER=true
ENV SASS=/usr/local/bin/sass
ENV ONLY_DB=sqlite
ENV STATUP_DIR=/go/src/github.com/hunterlong/statup
ENV GO_ENV=test
EXPOSE 8080
ENTRYPOINT make test

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
APP="statup"
REPO="hunterlong/statup"
cd $GOPATH/src/github.com/hunterlong/statup/cmd
# BUILD STATUP GOLANG BINS
mkdir build
xgo -go 1.10.x --targets=darwin/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=darwin/386 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/386 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=windows-6.0/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/arm-7 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/arm64 --dest=build -ldflags="-X main.VERSION=$VERSION" ./
xgo -go 1.10.x --targets=linux/amd64 --dest=build -ldflags="-X main.VERSION=$VERSION -linkmode external -extldflags -static" -out alpine ./
cd build
ls
mv alpine-linux-amd64 $APP
tar -czvf $APP-linux-alpine.tar.gz $APP && rm -f $APP
mv cmd-darwin-10.6-amd64 $APP
tar -czvf $APP-osx-x64.tar.gz $APP && rm -f $APP
mv cmd-darwin-10.6-386 $APP
tar -czvf $APP-osx-x32.tar.gz $APP && rm -f $APP
mv cmd-linux-amd64 $APP
tar -czvf $APP-linux-x64.tar.gz $APP && rm -f $APP
mv cmd-linux-386 $APP
tar -czvf $APP-linux-x32.tar.gz $APP && rm -f $APP
mv cmd-windows-6.0-amd64.exe $APP.exe
zip $APP-windows-x64.zip $APP.exe && rm -f $APP.exe
mv cmd-linux-arm-7 $APP
tar -czvf $APP-linux-arm7.tar.gz $APP && rm -f $APP
mv cmd-linux-arm64 $APP
tar -czvf $APP-linux-arm64.tar.gz $APP && rm -f $APP
cd $GOPATH/src/github.com/hunterlong/statup

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
cd $GOPATH/src/github.com/hunterlong/statup/source
# RENDERING CSS
gem install sass
sass scss/base.scss css/base.css
# MIGRATION SQL FILE FOR CURRENT VERSION
#printf "UPDATE core SET version='$VERSION';\n" >> source/sql/upgrade.sql
# COMPILE SRC INTO BIN
rice embed-go
cd $GOPATH/src/github.com/hunterlong/statup/cmd
go install
mv $GOPATH/bin/cmd $GOPATH/bin/statup
cd $GOPATH/src/github.com/hunterlong/statup

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
# update homebrew and cypress testing to newest version by building on travis
body='{ "request": { "branch": "master", "config": { "env": { "VERSION": "'$VERSION'" } } } }'
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_API" \
-d "$body" \
https://api.travis-ci.com/repo/hunterlong%2Fstatup-testing/requests
# notify Docker hub to built this branch
if [ "$TRAVIS_BRANCH" == "master" ]
then
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_API" \
-d "$body" \
https://api.travis-ci.com/repo/hunterlong%2Fhomebrew-statup/requests
curl -H "Content-Type: application/json" --data '{"docker_tag": "dev"}' -X POST $DOCKER
else
curl -H "Content-Type: application/json" --data '{"source_type": "Branch", "source_name": "'"$TRAVIS_BRANCH"'"}' -X POST $DOCKER > /dev/null
fi

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
cd .travis
cp Dockerfile.dev ../
cd ../
docker build -t hunterlong/statup:dev -f Dockerfile.dev .
rm -rf Dockerfile.dev

View File

@ -1,5 +1,5 @@
FROM alpine:latest
LABEL MAINTAINER = 'Hunter Long (https://github.com/hunterlong)'
LABEL maintainer "Hunter Long (https://github.com/hunterlong)"
# Locked version of Statup for 'latest' Docker tag
ENV VERSION=v0.45

249
Gopkg.lock generated Normal file
View File

@ -0,0 +1,249 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
digest = "1:65796e5fdb94d94bc0ee6bc422aa3541dbe69ed4da275cb5a27f8fa141f4e35c"
name = "github.com/GeertJohan/go.rice"
packages = [
".",
"embedded",
]
pruneopts = "UT"
revision = "c02ca9a983da5807ddf7d796784928f5be4afd09"
[[projects]]
branch = "master"
digest = "1:4b79025e1eaa5726b92e409a46571f1998b56f0a2d881d6271ca616095eae46e"
name = "github.com/ararog/timeago"
packages = ["."]
pruneopts = "UT"
revision = "e9969cf18b8d5f04cc42f050e8b9968e152cd294"
[[projects]]
branch = "master"
digest = "1:5fd5c4d4282935b7a575299494f2c09e9d2cacded7815c83aff7c1602aff3154"
name = "github.com/daaku/go.zipexe"
packages = ["."]
pruneopts = "UT"
revision = "a5fe2436ffcb3236e175e5149162b41cd28bd27d"
[[projects]]
digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "UT"
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
branch = "master"
digest = "1:14f498fc55a89776c562fa3510aeb7687356944a560c561c0e617af5f9c5f2c7"
name = "github.com/fatih/structs"
packages = ["."]
pruneopts = "UT"
revision = "ebf56d35bba727c68ac77f56f2fcf90b181851aa"
[[projects]]
branch = "master"
digest = "1:70a20b8adf085489a342d033b68b7fc27f4017c51e015b857387249493ee0561"
name = "github.com/go-sql-driver/mysql"
packages = ["."]
pruneopts = "UT"
revision = "99ff426eb706cffe92ff3d058e168b278cabf7c7"
[[projects]]
digest = "1:342378ac4dcb378a5448dd723f0784ae519383532f5e70ade24132c4c8693202"
name = "github.com/go-yaml/yaml"
packages = ["."]
pruneopts = "UT"
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
version = "v2.2.1"
[[projects]]
digest = "1:c79fb010be38a59d657c48c6ba1d003a8aa651fa56b579d959d74573b7dff8e1"
name = "github.com/gorilla/context"
packages = ["."]
pruneopts = "UT"
revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
version = "v1.1.1"
[[projects]]
digest = "1:195b71563f8432dac9d9692aca2a9ae098bc35763999573eb1c7d52a02a47ce7"
name = "github.com/gorilla/mux"
packages = ["."]
pruneopts = "UT"
revision = "cb4698366aa625048f3b815af6a0dea8aef9280a"
[[projects]]
branch = "master"
digest = "1:6e0af49591c81ae6d542fd0ba41ea7206f4242471b384bebd206283b9f38e091"
name = "github.com/gorilla/securecookie"
packages = ["."]
pruneopts = "UT"
revision = "78f3d318a8bf316cda921f25e96fd0b441c5173d"
[[projects]]
digest = "1:0fe783ea0c04c7d13f7c55d8f74b01b17e18a8320e7deecf578b41ef99b27205"
name = "github.com/gorilla/sessions"
packages = ["."]
pruneopts = "UT"
revision = "03b6f63cc43ef9c7240a635a5e22b13180e822b8"
version = "v1.1.1"
[[projects]]
branch = "master"
digest = "1:d166a4b3543a71d87e34767ace94e8b516e79ba45111730306f07c8d6f797f1f"
name = "github.com/joho/godotenv"
packages = ["."]
pruneopts = "UT"
revision = "1709ab122c988931ad53508747b3c061400c2984"
[[projects]]
branch = "master"
digest = "1:caf6db28595425c0e0f2301a00257d11712f65c1878e12cffc42f6b9a9cf3f23"
name = "github.com/kardianos/osext"
packages = ["."]
pruneopts = "UT"
revision = "ae77be60afb1dcacde03767a8c37337fad28ac14"
[[projects]]
branch = "master"
digest = "1:37ce7d7d80531b227023331002c0d42b4b4b291a96798c82a049d03a54ba79e4"
name = "github.com/lib/pq"
packages = [
".",
"oid",
]
pruneopts = "UT"
revision = "90697d60dd844d5ef6ff15135d0203f65d2f53b8"
[[projects]]
branch = "master"
digest = "1:05b7bf6e275fe5d56f479a944d1fd823437f6a2739610ae8359e137690d0a050"
name = "github.com/mattn/go-sqlite3"
packages = ["."]
pruneopts = "UT"
revision = "b3511bfdd742af558b54eb6160aca9446d762a19"
[[projects]]
branch = "master"
digest = "1:3891cc78541df6e4596b3e73978eb062d32967084069270ec881b959be5155ae"
name = "github.com/pkg/errors"
packages = ["."]
pruneopts = "UT"
revision = "816c9085562cd7ee03e7f8188a1cfd942858cded"
[[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:8dd6663207b795abbe94a20d2785c9eb16be59183f5468e8816f98aeda466c7f"
name = "github.com/rendon/testcli"
packages = ["."]
pruneopts = "UT"
revision = "6283090d169f51a2410b4e260341a01c9a4c0ca7"
[[projects]]
digest = "1:18752d0b95816a1b777505a97f71c7467a8445b8ffb55631a7bf779f6ba4fa83"
name = "github.com/stretchr/testify"
packages = ["assert"]
pruneopts = "UT"
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[[projects]]
digest = "1:1ecf2a49df33be51e757d0033d5d51d5f784f35f68e5a38f797b2d3f03357d71"
name = "golang.org/x/crypto"
packages = [
"bcrypt",
"blowfish",
]
pruneopts = "UT"
revision = "c126467f60eb25f8f27e5a981f32a87e3965053f"
[[projects]]
digest = "1:c25289f43ac4a68d88b02245742347c94f1e108c534dda442188015ff80669b3"
name = "google.golang.org/appengine"
packages = ["cloudsql"]
pruneopts = "UT"
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
version = "v1.1.0"
[[projects]]
branch = "v3"
digest = "1:7388652e2215a3f45d341d58766ed58317971030eb1cbd75f005f96ace8e9196"
name = "gopkg.in/alexcesaro/quotedprintable.v3"
packages = ["."]
pruneopts = "UT"
revision = "2caba252f4dc53eaf6b553000885530023f54623"
[[projects]]
branch = "v2"
digest = "1:e096ada745e034a059752c202717baee0379b69db9473a90f59d103c973384cf"
name = "gopkg.in/gomail.v2"
packages = ["."]
pruneopts = "UT"
revision = "81ebce5c23dfd25c6c67194b37d3dd3f338c98b1"
[[projects]]
digest = "1:c805e517269b0ba4c21ded5836019ed7d16953d4026cb7d00041d039c7906be9"
name = "gopkg.in/natefinch/lumberjack.v2"
packages = ["."]
pruneopts = "UT"
revision = "a96e63847dc3c67d17befa69c303767e2f84e54f"
version = "v2.1"
[[projects]]
digest = "1:0d1f3aba6c5c26e67b090b4eed519582fba0dff24d3e486fcb011d84ca3e7806"
name = "upper.io/db.v3"
packages = [
".",
"internal/cache",
"internal/cache/hashstructure",
"internal/immutable",
"internal/sqladapter",
"internal/sqladapter/compat",
"internal/sqladapter/exql",
"lib/reflectx",
"lib/sqlbuilder",
"mysql",
"postgresql",
"sqlite",
]
pruneopts = "UT"
revision = "d90922beee6de3f39c93ed677f6da82565d07154"
version = "v3.5.3"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/GeertJohan/go.rice",
"github.com/GeertJohan/go.rice/embedded",
"github.com/ararog/timeago",
"github.com/fatih/structs",
"github.com/go-yaml/yaml",
"github.com/gorilla/mux",
"github.com/gorilla/sessions",
"github.com/joho/godotenv",
"github.com/pkg/errors",
"github.com/rendon/testcli",
"github.com/stretchr/testify/assert",
"golang.org/x/crypto/bcrypt",
"gopkg.in/gomail.v2",
"gopkg.in/natefinch/lumberjack.v2",
"upper.io/db.v3",
"upper.io/db.v3/lib/sqlbuilder",
"upper.io/db.v3/mysql",
"upper.io/db.v3/postgresql",
"upper.io/db.v3/sqlite",
]
solver-name = "gps-cdcl"
solver-version = 1

78
Gopkg.toml Normal file
View File

@ -0,0 +1,78 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
branch = "master"
name = "github.com/GeertJohan/go.rice"
[[constraint]]
branch = "master"
name = "github.com/ararog/timeago"
[[constraint]]
branch = "master"
name = "github.com/fatih/structs"
[[constraint]]
name = "github.com/go-yaml/yaml"
version = "2.2.1"
[[constraint]]
name = "github.com/gorilla/sessions"
version = "1.1.1"
[[constraint]]
branch = "master"
name = "github.com/joho/godotenv"
[[constraint]]
branch = "master"
name = "github.com/pkg/errors"
[[constraint]]
branch = "master"
name = "github.com/rendon/testcli"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"
[[constraint]]
branch = "v2"
name = "gopkg.in/gomail.v2"
[[constraint]]
name = "gopkg.in/natefinch/lumberjack.v2"
version = "2.1.0"
[[constraint]]
name = "upper.io/db.v3"
version = "3.5.3"
[prune]
go-tests = true
unused-packages = true

View File

@ -14,9 +14,13 @@ PUBLISH_BODY='{ "request": { "branch": "master", "config": { "env": { "VERSION":
DOCKER_TEST='{ "request": { "branch": "master", "config": { "script": "make docker-run-test", "services": ["docker"], "before_script": [], "after_deploy": [], "after_success": ["make publish-dev", "sleep 240", "make travis-crypress"], "deploy": [], "before_deploy": [], "env": { "VERSION": "$(VERSION)" } } } }'
TEST_DIR=$(GOPATH)/src/github.com/hunterlong/statup
all: deps compile install clean
all: dev-deps compile install test-all
release: deps build-all compress
release: dev-deps build-all compress
test-all: dev-deps test docker-test docker-test cypress-test coverage
travis-test: dev-deps cypress-install test docker-test cypress-test coverage
install: clean build
mv $(BINARY_NAME) $(GOPATH)/bin/$(BINARY_NAME)
@ -33,12 +37,9 @@ compile:
sass source/scss/base.scss source/css/base.css
test: clean compile install
STATUP_DIR=$(TEST_DIR) GO_ENV=test go test -v -p=1 $(BUILDVERSION) -coverprofile=coverage.out ./...
STATUP_DIR=`pwd` GO_ENV=test && go test -v -p=1 $(BUILDVERSION) -coverprofile=coverage.out ./...
gocov convert coverage.out > coverage.json
test-all: compile databases
$(GOTEST) ./... -p=1 $(BUILDVERSION) -coverprofile=coverage.out -v
coverage:
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
@ -65,27 +66,27 @@ build-alpine: clean compile
docker:
docker build -t hunterlong/statup:latest .
docker-dev:
docker build -t hunterlong/statup:dev -f ./cmd/Dockerfile .
docker-test:
docker build -t hunterlong/statup:test -f ./.travis/Dockerfile .
docker-run: docker
docker run -t -p 8080:8080 hunterlong/statup:latest
docker-dev:
docker build -t hunterlong/statup:dev -f ./.dev/Dockerfile .
docker-run-dev: docker-dev
docker run -t -p 8080:8080 hunterlong/statup:dev
docker-run-test: docker-test
docker run -t -p 8080:8080 hunterlong/statup:test
docker-test: docker-dev
docker run -t -p 8080:8080 --entrypoint="STATUP_DIR=`pwd` GO_ENV=test go test -v -p=1 $(BUILDVERSION) ./..." 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:
dep:
dep ensure
dev-deps:
$(GOGET) github.com/stretchr/testify/assert
$(GOGET) golang.org/x/tools/cmd/cover
$(GOGET) github.com/mattn/goveralls
@ -100,8 +101,7 @@ deps:
$(GOCMD) get github.com/axw/gocov/gocov
$(GOCMD) get -u gopkg.in/matm/v1/gocov-html
$(GOCMD) install gopkg.in/matm/v1/gocov-html
$(GOCMD) get -u github.com/mgechev/revive
$(GOGET) -d ./...
$(GOCMD) get github.com/mgechev/revive
clean:
rm -rf ./{logs,assets,plugins,statup.db,config.yml,.sass-cache,config.yml,statup,build}
@ -119,15 +119,6 @@ clean:
tag:
git tag "v$(VERSION)" --force
test-env:
export GO_ENV=test
export DB_HOST=localhost
export DB_USER=root
export DB_PASS=password123
export DB_DATABASE=root
export NAME=Demo
export STATUP_DIR=$(GOPATH)/src/github.com/hunterlong/statup
compress:
cd build && mv alpine-linux-amd64 $(BINARY_NAME)
cd build && tar -czvf $(BINARY_NAME)-linux-alpine.tar.gz $(BINARY_NAME) && rm -f $(BINARY_NAME)
@ -149,19 +140,16 @@ compress:
publish-dev:
curl -H "Content-Type: application/json" --data '{"docker_tag": "dev"}' -X POST $(DOCKER)
publish-test:
curl -H "Content-Type: application/json" --data '{"docker_tag": "test"}' -X POST $(DOCKER)
publish-latest:
curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER)
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/hunterlong%2Fhomebrew-statup/requests
travis-crypress:
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%2Fstatup-testing/requests
cypress-install:
cd .dev/test && npm install
travis-docker-test:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(DOCKER_TEST) https://api.travis-ci.com/repo/hunterlong%2Fstatup/requests
cypress-test: clean
cd .dev/test && npm test
.PHONY: build build-all build-alpine

View File

@ -1,6 +1,5 @@
FROM alpine:latest
LABEL MAINTAINER = 'Hunter Long (https://github.com/hunterlong)'
MAINTAINER 'Hunter Long (https://github.com/hunterlong)'
# Statup 'dev' image that will download the latest version of Statup from github
RUN apk --no-cache add libstdc++ ca-certificates curl grep sed
@ -21,8 +20,6 @@ RUN wget -q https://assets.statup.io/sass && \
mv sass /usr/local/bin/sass
ENV IS_DOCKER=true
ENV SASS=/usr/local/bin/sass
ENV STATUP_DIR=/app
WORKDIR /app
VOLUME /app

View File

@ -49,6 +49,7 @@ func TestExportCommand(t *testing.T) {
}
func TestAssetsCommand(t *testing.T) {
t.SkipNow()
c := testcli.Command("statup", "assets")
c.Run()
t.Log(c.Stdout())