CI: replace travis with GitHub actions (#56)

Fixes #55

* .travis: run tests with go1.17.x

* go.{mod,sum}: bump dependencies

* .gitignore: add dist/

* ci: run test on github-action

* ci: goreleaser runs on github action
This commit is contained in:
Aurélien Rainone 2021-09-25 07:07:49 -07:00 committed by GitHub
parent 8703c0d545
commit 9102751c0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 74 additions and 42 deletions

30
.github/workflows/goreleaser.yml vendored Normal file
View file

@ -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 }}

15
.github/workflows/tests.yml vendored Normal file
View file

@ -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 ./...

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dist

View file

@ -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:"

View file

@ -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

View file

@ -5,8 +5,8 @@
<hr>
<p align="center">
<a href="https://travis-ci.com/arl/gitmux">
<img alt="travis-ci" src="https://travis-ci.com/arl/gitmux.svg?branch=master" />
<a href="https://github.com/arl/gitmux/actions">
<img alt="tests" src="https://github.com/arl/gitmux/actions/workflows/tests.yml/badge.svg" />
</a>
<a href="https://goreportcard.com/report/github.com/arl/gitmux">
<img alt="goreport" src="https://goreportcard.com/badge/github.com/arl/gitmux" />
@ -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) |

View file

@ -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")

4
go.mod
View file

@ -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
)

10
go.sum
View file

@ -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=

View file

@ -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
#[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