[TASK] add CI circleci and codecov + coveralls
This commit is contained in:
parent
35dbf982fc
commit
06d61b6b71
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Issue: https://github.com/mattn/goveralls/issues/20
|
||||||
|
# Source: https://github.com/uber/go-torch/blob/63da5d33a225c195fea84610e2456d5f722f3963/.test-cover.sh
|
||||||
|
CI=$1
|
||||||
|
echo "run for $CI"
|
||||||
|
|
||||||
|
if [ "$CI" == "circle-ci" ]; then
|
||||||
|
cd ${GOPATH}/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "mode: count" > profile.cov
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
# Standard go tooling behavior is to ignore dirs with leading underscors
|
||||||
|
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
|
||||||
|
do
|
||||||
|
if ls $dir/*.go &> /dev/null; then
|
||||||
|
go test -v -covermode=count -coverprofile=profile.tmp $dir || FAIL=$?
|
||||||
|
if [ -f profile.tmp ]
|
||||||
|
then
|
||||||
|
tail -n +2 < profile.tmp >> profile.cov
|
||||||
|
rm profile.tmp
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Failures have incomplete results, so don't send
|
||||||
|
if [ "$FAIL" -eq 0 ]; then
|
||||||
|
goveralls -service=$CI -v -coverprofile=profile.cov
|
||||||
|
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f profile.cov
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $FAIL
|
|
@ -1,10 +1,15 @@
|
||||||
# yaja (Yet Another JAbber implementation)
|
# yaja (Yet Another JAbber implementation)
|
||||||
|
|
||||||
|
[![CircleCI](https://circleci.com/gh/genofire/yaja/tree/master.svg?style=shield)](https://circleci.com/gh/genofire/yaja/tree/master)
|
||||||
|
[![Coverage Status](https://coveralls.io/repos/github/genofire/yaja/badge.svg?branch=master)](https://coveralls.io/github/genofire/yaja?branch=master)
|
||||||
|
[![codecov](https://codecov.io/gh/genofire/yaja/branch/master/graph/badge.svg)](https://codecov.io/gh/genofire/yaja)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/genofire/yaja)](https://goreportcard.com/report/github.com/genofire/yaja)
|
||||||
[![chat on our conference room](https://camo.githubusercontent.com/a839cc0a3d4dac7ec82237381b165dd144365b6d/68747470733a2f2f74696e7975726c2e636f6d2f6a6f696e7468656d7563)](https://conversations.im/j/yaja@conference.chat.sum7.eu)
|
[![chat on our conference room](https://camo.githubusercontent.com/a839cc0a3d4dac7ec82237381b165dd144365b6d/68747470733a2f2f74696e7975726c2e636f6d2f6a6f696e7468656d7563)](https://conversations.im/j/yaja@conference.chat.sum7.eu)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Messages XML Library (first version - PR are welcome)
|
- Messages XML Library (first version - PR are welcome)
|
||||||
- Full RFC 6120 (XMPP - Core)
|
- Full RFC 6120 (XMPP - Core)
|
||||||
|
- XEP-0199: XMPP Ping
|
||||||
- Client Library (WIP)
|
- Client Library (WIP)
|
||||||
- Stream: TLS Required
|
- Stream: TLS Required
|
||||||
- SASL-Auth (PLAIN, DIGEST-MD5)
|
- SASL-Auth (PLAIN, DIGEST-MD5)
|
||||||
|
@ -29,6 +34,7 @@ all implementation of all comman (RFCs and XEPs) xml element
|
||||||
|
|
||||||
**Version**
|
**Version**
|
||||||
- RFC 6120 (XMPP - Core)
|
- RFC 6120 (XMPP - Core)
|
||||||
|
- XEP-0199: XMPP Ping
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:latest
|
||||||
|
working_directory: /go/src/dev.sum7.eu/genofire/yaja
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: go get -t -d -v ./...
|
||||||
|
- run: go install dev.sum7.eu/genofire/yaja
|
||||||
|
- store_artifacts:
|
||||||
|
path: /go/bin/
|
||||||
|
destination: yaja
|
||||||
|
test:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:latest
|
||||||
|
working_directory: /go/src/dev.sum7.eu/genofire/yaja
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: go get -t -d -v ./...
|
||||||
|
- run: go get github.com/mattn/goveralls
|
||||||
|
- run: go get golang.org/x/tools/cmd/cover
|
||||||
|
- run: ./.test-coverage circle-ci
|
||||||
|
- store_test_results:
|
||||||
|
path: ./
|
||||||
|
destination: profile.cov
|
||||||
|
test_race:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:latest
|
||||||
|
working_directory: /go/src/dev.sum7.eu/genofire/yaja
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: go get -t -d -v ./...
|
||||||
|
- run: go test -race ./...
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build_and_tests:
|
||||||
|
jobs:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- test_race
|
|
@ -142,7 +142,7 @@ func (t *Tester) StartBot(status *Status) {
|
||||||
}
|
}
|
||||||
func botAllowed(list []*messages.JID, toConvert map[string]interface{}) []*messages.JID {
|
func botAllowed(list []*messages.JID, toConvert map[string]interface{}) []*messages.JID {
|
||||||
alist := list
|
alist := list
|
||||||
for jid, _ := range toConvert {
|
for jid := range toConvert {
|
||||||
alist = append(alist, messages.NewJID(jid))
|
alist = append(alist, messages.NewJID(jid))
|
||||||
}
|
}
|
||||||
return alist
|
return alist
|
||||||
|
@ -173,7 +173,7 @@ func botAdmin(cmd []string, log *log.Entry, status *Status, from *messages.JID,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if len(cmd) == 1 && cmd[0] == "list" {
|
if len(cmd) == 1 && cmd[0] == "list" {
|
||||||
for jid, _ := range status.account.Admins {
|
for jid := range status.account.Admins {
|
||||||
if msg == "" {
|
if msg == "" {
|
||||||
msg += "admins are: " + jid
|
msg += "admins are: " + jid
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (s *Status) Disconnect(reason string) {
|
||||||
Type: messages.MessageTypeChat,
|
Type: messages.MessageTypeChat,
|
||||||
Body: fmt.Sprintf("you recieve a notify that '%s' disconnect: %s", s.JID.Full(), reason),
|
Body: fmt.Sprintf("you recieve a notify that '%s' disconnect: %s", s.JID.Full(), reason),
|
||||||
}
|
}
|
||||||
for jid, _ := range s.account.Admins {
|
for jid := range s.account.Admins {
|
||||||
msg.To = messages.NewJID(jid)
|
msg.To = messages.NewJID(jid)
|
||||||
if err := s.backupClient.Send(msg); err != nil {
|
if err := s.backupClient.Send(msg); err != nil {
|
||||||
s.client.Send(msg)
|
s.client.Send(msg)
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package messages
|
package messages
|
||||||
|
|
||||||
// which XEP ????
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// where to put: (server part debug? is it part)
|
// XEP-0199: XMPP Ping
|
||||||
|
|
||||||
type Ping struct {
|
type Ping struct {
|
||||||
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
|
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// which XEP ????
|
||||||
|
// where to put: (server part debug? is it part)
|
||||||
type IQPrivateQuery struct {
|
type IQPrivateQuery struct {
|
||||||
XMLName xml.Name `xml:"jabber:iq:private query"`
|
XMLName xml.Name `xml:"jabber:iq:private query"`
|
||||||
Body []byte `xml:",innerxml"`
|
Body []byte `xml:",innerxml"`
|
||||||
|
|
|
@ -12,69 +12,69 @@ func TestNewJID(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
checkList := map[string]*JID{
|
checkList := map[string]*JID{
|
||||||
"juliet@example.com": &JID{
|
"juliet@example.com": {
|
||||||
Local: "juliet",
|
Local: "juliet",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"juliet@example.com/foo": &JID{
|
"juliet@example.com/foo": {
|
||||||
Local: "juliet",
|
Local: "juliet",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
"juliet@example.com/foo bar": &JID{
|
"juliet@example.com/foo bar": {
|
||||||
Local: "juliet",
|
Local: "juliet",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo bar",
|
Resource: "foo bar",
|
||||||
},
|
},
|
||||||
"juliet@example.com/foo@bar": &JID{
|
"juliet@example.com/foo@bar": {
|
||||||
Local: "juliet",
|
Local: "juliet",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo@bar",
|
Resource: "foo@bar",
|
||||||
},
|
},
|
||||||
"foo\\20bar@example.com": &JID{
|
"foo\\20bar@example.com": {
|
||||||
Local: "foo\\20bar",
|
Local: "foo\\20bar",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"fussball@example.com": &JID{
|
"fussball@example.com": {
|
||||||
Local: "fussball",
|
Local: "fussball",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"fußball@example.com": &JID{
|
"fußball@example.com": {
|
||||||
Local: "fußball",
|
Local: "fußball",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"π@example.com": &JID{
|
"π@example.com": {
|
||||||
Local: "π",
|
Local: "π",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"Σ@example.com/foo": &JID{
|
"Σ@example.com/foo": {
|
||||||
Local: "Σ",
|
Local: "Σ",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
"σ@example.com/foo": &JID{
|
"σ@example.com/foo": {
|
||||||
Local: "σ",
|
Local: "σ",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
"ς@example.com/foo": &JID{
|
"ς@example.com/foo": {
|
||||||
Local: "ς",
|
Local: "ς",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
"king@example.com/♚": &JID{
|
"king@example.com/♚": {
|
||||||
Local: "king",
|
Local: "king",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "♚",
|
Resource: "♚",
|
||||||
},
|
},
|
||||||
"example.com": &JID{
|
"example.com": {
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"example.com/foobar": &JID{
|
"example.com/foobar": {
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foobar",
|
Resource: "foobar",
|
||||||
},
|
},
|
||||||
"a.example.com/b@example.net": &JID{
|
"a.example.com/b@example.net": {
|
||||||
Domain: "a.example.com",
|
Domain: "a.example.com",
|
||||||
Resource: "b@example.net",
|
Resource: "b@example.net",
|
||||||
},
|
},
|
||||||
|
@ -112,16 +112,16 @@ func TestJIDBare(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
checkList := map[string]*JID{
|
checkList := map[string]*JID{
|
||||||
"aaa@example.com": &JID{
|
"aaa@example.com": {
|
||||||
Local: "aaa",
|
Local: "aaa",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
},
|
},
|
||||||
"aab@example.com": &JID{
|
"aab@example.com": {
|
||||||
Local: "aab",
|
Local: "aab",
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
"example.com": &JID{
|
"example.com": {
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Resource: "foo",
|
Resource: "foo",
|
||||||
},
|
},
|
||||||
|
|
Reference in New Issue