try gitlab-ci
This commit is contained in:
parent
5c906df45d
commit
ecbaf74f3c
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
result="$(gofmt -s -l . | grep -v '^vendor/' )"
|
||||
if [ -n "$result" ]; then
|
||||
echo "Go code is not formatted, run 'gofmt -s -w .'" >&2
|
||||
echo "$result"
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# checks if every desired package has test files
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
source_re = re.compile(".*\.go")
|
||||
test_re = re.compile(".*_test\.go")
|
||||
missing = False
|
||||
|
||||
for root, dirs, files in os.walk("."):
|
||||
# ignore some paths
|
||||
if root == "." or root.startswith("./vendor") or root.startswith("./."):
|
||||
continue
|
||||
|
||||
# source files but not test files?
|
||||
if len(filter(source_re.match, files)) > 0 and len(filter(test_re.match, files)) == 0:
|
||||
print("no test files for {}".format(root))
|
||||
missing = True
|
||||
|
||||
if missing:
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("every package has test files")
|
|
@ -0,0 +1,30 @@
|
|||
image: golang:latest
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
before_script:
|
||||
- mkdir -p /go/src/git.sum7.eu/genofire/
|
||||
- cp -R /builds/genofire/logmania /go/src/git.sum7.eu/genofire/logmania
|
||||
- cd /go/src/git.sum7.eu/genofire/logmania
|
||||
- go get -d -t ./...
|
||||
|
||||
build-my-project:
|
||||
stage: build
|
||||
script:
|
||||
- go install git.sum7.eu/genofire/logmania
|
||||
artifacts:
|
||||
paths:
|
||||
- /go/bin/logmania
|
||||
|
||||
test-my-project:
|
||||
stage: test
|
||||
script:
|
||||
- ./.ci/check-gofmt
|
||||
- ./.ci/check-testfiles
|
||||
- go test $(go list ./... | grep -v /vendor/) -v -coverprofile .testCoverage.txt
|
||||
|
||||
test-race-my-project:
|
||||
stage: test
|
||||
script:
|
||||
- go test -race ./...
|
|
@ -11,7 +11,7 @@ func NewFilter(db *database.DB) *Command {
|
|||
Name: "filter",
|
||||
Description: "list and configurate regex filter for channel by message content",
|
||||
Commands: []*Command{
|
||||
&Command{
|
||||
{
|
||||
Name: "add",
|
||||
Description: "add regex filter for channel: [channel] regex",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -32,7 +32,7 @@ func NewFilter(db *database.DB) *Command {
|
|||
return fmt.Sprintf("add regex for \"%s\" to %s", of, regex)
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "del",
|
||||
Description: "del regex filter for channel: [channel] regex",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -50,7 +50,7 @@ func NewFilter(db *database.DB) *Command {
|
|||
return "deleted"
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "all",
|
||||
Description: "list of all channels",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -64,7 +64,7 @@ func NewFilter(db *database.DB) *Command {
|
|||
return msg
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "channel",
|
||||
Description: "list of given channel: channel",
|
||||
Action: func(from string, params []string) string {
|
||||
|
|
|
@ -12,7 +12,7 @@ func NewHostname(db *database.DB) *Command {
|
|||
Name: "hostname",
|
||||
Description: "alternative short (host)names for long IP-Addresses or URLs (and time of last recieved input)",
|
||||
Commands: []*Command{
|
||||
&Command{
|
||||
{
|
||||
Name: "set",
|
||||
Description: "set or replace a hostname: IPAddress/Hostname NewHostname",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -31,7 +31,7 @@ func NewHostname(db *database.DB) *Command {
|
|||
return fmt.Sprintf("set for %s the hostname %s", addr, name)
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "del",
|
||||
Description: "delete a hostname: IPAddress/Hostname",
|
||||
Action: func(from string, params []string) string {
|
||||
|
|
|
@ -13,7 +13,7 @@ func NewPriority(db *database.DB) *Command {
|
|||
Name: "priority",
|
||||
Description: "list and configurate priority in channel",
|
||||
Commands: []*Command{
|
||||
&Command{
|
||||
{
|
||||
Name: "set",
|
||||
Description: "set max priority of channel: [channel] Priority",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -43,7 +43,7 @@ func NewPriority(db *database.DB) *Command {
|
|||
return fmt.Sprintf("set filter for %s to %s", to, max.String())
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "all",
|
||||
Description: "list of all channels",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -54,7 +54,7 @@ func NewPriority(db *database.DB) *Command {
|
|||
return msg
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "channel",
|
||||
Description: "list of given channel: channel",
|
||||
Action: func(from string, params []string) string {
|
||||
|
|
|
@ -11,7 +11,7 @@ func NewReplace(db *database.DB) *Command {
|
|||
Name: "replace",
|
||||
Description: "list and configurate replace content of message for channel",
|
||||
Commands: []*Command{
|
||||
&Command{
|
||||
{
|
||||
Name: "add",
|
||||
Description: "add regex replace for channel: [channel] regex replace",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -34,7 +34,7 @@ func NewReplace(db *database.DB) *Command {
|
|||
return fmt.Sprintf("add replace in \"%s\" for \"%s\" to \"%s\"", of, regex, value)
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "del",
|
||||
Description: "del regex replace for channel: [channel] regex replace",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -54,7 +54,7 @@ func NewReplace(db *database.DB) *Command {
|
|||
},
|
||||
},
|
||||
|
||||
&Command{
|
||||
{
|
||||
Name: "all",
|
||||
Description: "list of all channels",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -68,7 +68,7 @@ func NewReplace(db *database.DB) *Command {
|
|||
return msg
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "channel",
|
||||
Description: "list of given channel: channel",
|
||||
Action: func(from string, params []string) string {
|
||||
|
|
|
@ -11,7 +11,7 @@ func NewSend(db *database.DB) *Command {
|
|||
Name: "send",
|
||||
Description: "list and configurate destination for hostnames",
|
||||
Commands: []*Command{
|
||||
&Command{
|
||||
{
|
||||
Name: "add",
|
||||
Description: "add a destination for host with: IPAddress/Hostname [to]",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -43,7 +43,7 @@ func NewSend(db *database.DB) *Command {
|
|||
return fmt.Sprintf("added %s in list of %s", to, host)
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "del",
|
||||
Description: "del a destination for host with: IPAddress/Hostname [to]",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -63,7 +63,7 @@ func NewSend(db *database.DB) *Command {
|
|||
return "not found host"
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "all",
|
||||
Description: "list of all hosts with there channels",
|
||||
Action: func(from string, params []string) string {
|
||||
|
@ -85,7 +85,7 @@ func NewSend(db *database.DB) *Command {
|
|||
return msg
|
||||
},
|
||||
},
|
||||
&Command{
|
||||
{
|
||||
Name: "channel",
|
||||
Description: "list all host of given channel: channel",
|
||||
Action: func(from string, params []string) string {
|
||||
|
|
Loading…
Reference in New Issue