Skip to content

Commit f60ee13

Browse files
authored
feat(darwin-arm64): add support for darwin-arm64 (#60)
* 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
1 parent c68e472 commit f60ee13

File tree

7 files changed

+59
-24
lines changed

7 files changed

+59
-24
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-go@v2
15+
with:
16+
go-version: '^1.17.5'
17+
- run: make test
18+

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL = /bin/sh
22

3-
VERSION=1.3.0
3+
VERSION=1.4.0
44
BUILD=`git rev-parse HEAD`
55

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

2324
release: distclean dist
2425
@hub release create\
2526
-a dist/testtrack.linux\
26-
-a dist/testtrack.darwin\
27+
-a dist/testtrack.darwin-amd64\
28+
-a dist/testtrack.darwin-arm64\
2729
-m "TestTrack CLI ${VERSION}"\
2830
-t "${BUILD}"\
2931
v${VERSION}
3032

3133
test:
32-
@(cd; GO111MODULE=on go get golang.org/x/tools/cmd/goimports)
33-
@(cd; GO111MODULE=on go get golang.org/x/lint/golint)
34-
@GOIMPORTS_RESULT=$$(goimports -l ${PACKAGES} | grep -v ${LINTEXCLUDES});\
34+
@go install golang.org/x/tools/cmd/goimports@latest
35+
@go install golang.org/x/lint/golint@latest
36+
@GOIMPORTS_RESULT=$$($$(go env GOPATH)/bin/goimports -l ${PACKAGES} | grep -v ${LINTEXCLUDES});\
3537
if [ $$(echo "$$GOIMPORTS_RESULT\c" | head -c1 | wc -c) -ne 0 ];\
3638
then\
3739
echo "Style violations found. Run the following command to fix:";\
@@ -41,7 +43,7 @@ test:
4143
exit 1;\
4244
fi
4345
@go vet ${PACKAGES}
44-
@GOLINT_RESULT=$$(golint ${PACKAGES} | grep -v ${LINTEXCLUDES});\
46+
@GOLINT_RESULT=$$($$(go env GOPATH)/bin/golint ${PACKAGES} | grep -v ${LINTEXCLUDES});\
4547
if [ $$(echo "$$GOLINT_RESULT\c" | head -c1 | wc -c) -ne 0 ];\
4648
then\
4749
echo $$GOLINT_RESULT;\

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# testtrack-cli
22

3-
[![Build Status](https://travis-ci.org/Betterment/testtrack-cli.svg?branch=main)](https://travis-ci.org/Betterment/testtrack-cli)
3+
[![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)
44

55
## TestTrack Split Config Management
66

cmds/root.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import (
55
"fmt"
66
"net/url"
77
"os"
8+
"runtime"
89

910
"github.com/joho/godotenv"
1011
"github.com/spf13/cobra"
1112
)
1213

1314
var version string
1415
var build string
16+
var arch string = fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH)
1517
var noPrefix bool
1618
var force bool
1719

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

fakeserver/server_test.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,26 @@ func TestSplitRegistry(t *testing.T) {
120120
require.Nil(t, err)
121121

122122
require.Equal(t, 1, registry.ExperienceSamplingWeight)
123-
require.Equal(t, "test.test_experiment", registry.Splits[0].Name)
124-
require.Equal(t, 60, registry.Splits[0].Variants[0].Weight)
125-
require.Equal(t, 40, registry.Splits[0].Variants[1].Weight)
126-
require.Equal(t, false, registry.Splits[0].FeatureGate)
123+
124+
var split v4Split
125+
for _, s := range registry.Splits {
126+
if s.Name == "test.test_experiment" {
127+
split = s
128+
}
129+
}
130+
var control, treatment v4Variant
131+
for _, v := range split.Variants {
132+
if v.Name == "control" {
133+
control = v
134+
}
135+
if v.Name == "treatment" {
136+
treatment = v
137+
}
138+
}
139+
require.Equal(t, "test.test_experiment", split.Name)
140+
require.Equal(t, 60, control.Weight)
141+
require.Equal(t, 40, treatment.Weight)
142+
require.Equal(t, false, split.FeatureGate)
127143
})
128144
}
129145

go.mod

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
module github.com/Betterment/testtrack-cli
22

3-
go 1.15
3+
go 1.17
44

55
require (
6-
github.com/davecgh/go-spew v1.1.1 // indirect
76
github.com/gorilla/mux v1.7.1
8-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
97
github.com/joho/godotenv v1.3.0
108
github.com/pkg/errors v0.8.1
119
github.com/rs/cors v1.6.0
1210
github.com/spf13/cobra v0.0.3
13-
github.com/spf13/pflag v1.0.3 // indirect
1411
github.com/stretchr/testify v1.3.0
1512
gopkg.in/yaml.v2 v2.2.2
1613
)
14+
15+
require (
16+
github.com/davecgh/go-spew v1.1.1 // indirect
17+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
18+
github.com/pmezard/go-difflib v1.0.0 // indirect
19+
github.com/spf13/pflag v1.0.3 // indirect
20+
)

0 commit comments

Comments
 (0)