From 9afd6d473b0d58a472c32be34330c7cbf946a8a5 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Fri, 28 Jan 2022 18:37:00 -0800 Subject: [PATCH] Migrate from Travis CI to GitHub Actions (#61) * Migrate from Travis CI to GitHub Actions Signed-off-by: Kazuyoshi Kato * Fix gofmt Signed-off-by: Kazuyoshi Kato --- .gitattributes | 2 ++ .github/workflows/ci.yaml | 48 +++++++++++++++++++++++++++++++++++++++ .golangci.yml | 9 ++++++++ .travis.yml | 37 ------------------------------ post_go18.go | 1 + post_go19.go | 1 + pre_go18.go | 1 + pre_go19.go | 1 + 8 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..49ad527 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# gofmt always uses LF, whereas Git uses CRLF on Windows. +*.go text eol=lf diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..fc065ee --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,48 @@ +name: Go + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + # No Windows this time. Some tests expect Unix-style paths. + os: [ ubuntu-latest, macos-latest ] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + # Due to https://github.com/go-openapi/swag/issues/59 + go-version: 1.16 + + - name: Setup gotestsum + uses: autero1/action-gotestsum@v1.0.0 + with: + gotestsum_version: 1.7.0 + + - name: Test + run: gotestsum --format short-verbose -- -race -timeout=20m -coverprofile=coverage_txt -covermode=atomic ./... + + - uses: codecov/codecov-action@v2 + with: + files: coverage_txt + + lint: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - uses: golangci/golangci-lint-action@v2 + with: + args: --timeout=5m \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index 842ac1c..2a4a71f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -39,3 +39,12 @@ linters: - paralleltest - thelper - ifshort + - gomoddirectives + - cyclop + - forcetypeassert + - ireturn + - tagliatelle + - varnamelen + - goimports + - tenv + - golint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fc25a88..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -after_success: -- bash <(curl -s https://codecov.io/bash) -go: -- 1.14.x -- 1.x -arch: -- amd64 -jobs: - include: - # include arch ppc, but only for latest go version - skip testing for race - - go: 1.x - arch: ppc64le - install: ~ - script: - - go test -v - - #- go: 1.x - # arch: arm - # install: ~ - # script: - # - go test -v - - # include linting job, but only for latest go version and amd64 arch - - go: 1.x - arch: amd64 - install: - go get github.com/golangci/golangci-lint/cmd/golangci-lint - script: - - golangci-lint run --new-from-rev master -install: -- GO111MODULE=off go get -u gotest.tools/gotestsum -language: go -notifications: - slack: - secure: QUWvCkBBK09GF7YtEvHHVt70JOkdlNBG0nIKu/5qc4/nW5HP8I2w0SEf/XR2je0eED1Qe3L/AfMCWwrEj+IUZc3l4v+ju8X8R3Lomhme0Eb0jd1MTMCuPcBT47YCj0M7RON7vXtbFfm1hFJ/jLe5+9FXz0hpXsR24PJc5ZIi/ogNwkaPqG4BmndzecpSh0vc2FJPZUD9LT0I09REY/vXR0oQAalLkW0asGD5taHZTUZq/kBpsNxaAFrLM23i4mUcf33M5fjLpvx5LRICrX/57XpBrDh2TooBU6Qj3CgoY0uPRYUmSNxbVx1czNzl2JtEpb5yjoxfVPQeg0BvQM00G8LJINISR+ohrjhkZmAqchDupAX+yFrxTtORa78CtnIL6z/aTNlgwwVD8kvL/1pFA/JWYmKDmz93mV/+6wubGzNSQCstzjkFA4/iZEKewKUoRIAi/fxyscP6L/rCpmY/4llZZvrnyTqVbt6URWpopUpH4rwYqreXAtJxJsfBJIeSmUIiDIOMGkCTvyTEW3fWGmGoqWtSHLoaWDyAIGb7azb+KvfpWtEcoPFWfSWU+LGee0A/YsUhBl7ADB9A0CJEuR8q4BPpKpfLwPKSiKSAXL7zDkyjExyhtgqbSl2jS+rKIHOZNL8JkCcTP2MKMVd563C5rC5FMKqu3S9m2b6380E= -script: -- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/post_go18.go b/post_go18.go index c2e686d..f5228b8 100644 --- a/post_go18.go +++ b/post_go18.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.8 // +build go1.8 package swag diff --git a/post_go19.go b/post_go19.go index eb2f2d8..7c7da9c 100644 --- a/post_go19.go +++ b/post_go19.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.9 // +build go1.9 package swag diff --git a/pre_go18.go b/pre_go18.go index 6607f33..2757d9b 100644 --- a/pre_go18.go +++ b/pre_go18.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !go1.8 // +build !go1.8 package swag diff --git a/pre_go19.go b/pre_go19.go index 4bae187..0565db3 100644 --- a/pre_go19.go +++ b/pre_go19.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !go1.9 // +build !go1.9 package swag