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",
|
Name: "filter",
|
||||||
Description: "list and configurate regex filter for channel by message content",
|
Description: "list and configurate regex filter for channel by message content",
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
&Command{
|
{
|
||||||
Name: "add",
|
Name: "add",
|
||||||
Description: "add regex filter for channel: [channel] regex",
|
Description: "add regex filter for channel: [channel] regex",
|
||||||
Action: func(from string, params []string) string {
|
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)
|
return fmt.Sprintf("add regex for \"%s\" to %s", of, regex)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "del",
|
Name: "del",
|
||||||
Description: "del regex filter for channel: [channel] regex",
|
Description: "del regex filter for channel: [channel] regex",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -50,7 +50,7 @@ func NewFilter(db *database.DB) *Command {
|
||||||
return "deleted"
|
return "deleted"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Description: "list of all channels",
|
Description: "list of all channels",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -64,7 +64,7 @@ func NewFilter(db *database.DB) *Command {
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "channel",
|
Name: "channel",
|
||||||
Description: "list of given channel: channel",
|
Description: "list of given channel: channel",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
|
|
@ -12,7 +12,7 @@ func NewHostname(db *database.DB) *Command {
|
||||||
Name: "hostname",
|
Name: "hostname",
|
||||||
Description: "alternative short (host)names for long IP-Addresses or URLs (and time of last recieved input)",
|
Description: "alternative short (host)names for long IP-Addresses or URLs (and time of last recieved input)",
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
&Command{
|
{
|
||||||
Name: "set",
|
Name: "set",
|
||||||
Description: "set or replace a hostname: IPAddress/Hostname NewHostname",
|
Description: "set or replace a hostname: IPAddress/Hostname NewHostname",
|
||||||
Action: func(from string, params []string) string {
|
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)
|
return fmt.Sprintf("set for %s the hostname %s", addr, name)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "del",
|
Name: "del",
|
||||||
Description: "delete a hostname: IPAddress/Hostname",
|
Description: "delete a hostname: IPAddress/Hostname",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
|
|
@ -13,7 +13,7 @@ func NewPriority(db *database.DB) *Command {
|
||||||
Name: "priority",
|
Name: "priority",
|
||||||
Description: "list and configurate priority in channel",
|
Description: "list and configurate priority in channel",
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
&Command{
|
{
|
||||||
Name: "set",
|
Name: "set",
|
||||||
Description: "set max priority of channel: [channel] Priority",
|
Description: "set max priority of channel: [channel] Priority",
|
||||||
Action: func(from string, params []string) string {
|
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())
|
return fmt.Sprintf("set filter for %s to %s", to, max.String())
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Description: "list of all channels",
|
Description: "list of all channels",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -54,7 +54,7 @@ func NewPriority(db *database.DB) *Command {
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "channel",
|
Name: "channel",
|
||||||
Description: "list of given channel: channel",
|
Description: "list of given channel: channel",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
|
|
@ -11,7 +11,7 @@ func NewReplace(db *database.DB) *Command {
|
||||||
Name: "replace",
|
Name: "replace",
|
||||||
Description: "list and configurate replace content of message for channel",
|
Description: "list and configurate replace content of message for channel",
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
&Command{
|
{
|
||||||
Name: "add",
|
Name: "add",
|
||||||
Description: "add regex replace for channel: [channel] regex replace",
|
Description: "add regex replace for channel: [channel] regex replace",
|
||||||
Action: func(from string, params []string) string {
|
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)
|
return fmt.Sprintf("add replace in \"%s\" for \"%s\" to \"%s\"", of, regex, value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "del",
|
Name: "del",
|
||||||
Description: "del regex replace for channel: [channel] regex replace",
|
Description: "del regex replace for channel: [channel] regex replace",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -54,7 +54,7 @@ func NewReplace(db *database.DB) *Command {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
&Command{
|
{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Description: "list of all channels",
|
Description: "list of all channels",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -68,7 +68,7 @@ func NewReplace(db *database.DB) *Command {
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "channel",
|
Name: "channel",
|
||||||
Description: "list of given channel: channel",
|
Description: "list of given channel: channel",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
|
|
@ -11,7 +11,7 @@ func NewSend(db *database.DB) *Command {
|
||||||
Name: "send",
|
Name: "send",
|
||||||
Description: "list and configurate destination for hostnames",
|
Description: "list and configurate destination for hostnames",
|
||||||
Commands: []*Command{
|
Commands: []*Command{
|
||||||
&Command{
|
{
|
||||||
Name: "add",
|
Name: "add",
|
||||||
Description: "add a destination for host with: IPAddress/Hostname [to]",
|
Description: "add a destination for host with: IPAddress/Hostname [to]",
|
||||||
Action: func(from string, params []string) string {
|
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)
|
return fmt.Sprintf("added %s in list of %s", to, host)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "del",
|
Name: "del",
|
||||||
Description: "del a destination for host with: IPAddress/Hostname [to]",
|
Description: "del a destination for host with: IPAddress/Hostname [to]",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -63,7 +63,7 @@ func NewSend(db *database.DB) *Command {
|
||||||
return "not found host"
|
return "not found host"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Description: "list of all hosts with there channels",
|
Description: "list of all hosts with there channels",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
@ -85,7 +85,7 @@ func NewSend(db *database.DB) *Command {
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&Command{
|
{
|
||||||
Name: "channel",
|
Name: "channel",
|
||||||
Description: "list all host of given channel: channel",
|
Description: "list all host of given channel: channel",
|
||||||
Action: func(from string, params []string) string {
|
Action: func(from string, params []string) string {
|
||||||
|
|
Loading…
Reference in New Issue