From cf4ed8f6c06a8708a162119e2b16ae5baf4cad50 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 18:43:56 -0700 Subject: [PATCH 1/6] update tests Signed-off-by: Brian Downs --- spinner_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spinner_test.go b/spinner_test.go index cf3edfc..8ddf092 100644 --- a/spinner_test.go +++ b/spinner_test.go @@ -18,10 +18,13 @@ import ( "bytes" "fmt" "io/ioutil" + "os" "reflect" "sync" "testing" "time" + + "github.com/mattn/go-isatty" ) const baseWait = 3 @@ -69,6 +72,10 @@ func TestStart(t *testing.T) { // TestActive will verify we can tell when a spinner is running func TestActive(t *testing.T) { + if !isatty.IsTerminal(os.Stdout.Fd()) { + t.Log("not running in a terminal") + return + } s := New(CharSets[1], 100*time.Millisecond) if s.Active() { t.Error("expected a new spinner to not be active") @@ -127,6 +134,10 @@ func TestRestart(t *testing.T) { // TestHookFunctions will verify that hook functions works as expected func TestHookFunctions(t *testing.T) { + if !isatty.IsTerminal(os.Stdout.Fd()) { + t.Log("not running in a termian") + return + } s := New(CharSets[4], 50*time.Millisecond) var out syncBuffer s.Writer = &out From dce4e96335c69f2f56582ec7050cf5b20abbd9ef Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 18:56:05 -0700 Subject: [PATCH 2/6] add circle Signed-off-by: Brian Downs --- .circleci/config.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .circleci/config.yaml diff --git a/.circleci/config.yaml b/.circleci/config.yaml new file mode 100644 index 0000000..205ca5d --- /dev/null +++ b/.circleci/config.yaml @@ -0,0 +1,31 @@ +version: 2 +jobs: + build: + docker: + - image: circleci/golang:1.17 + parallelism: 2 + steps: + - checkout + - run: mkdir -p $TEST_RESULTS + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + command: | + PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname) + gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES + - run: make test + - save_cache: + key: go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" + - store_artifacts: + path: /tmp/test-results + destination: raw-test-output + + - store_test_results: + path: /tmp/test-results +workflows: + version: 2 + build-workflow: + jobs: + - build From 6b301d53582fee05dce165c7dd93e548c5f5f064 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 19:00:26 -0700 Subject: [PATCH 3/6] change name Signed-off-by: Brian Downs --- .circleci/{config.yaml => config.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .circleci/{config.yaml => config.yml} (100%) diff --git a/.circleci/config.yaml b/.circleci/config.yml similarity index 100% rename from .circleci/config.yaml rename to .circleci/config.yml From be19c94bc3656396fd28c8dd40c449803e7aede6 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 19:04:25 -0700 Subject: [PATCH 4/6] circle ci update Signed-off-by: Brian Downs --- .circleci/config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 205ca5d..6dc18bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,13 +6,9 @@ jobs: parallelism: 2 steps: - checkout - - run: mkdir -p $TEST_RESULTS - restore_cache: keys: - go-mod-v4-{{ checksum "go.sum" }} - command: | - PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname) - gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES - run: make test - save_cache: key: go-mod-v4-{{ checksum "go.sum" }} From 04a5f5b39a51ade7b7309a4ac05485af4f4d2847 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 19:29:45 -0700 Subject: [PATCH 5/6] update readme Signed-off-by: Brian Downs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 20b315f..7386d77 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Spinner -[![GoDoc](https://godoc.org/github.com/briandowns/spinner?status.svg)](https://godoc.org/github.com/briandowns/spinner) [![Build Status](https://travis-ci.org/briandowns/spinner.svg?branch=master)](https://travis-ci.org/briandowns/spinner) +[![GoDoc](https://godoc.org/github.com/briandowns/spinner?status.svg)](https://godoc.org/github.com/briandowns/spinner) [![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=svg)](https://circleci.com/gh/circleci/circleci-docs) spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full examples in the examples directory. From 3b67843406a6bf327057b644ebdfc37ec910147d Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Sat, 12 Feb 2022 19:52:52 -0700 Subject: [PATCH 6/6] update Signed-off-by: Brian Downs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7386d77..28b024d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Spinner -[![GoDoc](https://godoc.org/github.com/briandowns/spinner?status.svg)](https://godoc.org/github.com/briandowns/spinner) [![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=svg)](https://circleci.com/gh/circleci/circleci-docs) +[![GoDoc](https://godoc.org/github.com/briandowns/spinner?status.svg)](https://godoc.org/github.com/briandowns/spinner) [![CircleCI](https://circleci.com/gh/briandowns/spinner.svg?style=svg)](https://circleci.com/gh/briandowns/spinner) spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full examples in the examples directory.