Skip to content
Snippets Groups Projects
Commit 569e5393 authored by Richer Maximilien's avatar Richer Maximilien
Browse files

Merge branch '187_automatic_releases' into 'master'

[CI] Add automatic build

- Add automatic binary generation for windows, linux and darwin
  + Binaries are pushed to http://static.lesterpig.com/dfss (tls will come soon)
  + The build is done ONLY in `master` branch AND on version tags
- Remove the use of "user.HomeDir", because it is not compatible with linux xcompilation

See merge request !28
parents 5fc99f19 664f8e54
No related branches found
No related tags found
No related merge requests found
Pipeline #
build/embed/VERSION
release/
......@@ -3,6 +3,7 @@ before_script:
stages:
- test
- deploy
Unit tests:
stage: test
......@@ -71,3 +72,17 @@ Code lint:
- "cd $GOPATH/src/dfss && go install ./..."
- "gometalinter --install"
- "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures ./..."
Deploy:
stage: deploy
only:
- /^v[0-9]/
- master
tags:
- golang
- strong
script:
- "ln -s -f $(pwd) $GOPATH/src/dfss"
- "./build/deps.sh"
- "make release"
- "make deploy"
Makefile 0 → 100644
REVISION := $(shell git rev-parse HEAD || echo )
VERSION := $(shell git tag --points-at HEAD | grep -m1 v[0-9] | sed -e 's/^v//g' )
ifeq ($(VERSION),)
VERSION := master
endif
.PHONY:
release: clean build_all package
clean:
rm -rf release
build_all:
go get github.com/mitchellh/gox
gox -os "linux darwin windows" -parallel 1 -output "release/dfss_${VERSION}_{{.OS}}_{{.Arch}}/{{.Dir}}" dfss/dfssc dfss/dfssd dfss/dfssp
package:
echo "$(VERSION) $(REVISION)" > build/embed/VERSION
cd release && ls -1 . | xargs -n1 -I {} cp ../build/embed/* {}/
cd release && ls -1 . | xargs -n1 -I {} tar zcvf {}.tar.gz {}
deploy:
mkdir -p /deploy/$(VERSION)
cp release/*.tar.gz /deploy/$(VERSION)/
DFSS
====
> Distributed Fair Signing System
Installation
------------
This archive contains all the needed DFSS modules to run a distributed multiparty signature.
You just have to untar the archive and run the following binaries:
```bash
./dfssc help # Client
./dfssp help # Platform
./dfssd help # Demonstrator
```
......@@ -5,7 +5,6 @@ import (
"crypto/x509"
"dfss/auth"
"io/ioutil"
"os/user"
"path/filepath"
)
......@@ -22,17 +21,6 @@ type PlatformID struct {
RootCA *x509.Certificate
}
// GetHomeDir determines the home directory of the current user.
func GetHomeDir() string {
usr, err := user.Current()
if err != nil {
panic(err)
}
return usr.HomeDir
}
// GenerateRootCA constructs a self-signed certificate, using a unique serial number randomly generated
func GenerateRootCA(days int, country, organization, unit, cn string, key *rsa.PrivateKey) ([]byte, error) {
serial := auth.GenerateUID()
......
......@@ -16,26 +16,6 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestGetHomeDir(t *testing.T) {
res := GetHomeDir()
if res == "" {
t.Fatal("Result is empty")
}
}
func TestGenerateRootCA(t *testing.T) {
res, err := GenerateRootCA(365, "country", "organization", "unit", "cn", pkey)
if res == nil || err != nil {
t.Fatal(err)
}
if res[0] != '-' {
t.Fatalf("Bad format\n%s", res)
}
}
func TestInitialize(t *testing.T) {
path := os.TempDir()
keyPath := filepath.Join(path, PkeyFileName)
......
......@@ -26,7 +26,7 @@ func init() {
flag.StringVar(&port, "p", "9000", "Default port listening")
flag.StringVar(&address, "a", "0.0.0.0", "Default address to bind for listening")
flag.StringVar(&path, "path", authority.GetHomeDir(), "Path for the platform's private key and root certificate")
flag.StringVar(&path, "path", ".", "Path for the platform's private key and root certificate")
flag.StringVar(&country, "country", "France", "Country for the root certificate")
flag.StringVar(&org, "org", "DFSS", "Organization for the root certificate")
flag.StringVar(&unit, "unit", "INSA Rennes", "Organizational unit for the root certificate")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment