[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)
|
||||
|
||||
[![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)
|
||||
|
||||
## Features
|
||||
- Messages XML Library (first version - PR are welcome)
|
||||
- Full RFC 6120 (XMPP - Core)
|
||||
- XEP-0199: XMPP Ping
|
||||
- Client Library (WIP)
|
||||
- Stream: TLS Required
|
||||
- SASL-Auth (PLAIN, DIGEST-MD5)
|
||||
|
@ -29,6 +34,7 @@ all implementation of all comman (RFCs and XEPs) xml element
|
|||
|
||||
**Version**
|
||||
- RFC 6120 (XMPP - Core)
|
||||
- XEP-0199: XMPP Ping
|
||||
|
||||
### 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 {
|
||||
alist := list
|
||||
for jid, _ := range toConvert {
|
||||
for jid := range toConvert {
|
||||
alist = append(alist, messages.NewJID(jid))
|
||||
}
|
||||
return alist
|
||||
|
@ -173,7 +173,7 @@ func botAdmin(cmd []string, log *log.Entry, status *Status, from *messages.JID,
|
|||
}
|
||||
} else {
|
||||
if len(cmd) == 1 && cmd[0] == "list" {
|
||||
for jid, _ := range status.account.Admins {
|
||||
for jid := range status.account.Admins {
|
||||
if msg == "" {
|
||||
msg += "admins are: " + jid
|
||||
} else {
|
||||
|
|
|
@ -39,7 +39,7 @@ func (s *Status) Disconnect(reason string) {
|
|||
Type: messages.MessageTypeChat,
|
||||
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)
|
||||
if err := s.backupClient.Send(msg); err != nil {
|
||||
s.client.Send(msg)
|
||||
|
|
2
main.go
2
main.go
|
@ -4,4 +4,4 @@ import "dev.sum7.eu/genofire/yaja/cmd"
|
|||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
package messages
|
||||
|
||||
// which XEP ????
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
)
|
||||
|
||||
// where to put: (server part debug? is it part)
|
||||
|
||||
// XEP-0199: XMPP Ping
|
||||
type Ping struct {
|
||||
XMLName xml.Name `xml:"urn:xmpp:ping ping"`
|
||||
}
|
||||
|
||||
// which XEP ????
|
||||
// where to put: (server part debug? is it part)
|
||||
type IQPrivateQuery struct {
|
||||
XMLName xml.Name `xml:"jabber:iq:private query"`
|
||||
Body []byte `xml:",innerxml"`
|
||||
|
|
|
@ -12,69 +12,69 @@ func TestNewJID(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
checkList := map[string]*JID{
|
||||
"juliet@example.com": &JID{
|
||||
"juliet@example.com": {
|
||||
Local: "juliet",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"juliet@example.com/foo": &JID{
|
||||
"juliet@example.com/foo": {
|
||||
Local: "juliet",
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
"juliet@example.com/foo bar": &JID{
|
||||
"juliet@example.com/foo bar": {
|
||||
Local: "juliet",
|
||||
Domain: "example.com",
|
||||
Resource: "foo bar",
|
||||
},
|
||||
"juliet@example.com/foo@bar": &JID{
|
||||
"juliet@example.com/foo@bar": {
|
||||
Local: "juliet",
|
||||
Domain: "example.com",
|
||||
Resource: "foo@bar",
|
||||
},
|
||||
"foo\\20bar@example.com": &JID{
|
||||
"foo\\20bar@example.com": {
|
||||
Local: "foo\\20bar",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"fussball@example.com": &JID{
|
||||
"fussball@example.com": {
|
||||
Local: "fussball",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"fußball@example.com": &JID{
|
||||
"fußball@example.com": {
|
||||
Local: "fußball",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"π@example.com": &JID{
|
||||
"π@example.com": {
|
||||
Local: "π",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"Σ@example.com/foo": &JID{
|
||||
"Σ@example.com/foo": {
|
||||
Local: "Σ",
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
"σ@example.com/foo": &JID{
|
||||
"σ@example.com/foo": {
|
||||
Local: "σ",
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
"ς@example.com/foo": &JID{
|
||||
"ς@example.com/foo": {
|
||||
Local: "ς",
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
"king@example.com/♚": &JID{
|
||||
"king@example.com/♚": {
|
||||
Local: "king",
|
||||
Domain: "example.com",
|
||||
Resource: "♚",
|
||||
},
|
||||
"example.com": &JID{
|
||||
"example.com": {
|
||||
Domain: "example.com",
|
||||
},
|
||||
"example.com/foobar": &JID{
|
||||
"example.com/foobar": {
|
||||
Domain: "example.com",
|
||||
Resource: "foobar",
|
||||
},
|
||||
"a.example.com/b@example.net": &JID{
|
||||
"a.example.com/b@example.net": {
|
||||
Domain: "a.example.com",
|
||||
Resource: "b@example.net",
|
||||
},
|
||||
|
@ -112,16 +112,16 @@ func TestJIDBare(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
checkList := map[string]*JID{
|
||||
"aaa@example.com": &JID{
|
||||
"aaa@example.com": {
|
||||
Local: "aaa",
|
||||
Domain: "example.com",
|
||||
},
|
||||
"aab@example.com": &JID{
|
||||
"aab@example.com": {
|
||||
Local: "aab",
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
"example.com": &JID{
|
||||
"example.com": {
|
||||
Domain: "example.com",
|
||||
Resource: "foo",
|
||||
},
|
||||
|
|
Reference in New Issue