From b60dee45ae898d7279d833301008e379054ef3c2 Mon Sep 17 00:00:00 2001 From: Samuel Attwood Date: Wed, 7 Jun 2023 21:33:11 -0400 Subject: [PATCH 1/3] Updating workflows. Removing travis config. Updating go deps. Replacing deprecated ioutils functions. --- .github/dependabot.yml | 17 +++++++++ .github/workflows/release.yaml | 27 ++++++++++++++ .github/workflows/release.yml | 29 --------------- .github/workflows/test.yaml | 19 ++++++++++ .goreleaser.yml | 66 ++++++++++++++++++---------------- .travis.yml | 28 --------------- go.mod | 16 ++++----- go.sum | 42 ++++++++-------------- nats-top.go | 4 +-- scripts/cross_compile.sh | 17 --------- util/toputils.go | 9 +++-- util/toputils_test.go | 11 +++--- 12 files changed, 132 insertions(+), 153 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml delete mode 100755 scripts/cross_compile.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7662d99 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + # version updates: enabled + # security updates: enabled + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + # version updates: disabled + # security updates: enabled + # https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..dfbab8a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,27 @@ +name: Release +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6c0ae4a..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: goreleaser - -on: - push: - tags: - - '*' - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..0579d49 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,19 @@ +name: Test +on: pull_request +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Setup Dependencies + run: go mod download + + - name: Run Tests + run: go test -v -race ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index f36cbe2..9db4e2a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,52 +1,56 @@ -before: - hooks: - - go mod download +project_name: nats-top + +release: + draft: true + github: + owner: nats-io + name: nats-top + builds: - env: - CGO_ENABLED=0 - - GO111MODULE=on goos: + - darwin - linux - windows - - darwin - # Need nats-server 2.2.0 released for FreeBSD: - ##- freebsd + - freebsd goarch: - amd64 - - arm64 - arm + - arm64 + - 386 + - mips64le + - s390x goarm: - 6 - 7 ignore: - goos: darwin goarch: 386 - # These copied from nats-server ignores; if that repo updates the - # pre-generated stuff needed for non-cgo cross-compile to FreeBSD, we can - # update here too: - ##- goos: freebsd - ## goarch: arm - ##- goos: freebsd - ## goarch: arm64 - ##- goos: freebsd - ## goarch: 386 - # ... but only once nats-server 2.2.0 is released so we have cross-compile for FreeBSD at all + - goos: freebsd + goarch: arm + - goos: freebsd + goarch: arm64 + - goos: freebsd + goarch: 386 checksum: - name_template: 'SHA256SUMS' - algorithm: sha256 - -snapshot: - name_template: "{{ .Tag }}-next" + name_template: 'checksums.txt' nfpms: - - file_name_template: '{{.ProjectName}}-{{.Tag}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}' - homepage: https://nats.io - description: "Top(1) style utility for NATS" - maintainer: Waldemar Quevedo - license: MIT - vendor: "Synadia Communications, Inc" - formats: + - formats: - deb - rpm - + file_name_template: >- + {{ .ProjectName }}-v{{ .Version }}- + {{- .Os }}- + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + bindir: /usr/local/bin + description: "Top(1) style utility for NATS" + vendor: nats.io + homepage: https://nats.io + license: MIT + maintainer: Synadia diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9f432d4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: go - -go: - - 1.19 - - 1.20 - -env: - global: - - BUILD_GOARCH=amd64 - matrix: - - BUILD_GOOS=linux - allow_failures: - - go: tip - -script: - - go fmt ./... - - go test -v -race ./util/ - -after_success: - - | - case "$TRAVIS_GO_VERSION" in - (1.19|1.19.*) - if [[ "$BUILD_GOOS" == "linux" ]] && [[ -n "$TRAVIS_TAG" ]]; then - ./scripts/cross_compile.sh - ghr --username wallyqs --token $GITHUB_TOKEN --replace --debug "$TRAVIS_TAG" pkg/ - fi - ;; - esac diff --git a/go.mod b/go.mod index 88ed75f..f6403b1 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,24 @@ module github.com/nats-io/nats-top -go 1.19 +go 1.20 require ( - github.com/nats-io/nats-server/v2 v2.9.15 + github.com/nats-io/nats-server/v2 v2.9.17 gopkg.in/gizak/termui.v1 v1.0.0-20151021151108-e62b5929642a ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/klauspost/compress v1.16.0 // indirect + github.com/klauspost/compress v1.16.5 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/minio/highwayhash v1.0.2 // indirect - github.com/nats-io/jwt/v2 v2.3.0 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/jwt/v2 v2.4.1 // indirect + github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/nsf/termbox-go v1.1.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/stretchr/testify v1.8.0 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/sys v0.5.0 // indirect + github.com/stretchr/testify v1.8.4 // indirect + golang.org/x/crypto v0.8.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/time v0.3.0 // indirect ) diff --git a/go.sum b/go.sum index 2feccdd..c54b660 100644 --- a/go.sum +++ b/go.sum @@ -1,49 +1,35 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= -github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI= -github.com/nats-io/jwt/v2 v2.3.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k= -github.com/nats-io/nats-server/v2 v2.9.15 h1:MuwEJheIwpvFgqvbs20W8Ish2azcygjf4Z0liVu2I4c= -github.com/nats-io/nats-server/v2 v2.9.15/go.mod h1:QlCTy115fqpx4KSOPFIxSV7DdI6OxtZsGOL1JLdeRlE= +github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4= +github.com/nats-io/jwt/v2 v2.4.1/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= +github.com/nats-io/nats-server/v2 v2.9.17 h1:gFpUQ3hqIDJrnqog+Bl5vaXg+RhhYEZIElasEuRn2tw= +github.com/nats-io/nats-server/v2 v2.9.17/go.mod h1:eQysm3xDZmIjfkjr7DuD9DjRFpnxQc2vKVxtEg0Dp6s= github.com/nats-io/nats.go v1.24.0 h1:CRiD8L5GOQu/DcfkmgBcTTIQORMwizF+rPk6T0RaHVQ= -github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= +github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY= github.com/nsf/termbox-go v1.1.1/go.mod h1:T0cTdVuOwf7pHQNtfhnEbzHbcNyCEcVU4YPpouCbVxo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/gizak/termui.v1 v1.0.0-20151021151108-e62b5929642a h1:3xTF5ZxN6yR6SZlNMCN7z4X633Zi87YC8FkxFsdgdM0= gopkg.in/gizak/termui.v1 v1.0.0-20151021151108-e62b5929642a/go.mod h1:An8M7oA8GI+74WiR1qJo67ptrdlb7LJLqoXspnSrMUA= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/nats-top.go b/nats-top.go index f209b96..fe7ed3a 100644 --- a/nats-top.go +++ b/nats-top.go @@ -15,8 +15,6 @@ import ( ui "gopkg.in/gizak/termui.v1" ) -const version = "0.6.0" - var ( host = flag.String("s", "127.0.0.1", "The nats server host.") port = flag.Int("m", 8222, "The NATS server monitoring port.") @@ -37,6 +35,8 @@ var ( keyOpt = flag.String("key", "", "Client private key in case NATS server using TLS") caCertOpt = flag.String("cacert", "", "Root CA cert") skipVerifyOpt = flag.Bool("k", false, "Skip verifying server certificate") + + version = "0.0.0" ) const usageHelp = ` diff --git a/scripts/cross_compile.sh b/scripts/cross_compile.sh deleted file mode 100755 index 2b48094..0000000 --- a/scripts/cross_compile.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -go install github.com/mitchellh/gox@latest -go install github.com/tcnksm/ghr@latest - -APPNAME="nats-top" -OSARCH="linux/amd64 darwin/amd64 linux/arm windows/amd64" -DIRS="linux_amd64 darwin_amd64 linux_arm windows_amd64" -OUTDIR="pkg" - -gox -osarch="$OSARCH" -output "$OUTDIR/$APPNAME-{{.OS}}_{{.Arch}}/$APPNAME" -for dir in $DIRS; do \ - (cp readme.md $OUTDIR/$APPNAME-$dir/readme.md) ;\ - (cp LICENSE $OUTDIR/$APPNAME-$dir/LICENSE) ;\ - (cd $OUTDIR && zip -q $APPNAME-$dir.zip -r $APPNAME-$dir) ;\ - echo "created '$OUTDIR/$APPNAME-$dir.zip', cleaning up..." ;\ - rm -rf $APPNAME-$dir;\ -done diff --git a/util/toputils.go b/util/toputils.go index e4c76f2..ec15f24 100644 --- a/util/toputils.go +++ b/util/toputils.go @@ -6,8 +6,9 @@ import ( "crypto/x509" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" + "os" "time" "github.com/nats-io/nats-server/v2/server" @@ -71,7 +72,7 @@ func (engine *Engine) Request(path string) (interface{}, error) { return nil, fmt.Errorf("could not get stats from server: %w", err) } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("could not read response body: %w", err) } @@ -244,7 +245,7 @@ func (engine *Engine) fetchStats() *Stats { func (engine *Engine) SetupHTTPS(caCertOpt, certOpt, keyOpt string, skipVerifyOpt bool) error { tlsConfig := &tls.Config{} if caCertOpt != "" { - caCert, err := ioutil.ReadFile(caCertOpt) + caCert, err := os.ReadFile(caCertOpt) if err != nil { return err } @@ -276,8 +277,6 @@ func (engine *Engine) SetupHTTPS(caCertOpt, certOpt, keyOpt string, skipVerifyOp func (engine *Engine) SetupHTTP() { engine.HttpClient = &http.Client{} engine.Uri = fmt.Sprintf("http://%s:%d", engine.Host, engine.Port) - - return } // Stats represents the monitored data from a NATS server. diff --git a/util/toputils_test.go b/util/toputils_test.go index 9e76697..ade616f 100644 --- a/util/toputils_test.go +++ b/util/toputils_test.go @@ -56,7 +56,8 @@ func TestFetchingStatz(t *testing.T) { go func() { conn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", NATS_SERVER_TEST_PORT)) if err != nil { - t.Fatalf("could not create subcription to NATS: %s", err) + t.Errorf("could not create subcription to NATS: %s", err) + return } fmt.Fprintf(conn, "SUB hello.world 90\r\n") time.Sleep(5 * time.Second) @@ -198,7 +199,7 @@ func TestMonitorStats(t *testing.T) { go func() { err := engine.MonitorStats() if err != nil { - t.Fatalf("Could not start info monitoring loop. expected no error, got: %v", err) + t.Errorf("Could not start info monitoring loop. expected no error, got: %v", err) } }() defer close(engine.ShutdownCh) @@ -228,7 +229,7 @@ func TestMonitoringTLSConnectionUsingRootCA(t *testing.T) { go func() { err := engine.MonitorStats() if err != nil { - t.Fatalf("Could not start info monitoring loop. expected no error, got: %v", err) + t.Errorf("Could not start info monitoring loop. expected no error, got: %v", err) } }() defer close(engine.ShutdownCh) @@ -258,7 +259,7 @@ func TestMonitoringTLSConnectionUsingRootCAWithCerts(t *testing.T) { go func() { err := engine.MonitorStats() if err != nil { - t.Fatalf("Could not start info monitoring loop. expected no error, got: %v", err) + t.Errorf("Could not start info monitoring loop. expected no error, got: %v", err) } }() defer close(engine.ShutdownCh) @@ -288,7 +289,7 @@ func TestMonitoringTLSConnectionUsingCertsAndInsecure(t *testing.T) { go func() { err := engine.MonitorStats() if err != nil { - t.Fatalf("Could not start info monitoring loop. expected no error, got: %v", err) + t.Errorf("Could not start info monitoring loop. expected no error, got: %v", err) } }() defer close(engine.ShutdownCh) From bebfc1fc4125abd8f2355fcc95c36cb342102e39 Mon Sep 17 00:00:00 2001 From: Samuel Attwood Date: Tue, 27 Jun 2023 21:44:54 -0400 Subject: [PATCH 2/3] Bumping go modules. Tweaking CI config --- .github/workflows/release.yaml | 2 +- .github/workflows/test.yaml | 17 +++++++++++------ .goreleaser.yml | 11 +++++++++-- go.mod | 6 +++--- go.sum | 14 +++++++------- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dfbab8a..b72b190 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version-file: go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0579d49..bbe2c3b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,19 +1,24 @@ name: Test -on: pull_request +on: + push: + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + jobs: test: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout Source + uses: actions/checkout@v3 - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.20' - - - name: Setup Dependencies - run: go mod download + go-version-file: go.mod - name: Run Tests run: go test -v -race ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index 9db4e2a..48488e1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,17 +1,24 @@ +--- project_name: nats-top release: + name_template: 'Release {{.Tag}}' draft: true github: owner: nats-io name: nats-top builds: - - env: + - id: nats-top + binary: nats-top + main: nats-top.go + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} + env: - CGO_ENABLED=0 goos: - - darwin - linux + - darwin - windows - freebsd goarch: diff --git a/go.mod b/go.mod index f6403b1..b7c758e 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/nats-io/nats-top go 1.20 require ( - github.com/nats-io/nats-server/v2 v2.9.17 + github.com/nats-io/nats-server/v2 v2.9.19 gopkg.in/gizak/termui.v1 v1.0.0-20151021151108-e62b5929642a ) @@ -18,7 +18,7 @@ require ( github.com/nsf/termbox-go v1.1.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/stretchr/testify v1.8.4 // indirect - golang.org/x/crypto v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/time v0.3.0 // indirect ) diff --git a/go.sum b/go.sum index c54b660..73be500 100644 --- a/go.sum +++ b/go.sum @@ -9,9 +9,9 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4= github.com/nats-io/jwt/v2 v2.4.1/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= -github.com/nats-io/nats-server/v2 v2.9.17 h1:gFpUQ3hqIDJrnqog+Bl5vaXg+RhhYEZIElasEuRn2tw= -github.com/nats-io/nats-server/v2 v2.9.17/go.mod h1:eQysm3xDZmIjfkjr7DuD9DjRFpnxQc2vKVxtEg0Dp6s= -github.com/nats-io/nats.go v1.24.0 h1:CRiD8L5GOQu/DcfkmgBcTTIQORMwizF+rPk6T0RaHVQ= +github.com/nats-io/nats-server/v2 v2.9.19 h1:OF9jSKZGo425C/FcVVIvNgpd36CUe7aVTTXEZRJk6kA= +github.com/nats-io/nats-server/v2 v2.9.19/go.mod h1:aTb/xtLCGKhfTFLxP591CMWfkdgBmcUUSkiSOe5A3gw= +github.com/nats-io/nats.go v1.27.0 h1:3o9fsPhmoKm+yK7rekH2GtWoE+D9jFbw8N3/ayI1C00= github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= @@ -23,11 +23,11 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= -golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= gopkg.in/gizak/termui.v1 v1.0.0-20151021151108-e62b5929642a h1:3xTF5ZxN6yR6SZlNMCN7z4X633Zi87YC8FkxFsdgdM0= From 5e29a86d2746f38efac4d5cd8ae5b71da3de7564 Mon Sep 17 00:00:00 2001 From: Samuel Attwood <45669855+samuelattwood@users.noreply.github.com> Date: Tue, 27 Jun 2023 21:54:48 -0400 Subject: [PATCH 3/3] Updating badges --- readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index fef5430..91628ce 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,7 @@ # nats-top -[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/nats-io/nats-top/blob/main/LICENSE)[![Build Status](https://travis-ci.org/nats-io/nats-top.svg?branch=main)](http://travis-ci.org/nats-io/nats-top)[![GitHub release](http://img.shields.io/github/release/nats-io/nats-top.svg?style=flat-square)](https://github.com/nats-io/nats-top/releases) +[![License][License-Image]][License-Url] ![Build][Build-Status-Image] [![Release][Release-Image]][Release-Url] + `nats-top` is a `top`-like tool for monitoring NATS servers. @@ -132,3 +133,9 @@ While in top view, it is possible to use the following commands: ## Demo ![nats-top](https://cloud.githubusercontent.com/assets/26195/12911060/901419e0-cec4-11e5-8384-e222a891e6bf.gif) + +[License-Url]: https://github.com/nats-io/nats-top/blob/main/LICENSE +[License-Image]: http://img.shields.io/badge/license-MIT-blue.svg +[Build-Status-Image]: https://img.shields.io/github/actions/workflow/status/nats-io/nats-top/test.yaml?branch=main +[Release-Image]: http://img.shields.io/github/release/nats-io/nats-top.svg +[Release-Url]: https://github.com/nats-io/nats-top/releases