From 69c021b9240bf52cea8e28907d01e29014f95a01 Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Sat, 22 Jun 2019 12:29:33 +0200 Subject: [PATCH] fix ci --- .ci/check-gofmt | 8 ++++++++ .ci/check-testfiles | 25 +++++++++++++++++++++++++ .gitlab-ci.yml | 16 ++++++++++------ README.md | 23 +++++++++++++++++------ bot/main_test.go | 1 + database/main_test.go | 1 + model/doc_test.go | 1 + 7 files changed, 63 insertions(+), 12 deletions(-) create mode 100755 .ci/check-gofmt create mode 100755 .ci/check-testfiles create mode 100644 bot/main_test.go create mode 100644 database/main_test.go create mode 100644 model/doc_test.go diff --git a/.ci/check-gofmt b/.ci/check-gofmt new file mode 100755 index 0000000..4a1c0b2 --- /dev/null +++ b/.ci/check-gofmt @@ -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 diff --git a/.ci/check-testfiles b/.ci/check-testfiles new file mode 100755 index 0000000..132ff73 --- /dev/null +++ b/.ci/check-testfiles @@ -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") diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 243f041..484eeab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,19 +4,22 @@ stages: - test before_script: - - mkdir -p /go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/ - - cp -R /builds/$CI_PROJECT_PATH /go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/ - - cd /go/src/dev.sum7.eu/$CI_PROJECT_PATH + - mkdir -p "/go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/" + - cp -R "$CI_PROJECT_DIR" "/go/src/dev.sum7.eu/$CI_PROJECT_NAMESPACE/" + - cd "/go/src/dev.sum7.eu/$CI_PROJECT_PATH" - go get -d -t ./... build-my-project: stage: build script: - - go install dev.sum7.eu/$CI_PROJECT_PATH - - mv /go/bin/$CI_PROJECT_NAME /builds/$CI_PROJECT_PATH + - mkdir "$CI_PROJECT_DIR/bin/" + - go install "dev.sum7.eu/$CI_PROJECT_PATH" + - mv "/go/bin/$CI_PROJECT_NAME" "$CI_PROJECT_DIR/bin/$CI_PROJECT_NAME" artifacts: paths: - - $CI_PROJECT_NAME + - "bin/$CI_PROJECT_NAME" + - yaja-bot_example.conf + - yaja-tester_example.conf test-my-project: stage: test @@ -26,6 +29,7 @@ test-my-project: - ./.ci/check-gofmt - ./.ci/check-testfiles - go test $(go list ./... | grep -v /vendor/) -v -coverprofile .testCoverage.txt + - go tool cover -func=.testCoverage.txt artifacts: paths: - .testCoverage.txt diff --git a/README.md b/README.md index 7288e6a..14cd13c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # yaja (Yet Another JAbber implementation) -[![DroneCI](https://ci.sum7.eu/api/badges/genofire/yaja/status.svg?branch=master)](https://ci.sum7.eu/genofire/yaja) -[![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) +[![pipeline status](https://dev.sum7.eu/genofire/yaja/badges/master/pipeline.svg)](https://dev.sum7.eu/genofire/yaja/pipelines) +[![coverage report](https://dev.sum7.eu/genofire/yaja/badges/master/coverage.svg)](https://dev.sum7.eu/genofire/yaja/pipelines) +[![Go Report Card](https://goreportcard.com/badge/dev.sum7.eu/genofire/yaja)](https://goreportcard.com/report/dev.sum7.eu/genofire/yaja) +[![GoDoc](https://godoc.org/dev.sum7.eu/genofire/yaja?status.svg)](https://godoc.org/dev.sum7.eu/genofire/yaja) +[![](https://inverse.chat/badge.svg?room=yaja@conference.chat.sum7.eu)](https://conversations.im/j/yaja@conference.chat.sum7.eu) + ## Features - XMPP Library (first version - PR are welcome) @@ -47,6 +47,17 @@ all implementation of all comman (RFCs and XEPs) xml element - SendRecv to get answer of a request - Register +## Get yaja + +#### Download + +Latest Build binary from ci here: + +[Download All](https://dev.sum7.eu/genofire/yaja/-/jobs/artifacts/master/download/?job=build-my-project) (with config example) + +[Download Binary](https://dev.sum7.eu/genofire/yaja/-/jobs/artifacts/master/raw/bin/yaja?inline=false&job=build-my-project) + + ## Run ``` diff --git a/bot/main_test.go b/bot/main_test.go new file mode 100644 index 0000000..7e49431 --- /dev/null +++ b/bot/main_test.go @@ -0,0 +1 @@ +package bot diff --git a/database/main_test.go b/database/main_test.go new file mode 100644 index 0000000..636bab8 --- /dev/null +++ b/database/main_test.go @@ -0,0 +1 @@ +package database diff --git a/model/doc_test.go b/model/doc_test.go new file mode 100644 index 0000000..8b53790 --- /dev/null +++ b/model/doc_test.go @@ -0,0 +1 @@ +package model