Skip to content

Commit

Permalink
ci: add GitHub Actions workflow 'Test'
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Feb 2, 2021
1 parent b99232c commit 5d7f1ff
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on:
push:
pull_request:

env:
GO111MODULE: on

jobs:


test:
strategy:
fail-fast: false
matrix:
platform:
- { icon: 🐧, os: ubuntu }
- { icon: 🍎, os: macOS }
go:
- 1.14.x
- 1.15.x
name: '${{ matrix.platform.icon }} ${{ matrix.go }}'
runs-on: ${{ matrix.platform.os }}-latest
steps:

- name: '⚙️ Setup go'
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- name: '🧰 Checkout'
uses: actions/checkout@v2

- name: '⚙️ Install deps'
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $HOME/go/bin/ latest
go install github.com/kyoh86/richgo
go install github.com/mitchellh/gox
- name: '🚧 Run tests'
run: PATH=$HOME/go/bin/:$PATH make


test-win:
name: '🟪 MINGW64'
defaults:
run:
shell: msys2 {0}
runs-on: windows-latest
steps:

- name: '⚙️ Git config'
shell: bash
run: git config --global core.autocrlf input

- name: '🟪 Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >
git
make
unzip
mingw-w64-x86_64-go
- name: '🧰 Checkout'
uses: actions/checkout@v2

- name: '⚙️ Install deps'
run: |
export GOBIN=$HOME/go/bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOBIN latest
go install github.com/kyoh86/richgo
go install github.com/mitchellh/gox
- name: '🚧 Run tests'
run: PATH=$HOME/go/bin:$PATH make
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/),
[Hugo](https://gohugo.io), and [Github CLI](https://github.com/cli/cli) to
name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra.

[![](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)
[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra)
[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra)
[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cobra)](https://goreportcard.com/report/github.com/spf13/cobra)
Expand Down

0 comments on commit 5d7f1ff

Please sign in to comment.