Skip to content

Commit

Permalink
fix goreleaser main, 2nd try
Browse files Browse the repository at this point in the history
 * move main binary to root
 * linting fixes
 * add docker login for image pushes
  • Loading branch information
Ulexus committed Apr 22, 2018
1 parent e111bc8 commit cbfb3d4
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ _testmain.go
*.swp

/vendor/*
/dist/
/ari-proxy
14 changes: 12 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
project_name: Asterisk ARI Proxy
builds:
- main: cmd/ari-proxy/ari-proxy/
env:
- env:
- CGO_ENABLED=0
goos:
- windows
Expand All @@ -12,6 +11,17 @@ builds:
hooks:
pre: dep ensure

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

dockers:
- image: cycoresystems/ari-proxy
tag_templates:
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ script: make ci
services:
- docker
deploy:
- provider: script
skip_cleanup: true
script: docker_login
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM ulexus/go-minimal
COPY cmd/ari-proxy/ari-proxy /app
COPY ari-proxy /app
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
all:
go build `go list ./... | grep -v /vendor/`
mkdir -p bin
go build -o bin/ari-proxy ./cmd/ari-proxy
go build

docker: all
docker build -t cycoresystems/ari-proxy ./
Expand All @@ -12,7 +12,7 @@ test:
go test `go list ./... | grep -v /vendor/`

lint:
gometalinter --disable=gotype --disable=errcheck client/... server/... proxy/...
gometalinter --disable=gotype --disable=errcheck ./... --skip internal --vendor

check: all lint test

Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions cmd/ari-proxy/cmd.go → cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var RootCmd = &cobra.Command{
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if ok, _ := cmd.PersistentFlags().GetBool("version"); ok {
if ok, _ := cmd.PersistentFlags().GetBool("version"); ok { // nolint: gas
fmt.Println(version)
os.Exit(0)
}
Expand Down Expand Up @@ -108,16 +108,12 @@ func runServer(ctx context.Context, log log15.Logger) error {
srv.Log = log

log.Info("Starting ari-proxy server", "version", version)
err := srv.Listen(ctx, &native.Options{
return srv.Listen(ctx, &native.Options{
Application: viper.GetString("ari.application"),
Username: viper.GetString("ari.username"),
Password: viper.GetString("ari.password"),
URL: viper.GetString("ari.http_url"),
WebsocketURL: viper.GetString("ari.websocket_url"),
}, natsURL)
if err != nil {
return err
}

return nil
}
1 change: 0 additions & 1 deletion cmd/ari-proxy/.gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions docker_login
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
File renamed without changes.
15 changes: 0 additions & 15 deletions session/utils.go

This file was deleted.

14 changes: 14 additions & 0 deletions session/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ package session

import "testing"

func stringSliceEq(left []string, right []string) bool {
if len(left) != len(right) {
return false
}

for idx := range left {
if left[idx] != right[idx] {
return false
}
}

return true
}

var stringSliceEqTests = []struct {
Left []string
Right []string
Expand Down

0 comments on commit cbfb3d4

Please sign in to comment.