Skip to content

Commit

Permalink
feat(darwin-arm64): add support for darwin-arm64 (#60)
Browse files Browse the repository at this point in the history
* feat(darwin-arm64): add support for darwin-arm64

* adds support in releases for darwin-arm64
* renames testtrack.darwin to testtrack.darwin-amd64
* adds testtrack.darwin-arm64
* upgrades go to 1.17 from 1.15
* sets up github actions for CI instead of travis

* fix workflow?

* fix flakey test

* fix CI badge in readme
  • Loading branch information
samandmoore authored Dec 16, 2021
1 parent c68e472 commit f60ee13
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 24 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17.5'
- run: make test

7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL = /bin/sh

VERSION=1.3.0
VERSION=1.4.0
BUILD=`git rev-parse HEAD`

LDFLAGS=-ldflags "-w -s \
Expand All @@ -18,20 +18,22 @@ install:
dist:
@mkdir dist &&\
GOOS=linux GOARCH=amd64 go build -o "dist/testtrack.linux" ${LDFLAGS} github.com/Betterment/testtrack-cli/testtrack &&\
GOOS=darwin GOARCH=amd64 go build -o "dist/testtrack.darwin" ${LDFLAGS} github.com/Betterment/testtrack-cli/testtrack
GOOS=darwin GOARCH=amd64 go build -o "dist/testtrack.darwin-amd64" ${LDFLAGS} github.com/Betterment/testtrack-cli/testtrack &&\
GOOS=darwin GOARCH=arm64 go build -o "dist/testtrack.darwin-arm64" ${LDFLAGS} github.com/Betterment/testtrack-cli/testtrack

release: distclean dist
@hub release create\
-a dist/testtrack.linux\
-a dist/testtrack.darwin\
-a dist/testtrack.darwin-amd64\
-a dist/testtrack.darwin-arm64\
-m "TestTrack CLI ${VERSION}"\
-t "${BUILD}"\
v${VERSION}

test:
@(cd; GO111MODULE=on go get golang.org/x/tools/cmd/goimports)
@(cd; GO111MODULE=on go get golang.org/x/lint/golint)
@GOIMPORTS_RESULT=$$(goimports -l ${PACKAGES} | grep -v ${LINTEXCLUDES});\
@go install golang.org/x/tools/cmd/goimports@latest
@go install golang.org/x/lint/golint@latest
@GOIMPORTS_RESULT=$$($$(go env GOPATH)/bin/goimports -l ${PACKAGES} | grep -v ${LINTEXCLUDES});\
if [ $$(echo "$$GOIMPORTS_RESULT\c" | head -c1 | wc -c) -ne 0 ];\
then\
echo "Style violations found. Run the following command to fix:";\
Expand All @@ -41,7 +43,7 @@ test:
exit 1;\
fi
@go vet ${PACKAGES}
@GOLINT_RESULT=$$(golint ${PACKAGES} | grep -v ${LINTEXCLUDES});\
@GOLINT_RESULT=$$($$(go env GOPATH)/bin/golint ${PACKAGES} | grep -v ${LINTEXCLUDES});\
if [ $$(echo "$$GOLINT_RESULT\c" | head -c1 | wc -c) -ne 0 ];\
then\
echo $$GOLINT_RESULT;\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# testtrack-cli

[![Build Status](https://travis-ci.org/Betterment/testtrack-cli.svg?branch=main)](https://travis-ci.org/Betterment/testtrack-cli)
[![Build status](https://github.com/Betterment/testtrack-cli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Betterment/testtrack-cli/actions/workflows/ci.yml?query=branch%3Amain)

## TestTrack Split Config Management

Expand Down
4 changes: 3 additions & 1 deletion cmds/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (
"fmt"
"net/url"
"os"
"runtime"

"github.com/joho/godotenv"
"github.com/spf13/cobra"
)

var version string
var build string
var arch string = fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH)
var noPrefix bool
var force bool

Expand All @@ -26,7 +28,7 @@ func init() {
var rootCmd = &cobra.Command{
Use: "testtrack",
Short: "TestTrack Split Config Management",
Long: fmt.Sprintf("CLI for managing TestTrack experiments and feature gates\n\nVersion: %s\nBuild: %s", version, build),
Long: fmt.Sprintf("CLI for managing TestTrack experiments and feature gates\n\nVersion: %s\nBuild: %s\nArch: %s", version, build, arch),
Version: version,
}

Expand Down
24 changes: 20 additions & 4 deletions fakeserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,26 @@ func TestSplitRegistry(t *testing.T) {
require.Nil(t, err)

require.Equal(t, 1, registry.ExperienceSamplingWeight)
require.Equal(t, "test.test_experiment", registry.Splits[0].Name)
require.Equal(t, 60, registry.Splits[0].Variants[0].Weight)
require.Equal(t, 40, registry.Splits[0].Variants[1].Weight)
require.Equal(t, false, registry.Splits[0].FeatureGate)

var split v4Split
for _, s := range registry.Splits {
if s.Name == "test.test_experiment" {
split = s
}
}
var control, treatment v4Variant
for _, v := range split.Variants {
if v.Name == "control" {
control = v
}
if v.Name == "treatment" {
treatment = v
}
}
require.Equal(t, "test.test_experiment", split.Name)
require.Equal(t, 60, control.Weight)
require.Equal(t, 40, treatment.Weight)
require.Equal(t, false, split.FeatureGate)
})
}

Expand Down
12 changes: 8 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
module github.com/Betterment/testtrack-cli

go 1.15
go 1.17

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gorilla/mux v1.7.1
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/joho/godotenv v1.3.0
github.com/pkg/errors v0.8.1
github.com/rs/cors v1.6.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.3.0
gopkg.in/yaml.v2 v2.2.2
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
)

0 comments on commit f60ee13

Please sign in to comment.