Browse Source

fix: Minor restructuring

Matthias Ladkau 4 years ago
parent
commit
137c0ae6e7

+ 0 - 33
.goreleaser.yml

@@ -1,33 +0,0 @@
-# This is an example goreleaser.yaml file with some sane defaults.
-# Make sure to check the documentation at http://goreleaser.com
-before:
-  hooks:
-    - go mod download
-builds:
-- main: ./cli/eliasdb.go
-  env:
-  - CGO_ENABLED=0
-  goos:
-    - windows
-    - linux
-  goarch:
-    - amd64
-checksum:
-  name_template: 'checksums.txt'
-archives:
-  - files:
-    - LICENSE
-    - NOTICE
-    - examples/**/*
-snapshot:
-  name_template: "{{ .Tag }}"
-changelog:
-  sort: asc
-  filters:
-    exclude:
-    - '^docs:'
-    - '^test:'
-
-# Run with: 
-# mkdir .cache
-# docker run --rm --user $(id -u):$(id -g) -v $PWD/.cache:/.cache -v $PWD:/go/code -w /go/code goreleaser/goreleaser --snapshot --skip-publish --rm-dist

+ 2 - 2
Dockerfile

@@ -41,7 +41,7 @@ ENTRYPOINT ["../eliasdb"]
 #
 # docker run --rm --user $(id -u):$(id -g) -v $PWD:/data -p 9090:9090 krotik/eliasdb server
 
-# To run the console as the current user, use the eliasdb.config.json in 
-# the local directory
+# To run the console as the current user and use the eliasdb.config.json in 
+# the local directory run:
 
 # docker run --rm --network="host" -it -v $PWD:/data --user $(id -u):$(id -g) -v $PWD:/data krotik/eliasdb console

+ 7 - 12
Jenkinsfile

