| 1 |
From 561dc95eeadf7fc57c2fe6ce2253f0f3361c0f75 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Brian Downs <[email protected]> |
| 3 |
Date: Sat, 12 Feb 2022 19:57:34 -0700 |
| 4 |
Subject: [PATCH] Update ci (#132) |
| 5 |
|
| 6 |
--- |
| 7 |
.circleci/config.yml | 27 +++++++++++++++++++++++++++ |
| 8 |
README.md | 2 +- |
| 9 |
spinner_test.go | 11 +++++++++++ |
| 10 |
3 files changed, 39 insertions(+), 1 deletion(-) |
| 11 |
create mode 100644 .circleci/config.yml |
| 12 |
|
| 13 |
diff --git a/.circleci/config.yml b/.circleci/config.yml |
| 14 |
new file mode 100644 |
| 15 |
index 0000000..6dc18bc |
| 16 |
--- /dev/null |
| 17 |
+++ b/.circleci/config.yml |
| 18 |
@@ -0,0 +1,27 @@ |
| 19 |
+version: 2 |
| 20 |
+jobs: |
| 21 |
+ build: |
| 22 |
+ docker: |
| 23 |
+ - image: circleci/golang:1.17 |
| 24 |
+ parallelism: 2 |
| 25 |
+ steps: |
| 26 |
+ - checkout |
| 27 |
+ - restore_cache: |
| 28 |
+ keys: |
| 29 |
+ - go-mod-v4-{{ checksum "go.sum" }} |
| 30 |
+ - run: make test |
| 31 |
+ - save_cache: |
| 32 |
+ key: go-mod-v4-{{ checksum "go.sum" }} |
| 33 |
+ paths: |
| 34 |
+ - "/go/pkg/mod" |
| 35 |
+ - store_artifacts: |
| 36 |
+ path: /tmp/test-results |
| 37 |
+ destination: raw-test-output |
| 38 |
+ |
| 39 |
+ - store_test_results: |
| 40 |
+ path: /tmp/test-results |
| 41 |
+workflows: |
| 42 |
+ version: 2 |
| 43 |
+ build-workflow: |
| 44 |
+ jobs: |
| 45 |
+ - build |
| 46 |
diff --git a/README.md b/README.md |
| 47 |
index 20b315f..28b024d 100644 |
| 48 |
--- a/README.md |
| 49 |
+++ b/README.md |
| 50 |
@@ -1,6 +1,6 @@ |
| 51 |
# Spinner |
| 52 |
|
| 53 |
-[](https://godoc.org/github.com/briandowns/spinner) [](https://travis-ci.org/briandowns/spinner) |
| 54 |
+[](https://godoc.org/github.com/briandowns/spinner) [](https://circleci.com/gh/briandowns/spinner) |
| 55 |
|
| 56 |
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. |
| 57 |
|
| 58 |
diff --git a/spinner_test.go b/spinner_test.go |
| 59 |
index cf3edfc..8ddf092 100644 |
| 60 |
--- a/spinner_test.go |
| 61 |
+++ b/spinner_test.go |
| 62 |
@@ -18,10 +18,13 @@ import ( |
| 63 |
"bytes" |
| 64 |
"fmt" |
| 65 |
"io/ioutil" |
| 66 |
+ "os" |
| 67 |
"reflect" |
| 68 |
"sync" |
| 69 |
"testing" |
| 70 |
"time" |
| 71 |
+ |
| 72 |
+ "github.com/mattn/go-isatty" |
| 73 |
) |
| 74 |
|
| 75 |
const baseWait = 3 |
| 76 |
@@ -69,6 +72,10 @@ func TestStart(t *testing.T) { |
| 77 |
|
| 78 |
// TestActive will verify we can tell when a spinner is running |
| 79 |
func TestActive(t *testing.T) { |
| 80 |
+ if !isatty.IsTerminal(os.Stdout.Fd()) { |
| 81 |
+ t.Log("not running in a terminal") |
| 82 |
+ return |
| 83 |
+ } |
| 84 |
s := New(CharSets[1], 100*time.Millisecond) |
| 85 |
if s.Active() { |
| 86 |
t.Error("expected a new spinner to not be active") |
| 87 |
@@ -127,6 +134,10 @@ func TestRestart(t *testing.T) { |
| 88 |
|
| 89 |
// TestHookFunctions will verify that hook functions works as expected |
| 90 |
func TestHookFunctions(t *testing.T) { |
| 91 |
+ if !isatty.IsTerminal(os.Stdout.Fd()) { |
| 92 |
+ t.Log("not running in a termian") |
| 93 |
+ return |
| 94 |
+ } |
| 95 |
s := New(CharSets[4], 50*time.Millisecond) |
| 96 |
var out syncBuffer |
| 97 |
s.Writer = &out |
| 98 |
-- |
| 99 |
2.35.1 |
| 100 |
|