diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..b985344 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,30 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +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.17.x" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7409e32 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] +name: Tests +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "1.17.x" + - name: Tests + run: go test -race ./... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist diff --git a/.goreleaser.yml b/.goreleaser.yml index 25f98c6..e80426b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,8 +2,7 @@ before: hooks: - go mod tidy builds: - - - env: + - env: - CGO_ENABLED=0 goos: - darwin @@ -16,18 +15,17 @@ builds: - goos: darwin goarch: 386 archives: - - - replacements: + - replacements: darwin: macOS files: - - none* + - none* checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: name_template: "{{ .Tag }}" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4dea386..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -go: - - "1.15.x" - -cache: - directories: - - $GOPATH/pkg/mod - -# calls goreleaser -deploy: -- provider: script - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash - on: - tags: true diff --git a/README.md b/README.md index 2dc5aee..ad5b580 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@
-
-
+
+
@@ -136,14 +136,14 @@ See [`tmux` styles reference](https://man7.org/linux/man-pages/man1/tmux.1.html#
This is the list of the possible components of the `layout`:
-| Layout component | Description | Example |
-|:----------------:|:----------------------------------------------------------|:----------------------:|
-| `branch` | local branch name | `master` |
-| `remote-branch` | remote branch name | `origin/master` |
-| `divergence` | divergence local/remote branch, if any | `↓·2↑·1` |
-| `remote` | alias for `remote-branch` followed by `divergence` | `origin/master ↓·2↑·1` |
-| `flags` | Symbols representing the working tree state | `✚ 1 ⚑ 1 … 2` |
-| any string `foo` | Any other string is directly shown | `foo` |
+| Layout component | Description | Example |
+| :--------------: | :------------------------------------------------- | :------------------: |
+| `branch` | local branch name | `main` |
+| `remote-branch` | remote branch name | `origin/main` |
+| `divergence` | divergence local/remote branch, if any | `↓·2↑·1` |
+| `remote` | alias for `remote-branch` followed by `divergence` | `origin/main ↓·2↑·1` |
+| `flags` | Symbols representing the working tree state | `✚ 1 ⚑ 1 … 2` |
+| any string `foo` | Any other string is directly shown | `foo` |
@@ -162,7 +162,7 @@ layout: [flags, ~~~, branch]
This is the list of additional configuration `options`:
| Option | Description | Default |
-|:-----------------|:-----------------------------------------------------------|:---------------|
+| :--------------- | :--------------------------------------------------------- | :------------- |
| `branch_max_len` | Maximum displayed length for local and remote branch names | `0` (no limit) |
diff --git a/config_test.go b/config_test.go
index a3eca3e..36e71e6 100644
--- a/config_test.go
+++ b/config_test.go
@@ -113,6 +113,8 @@ func cloneAndHack(t *testing.T, dir string) {
t.Fatalf("write dummy: %s", err)
}
+ git(t, "config", "user.email", t.Name()+"@test.ci")
+ git(t, "config", "user.name", t.Name())
git(t, "add", "dummy")
git(t, "commit", "-m", "add dummy file")
diff --git a/go.mod b/go.mod
index 09cd089..1c86806 100644
--- a/go.mod
+++ b/go.mod
@@ -4,6 +4,6 @@ go 1.10
require (
github.com/arl/gitstatus v0.4.3
- github.com/stretchr/testify v1.3.0
- gopkg.in/yaml.v2 v2.2.4
+ github.com/stretchr/testify v1.7.0
+ gopkg.in/yaml.v2 v2.4.0
)
diff --git a/go.sum b/go.sum
index c8811bc..8daaa5f 100644
--- a/go.sum
+++ b/go.sum
@@ -4,11 +4,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
-gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/testdata/default.output.golden b/testdata/default.output.golden
index 0cda7f7..a399108 100755
--- a/testdata/default.output.golden
+++ b/testdata/default.output.golden
@@ -1 +1 @@
-#[fg=default]#[fg=default]#[fg=white,bold]⎇ #[fg=default]#[fg=white,bold]master#[fg=default]..#[fg=default]#[fg=cyan]origin/master#[fg=default] ↑·1#[fg=default] - #[fg=default]#[fg=green,bold]● 1 #[fg=red,bold]✚ 1 #[fg=cyan,bold]⚑ 1 #[fg=magenta,bold]… 1
\ No newline at end of file
+#[fg=default]#[fg=default]#[fg=white,bold]⎇ #[fg=default]#[fg=white,bold]main#[fg=default]..#[fg=default]#[fg=cyan]origin/main#[fg=default] ↑·1#[fg=default] - #[fg=default]#[fg=green,bold]● 1 #[fg=red,bold]✚ 1 #[fg=cyan,bold]⚑ 1 #[fg=magenta,bold]… 1
\ No newline at end of file