@@ -12,14 +12,9 @@ pipeline {
      * a new product version. The versioning will be according to the rules
      * of “Semantic Versioning” (https://semver.org/).
      *
-     * Building is done using goreleaser (https://goreleaser.com/) for different
-     * platforms.
+     * Building is done using simple make.
      *
-     * Testing produces code coverage badges which can be embedded on other
-     * pages.
-     *
-     * Everything runs in docker containers to ensure isolation of the build
-     * system and to allow painless upgrades.
+     * Testing produces code coverage badges which can be embedded web pages.
      */
 
     stages {
@@ -61,7 +56,7 @@ pipeline {
                 }
 
                 sh 'mkdir -p .cache'
-                sh 'docker run --rm --user $(id -u):$(id -g) -v $PWD/.cache:/.cache -v $PWD:/go/code -w /go/code goreleaser/goreleaser --snapshot --skip-publish --rm-dist'
+                sh '/opt/env-go/bin/env-go make dist'
             }
         }
         stage('Test') {
@@ -74,12 +69,12 @@ pipeline {
 
                 sh """echo '<svg width="88" height="20" xmlns="http://www.w3.org/2000/svg"><g shape-rendering="crispEdges"><path fill="#555" d="M0 0h41v20H0z"/><path fill="#fc1" d="M41 0h40v20H41z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="20.5" y="14">tests</text><text x="60" y="14">fail</text></g></svg>' > test_result.svg"""
 
-                sh 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go test -p 1 --coverprofile=coverage.out ./...'
-                sh 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go tool cover --html=coverage.out -o coverage.html'
+                sh 'CGO_ENABLED=0 /opt/env-go/bin/env-go go test -p 1 --coverprofile=coverage.out ./...'
+                sh '/opt/env-go/bin/env-go go tool cover --html=coverage.out -o coverage.html'
 
                 echo 'Determine overall coverage and writing badge'
                 script {
-                  coverage = sh(returnStdout: true, script: 'docker run --rm -e GOPATH=/tmp -v $PWD:/go golang go tool cover -func=coverage.out | tee coverage.txt | tail -1 | grep -o "[0-9]*.[0-9]*%$" | tr -d "\\n"')
+                  coverage = sh(returnStdout: true, script: '/opt/env-go/bin/env-go go tool cover -func=coverage.out | tee coverage.txt | tail -1 | grep -o "[0-9]*.[0-9]*%$" | tr -d "\\n"')
                   
                   echo "Overall coverage is: ${coverage}"
                   
@@ -105,7 +100,7 @@ pipeline {
                 sshagent (credentials: ['Gogs']) {
                     sh 'git fetch --tags'
                 }
-                sh 'docker run --rm -v $PWD:/app standard-version'
+                sh 'standard-version'
   
                 // The new version is inserted into the code
                 //

+ 43 - 0
Makefile

@@ -0,0 +1,43 @@
+export NAME=eliasdb
+export TAG=`git describe --abbrev=0 --tags`
+export CGO_ENABLED=0
+export GOOS=linux
+
+all: build
+clean:
+	rm -f eliasdb
+
+mod:
+	go mod init || true
+	go mod tidy
+test:
+	go test -p 1 ./...
+
+fmt:
+	gofmt -l -w -s .
+
+vet:
+	go vet ./...
+
+build: clean mod fmt vet
+	go build -o $(NAME) cli/eliasdb.go
+
+build-win: clean mod fmt vet
+	GOOS=windows GOARCH=amd64 go build -o $(NAME).exe cli/eliasdb.go
+
+dist: build build-win
+	rm -fR dist
+
+	mkdir -p dist/$(NAME)_linux_amd64
+	mv $(NAME) dist/$(NAME)_linux_amd64
+	cp LICENSE dist/$(NAME)_linux_amd64
+	cp NOTICE dist/$(NAME)_linux_amd64
+	tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
+
+	mkdir -p dist/$(NAME)_windows_amd64
+	mv $(NAME).exe dist/$(NAME)_windows_amd64
+	cp LICENSE dist/$(NAME)_windows_amd64
+	cp NOTICE dist/$(NAME)_windows_amd64
+	tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
+
+	sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt

+ 1 - 1
README.md

@@ -26,7 +26,7 @@ Features
 
 Getting Started (standalone application)
 ----------------------------------------
-You can download a precompiled package for Windows (win64) or Linux (amd64) [here](https://void.devt.de/pub/eliasdb).
+You can download a pre-compiled package for Windows (win64) or Linux (amd64) [here](https://void.devt.de/pub/eliasdb).
 
 Extract it and execute the executable with:
 ```

+ 1 - 1
go.mod

@@ -3,6 +3,6 @@ module devt.de/krotik/eliasdb
 go 1.12
 
 require (
-	devt.de/krotik/common v1.0.0
+	devt.de/krotik/common v1.1.0
 	github.com/gorilla/websocket v1.4.1
 )

+ 2 - 2
go.sum

@@ -1,4 +1,4 @@
-devt.de/krotik/common v1.0.0 h1:nMmFFkjqb8C/oFVfsEi39qnCUbu3J1FXg+FZn5gSOQU=
-devt.de/krotik/common v1.0.0/go.mod h1:X4nsS85DAxyHkwSg/Tc6+XC2zfmGeaVz+37F61+eSaI=
+devt.de/krotik/common v1.1.0 h1:8xNZ2CwGWon6PqpWHwPhYMnkEOIiIPwdCgGoJCMyj6o=
+devt.de/krotik/common v1.1.0/go.mod h1:X4nsS85DAxyHkwSg/Tc6+XC2zfmGeaVz+37F61+eSaI=
 github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
 github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=

BIN
graph/graphstorage/diskgraphstoragetest1/names.pm


BIN
graph/graphstorage/diskgraphstoragetest1/store1.nodes.db.0


+ 1 - 0
graph/graphstorage/diskgraphstoragetest1/store1.nodes.db.tlg

@@ -0,0 +1 @@
+fB

BIN
graph/graphstorage/diskgraphstoragetest1/store1.nodes.dbf.0


+ 1 - 0
graph/graphstorage/diskgraphstoragetest1/store1.nodes.dbf.tlg

@@ -0,0 +1 @@
+fB

+ 0 - 0
graph/graphstorage/diskgraphstoragetest1/store1.nodes.ix.0


BIN
graph/graphstorage/diskgraphstoragetest1/store1.nodes.ix.tlg


+ 0 - 0
graph/graphstorage/diskgraphstoragetest1/store1.nodes.ixf.0


BIN
graph/graphstorage/diskgraphstoragetest1/store1.nodes.ixf.tlg


+ 1 - 0
graph/graphstorage/diskgraphstoragetest1/store1.nodes.lck

@@ -0,0 +1 @@
+àžB`ŸÞS

+ 10 - 10
integration/rambazamba/eventsource.go

@@ -9,16 +9,16 @@
  */
 
 /*
-Package rambazamba contains an eventsource for Rambazamba which forwards
-internal EliasDB events to Rambazamba engines.
+Package brawler contains an eventsource for Brawler which forwards
+internal EliasDB events to Brawler engines.
 */
-package rambazamba
+package brawler
 
 import (
 	"fmt"
 	"io"
 
-	"devt.de/krotik/common/defs/rambazamba"
+	"devt.de/krotik/common/defs/brawler"
 	"devt.de/krotik/eliasdb/graph"
 	"devt.de/krotik/eliasdb/graph/data"
 )
@@ -26,12 +26,12 @@ import (
 /*
 AddEventPublisher adds an EventPublisher to a given Manager using an EventBridge.
 */
-func AddEventPublisher(gm *graph.Manager, publisher rambazamba.EventPublisher, errOut io.Writer) {
+func AddEventPublisher(gm *graph.Manager, publisher brawler.EventPublisher, errOut io.Writer) {
 	gm.SetGraphRule(&EventBridge{publisher, errOut})
 }
 
 /*
-EventMapping is a mapping between EliasDB event types to Rambazamba event kinds.
+EventMapping is a mapping between EliasDB event types to Brawler event kinds.
 */
 var EventMapping = map[int]string{
 
@@ -78,15 +78,15 @@ var EventMapping = map[int]string{
 	graph.EventEdgeDeleted: "db.edge.deleted",
 }
 
-// Event bridge between EliasDB and Rambazamba
+// Event bridge between EliasDB and Brawler
 // ===========================================
 
 /*
 EventBridge is a rule for a graph manager to forward all graph events to
-Rambazamba.
+Brawler.
 */
 type EventBridge struct {
-	publisher rambazamba.EventPublisher
+	publisher brawler.EventPublisher
 	errOut    io.Writer
 }
 
@@ -94,7 +94,7 @@ type EventBridge struct {
 Name returns the name of the rule.
 */
 func (r *EventBridge) Name() string {
-	return "rambazamba.eventbridge"
+	return "brawler.eventbridge"
 }
 
 /*

+ 2 - 2
integration/rambazamba/eventsource_test.go

@@ -8,7 +8,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-package rambazamba
+package brawler
 
 import (
 	"bytes"
@@ -43,7 +43,7 @@ func TestEventSource(t *testing.T) {
 
 	AddEventPublisher(gm, ep, &log)
 
-	if res := fmt.Sprint(gm.GraphRules()); res != "[rambazamba.eventbridge system.deletenodeedges system.updatenodestats]" {
+	if res := fmt.Sprint(gm.GraphRules()); res != "[brawler.eventbridge system.deletenodeedges system.updatenodestats]" {
 		t.Error("Unexpected result:", res)
 		return
 	}