diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..325ee7c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: Build + +on: + push: + branches: [ v1 ] + pull_request: + branches: [ v1 ] + +jobs: + test: + strategy: + matrix: + go-version: [1.7.x, 1.8.x, 1.9.x, 1.10.x, 1.11.x, 1.12.x, 1.13.x, 1.14.x, tip] + full-tests: [false] + include: + - go-version: 1.15.x + full-tests: true + + runs-on: ubuntu-latest + + steps: + - name: Setup go + run: | + curl -sL https://raw.githubusercontent.com/maxatome/install-go/v2.0/install-go.pl | + perl - ${{ matrix.go-version }} $HOME/go + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Linting + if: matrix.full-tests + run: | + curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | + sh -s -- -b $HOME/go/bin v1.33.0 + $HOME/go/bin/golangci-lint run --max-issues-per-linter 0 \ + --max-same-issues 0 \ + -E exportloopref \ + -E gocritic \ + -E godot \ + -E goimports \ + -E golint \ + -E maligned \ + -E misspell \ + -E prealloc \ + -E unconvert \ + -E whitespace \ + ./... + + - name: Testing + continue-on-error: ${{ matrix.go-version == 'tip' }} + run: | + go version + if [ ${{ matrix.full-tests }} = true ]; then + GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out" + fi + case ${{ matrix.go-version }} in + 1.[789].x | 1.10.x) # Before go 1.11, go modules are not available + mkdir -p ../src/github.com/$GITHUB_REPOSITORY_OWNER + ln -s $(pwd) ../src/github.com/$GITHUB_REPOSITORY + export GOPATH=$(dirname $(pwd)) + cd $GOPATH/src/github.com/$GITHUB_REPOSITORY + ;; + esac + export GORACE="halt_on_error=1" + go test -race $GO_TEST_OPTS ./... + + - name: Reporting + if: matrix.full-tests + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + go get github.com/mattn/goveralls + goveralls -coverprofile=coverage.out -service=github diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d503770..0000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -language: go -go_import_path: github.com/jarcoal/httpmock - -sudo: false - -matrix: - include: - - go: 1.7.x - - go: 1.8.x - - go: 1.9.x - - go: 1.10.x - - go: 1.11.x - - go: 1.12.x - - go: 1.13.x - - go: 1.14.x - - go: 1.15.x - env: - - USE_LINTER=1 - - GO_TEST_OPTS="-covermode=atomic -coverprofile=coverage.out" - install: - - wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.30.0 - after_success: - - go get github.com/mattn/goveralls - - goveralls -coverprofile=coverage.out -service=travis-ci - - go: master - allow_failures: - - go: master - fast_finish: true - -script: - - export GORACE="halt_on_error=1" - - go test -race $GO_TEST_OPTS ./... - - > - if [ "$USE_LINTER" = 1 ]; then - golangci-lint run --max-issues-per-linter 0 \ - --max-same-issues 0 \ - -E exportloopref \ - -E gocritic \ - -E godot \ - -E goimports \ - -E golint \ - -E maligned \ - -E misspell \ - -E prealloc \ - -E unconvert \ - -E whitespace \ - ./...; - fi - -notifications: - email: false diff --git a/README.md b/README.md index 42ad5b5..e5fe0b6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# httpmock [![Build Status](https://travis-ci.org/jarcoal/httpmock.png?branch=v1)](https://travis-ci.org/jarcoal/httpmock) [![Coverage Status](https://coveralls.io/repos/github/jarcoal/httpmock/badge.svg?branch=v1)](https://coveralls.io/github/jarcoal/httpmock?branch=v1) [![GoDoc](https://godoc.org/github.com/jarcoal/httpmock?status.svg)](https://godoc.org/github.com/jarcoal/httpmock) [![Version](https://img.shields.io/github/tag/jarcoal/httpmock.svg)](https://github.com/jarcoal/httpmock/releases) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go/#testing) +# httpmock [![Build Status](https://github.com/jarcoal/httpmock/workflows/Build/badge.svg?branch=v1)](https://github.com/jarcoal/httpmock/actions?query=workflow%3ABuild) [![Coverage Status](https://coveralls.io/repos/github/jarcoal/httpmock/badge.svg?branch=v1)](https://coveralls.io/github/jarcoal/httpmock?branch=v1) [![GoDoc](https://godoc.org/github.com/jarcoal/httpmock?status.svg)](https://godoc.org/github.com/jarcoal/httpmock) [![Version](https://img.shields.io/github/tag/jarcoal/httpmock.svg)](https://github.com/jarcoal/httpmock/releases) [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go/#testing) Easy mocking of http responses from external resources.