diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a36f031 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,57 @@ +name: build + +on: + push: + tags: [v*] + branches: [master] + pull_request: + +jobs: + # See https://github.com/mvdan/github-actions-golang + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + go-version: [1.14.x, 1.15.x] + # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations + include: + - os: windows-latest + go-version: 1.15.x + - os: macos-latest + go-version: 1.15.x + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v2 + + # See https://github.com/actions/cache/blob/master/examples.md#go---modules + - name: Cache Go Modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Go install moq + run: go install -mod=readonly + + - name: Run vet + if: matrix.os == 'ubuntu-latest' + run: go vet -mod=readonly ./... + + - name: Lint + if: matrix.os == 'ubuntu-latest' + run: | + GO111MODULE=off go get -u golang.org/x/lint/golint + golint ./... + + - name: Test + run: go test -mod=readonly ./... diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d0fe01f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: go - -sudo: false - -branches: - only: - - master - -jobs: - include: - - os: linux - go: 1.x - - os: osx - go: 1.x - - os: windows - go: 1.x - -before_install: - - go get golang.org/x/lint/golint - -before_script: - - go vet ./... - - golint ./... - -script: - - go test -v ./... diff --git a/README.md b/README.md index a2e0580..fdc6e39 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![moq logo](moq-logo-small.png) [![Build Status](https://travis-ci.org/matryer/moq.svg?branch=master)](https://travis-ci.org/matryer/moq) [![Go Report Card](https://goreportcard.com/badge/github.com/matryer/moq)](https://goreportcard.com/report/github.com/matryer/moq) +![moq logo](moq-logo-small.png) [![build](https://github.com/matryer/moq/workflows/build/badge.svg)](https://github.com/matryer/moq/actions?query=branch%3Amaster) [![Go Report Card](https://goreportcard.com/badge/github.com/matryer/moq)](https://goreportcard.com/report/github.com/matryer/moq) Interface mocking tool for go generate.