Skip to content

Commit b73b344

Browse files
umarcorjpmcb
andauthored
ci: add GitHub Actions workflow 'Test' (#1339)
Adds a "test" action which will run side by side (for now) with Travis Co-authored-by: John McBride <[email protected]>
1 parent 652c755 commit b73b344

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/Test.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
GO111MODULE: on
9+
10+
jobs:
11+
12+
13+
test-unix:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
platform:
18+
- ubuntu
19+
- macOS
20+
go:
21+
- 1.14.x
22+
- 1.15.x
23+
name: '${{ matrix.platform }} | ${{ matrix.go }}'
24+
runs-on: ${{ matrix.platform }}-latest
25+
steps:
26+
27+
- uses: actions/setup-go@v2
28+
with:
29+
go-version: ${{ matrix.go }}
30+
31+
- uses: actions/checkout@v2
32+
33+
- uses: actions/cache@v2
34+
with:
35+
path: ~/go/pkg/mod
36+
key: ${{ runner.os }}-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
37+
restore-keys: ${{ runner.os }}-${{ matrix.go }}-
38+
39+
- run: |
40+
export GOBIN=$HOME/go/bin
41+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOBIN latest
42+
go install github.com/kyoh86/richgo
43+
go install github.com/mitchellh/gox
44+
45+
- run: PATH=$HOME/go/bin/:$PATH make
46+
47+
48+
test-win:
49+
name: MINGW64
50+
defaults:
51+
run:
52+
shell: msys2 {0}
53+
runs-on: windows-latest
54+
steps:
55+
56+
- shell: bash
57+
run: git config --global core.autocrlf input
58+
59+
- uses: msys2/setup-msys2@v2
60+
with:
61+
msystem: MINGW64
62+
update: true
63+
install: >
64+
git
65+
make
66+
unzip
67+
mingw-w64-x86_64-go
68+
69+
- uses: actions/checkout@v2
70+
71+
- uses: actions/cache@v2
72+
with:
73+
path: ~/go/pkg/mod
74+
key: ${{ runner.os }}-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
75+
restore-keys: ${{ runner.os }}-${{ matrix.go }}-
76+
77+
- run: |
78+
export GOBIN=$HOME/go/bin
79+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOBIN latest
80+
go install github.com/kyoh86/richgo
81+
go install github.com/mitchellh/gox
82+
83+
- run: PATH=$HOME/go/bin:$PATH make

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/),
66
[Hugo](https://gohugo.io), and [Github CLI](https://github.com/cli/cli) to
77
name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra.
88

9+
[![](https://img.shields.io/github/workflow/status/spf13/cobra/Test?longCache=tru&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest)
910
[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra)
1011
[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra)
1112
[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cobra)](https://goreportcard.com/report/github.com/spf13/cobra)

0 commit comments

Comments
 (0)