From 62d881d6b2b25c02e404d6d41cb399bb0b3544c9 Mon Sep 17 00:00:00 2001 From: umarcor Date: Wed, 2 Oct 2019 20:12:42 +0200 Subject: [PATCH] ci: add GitHub Actions workflow 'push' (#968) --- .github/workflows/push.yml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000000..9c2906cd67 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,56 @@ +name: 'push' + +on: + push: + pull_request: + +env: + GO111MODULE: on + +jobs: + + test: + strategy: + fail-fast: false + matrix: + os: [ ubuntu, windows, macOS ] + go: [ 1.12.x, 1.13.x, 1.14.x ] + + runs-on: ${{ matrix.os }}-latest + + steps: + + - name: Setup go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + + - uses: actions/checkout@v2 + + - name: Run golangci-lint + if: matrix.os == 'ubuntu' + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./ latest + ./golangci-lint run -v + + - name: Run tests + shell: bash + run: | + go get -v github.com/kyoh86/richgo@v0.3.3 + $HOME/go/bin/richgo test -v ./... + + - name: Check formatting + if: matrix.os != 'windows' + run: diff -u <(echo -n) <(gofmt -d -s .) + + - name: Build + run: | + cd cobra + go build + + - name: go vet + if: matrix.os != 'windows' + run: | + if [ -z $NOVET ]; then + diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); + fi