From 87fc95849cd9ec7ffb3555bd7ec6317865902241 Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Fri, 18 Jun 2021 13:36:54 +0200 Subject: [PATCH] Run go test on github actions (#1047) * Run go test on github actions travis-ci.org has stopped. See also: https://github.com/curl/curl/issues/7150 Downside: github actions don't support ppc64le * Run less * delete .travis.yml * Remove travis + minor lint fixes --- .github/workflows/lint.yml | 10 +++-- .github/workflows/security.yml | 8 +++- .github/workflows/test.yml | 21 +++++++++++ .travis.yml | 67 ---------------------------------- README.md | 2 +- fasthttpproxy/http.go | 2 +- fasthttpproxy/proxy_env.go | 13 +++---- prefork/prefork.go | 4 +- uri_test.go | 2 +- 9 files changed, 45 insertions(+), 84 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 22b46e4..ef1b5c5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,9 @@ -name: lint - -on: [push, pull_request] - +name: Lint +on: + push: + branches: + - master + pull_request: jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index da67002..7763984 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -1,10 +1,14 @@ -on: [push, pull_request] name: Security +on: + push: + branches: + - master + pull_request: jobs: test: strategy: matrix: - go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x] + go-version: [1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..489d983 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: Test +on: + push: + branches: + - master + pull_request: +jobs: + test: + strategy: + matrix: + go-version: [1.15.x, 1.16.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - run: go version + - run: go test ./... + - run: go test -race ./... diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 55e6a5f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,67 +0,0 @@ -language: go -arch: - - amd64 - - ppc64le - -dist: bionic - -os: - - linux - - osx - - windows -go: - - 1.16.x - - 1.15.x - - 1.14.x - - 1.13.x - - 1.12.x - - tip - -script: - - go test -v ./... - -env: - global: - secure: 'v/F0oI9zE9mcpEp4AVdHzSSHbe5ZFtH6B0i/BiUXKdQRQ10+JMPDOFRJQti7yxjMwltyd/QSFmR50Fl108sQYpo4xdlEXMHp2Y6OAN6crrp6PuHbLYgDWu3df/cH7/BqDyIq1uX8KZEeQssnygYN8hN4tpJCUg+NIb40Lm57Zsodt8DVjjyDWQQFDL7soNyAwGwQIqEyJsn+NUieXWEB1Qnt0xUtPIReuLlrwXR8wC1nLEjG9yz4ftDHHQdhVbO2b+xGWyaJ7QB5ixztaQP8Jnny6kSW9j6zEhJVuzdZ6d3xz23ibCbzSXBHdIUEI9u6ifQj8BYXr8fFS0FB3++IxgAYSs3ybZ+qEwuAxSBBm6YNW+3FrfDknVwTQscjKqnXPisjUqaRC9b31hke0tXzBq1488hE+wxMXeDM4LwWT5IMEO2gz0WGQXxmdVit72DIjCZxJkf1TvZZ0YH7Y//6wJTYYP9xulsy4gqu8CuFdWiF3fiGc3p5DTIS75nJ/Yy76Sa1pRPASKCujfLxtHE6Mt0XKvSolIXklYIzBkjN6vn80N6JIrqtqlimBGPW/Ec6+dwbmRe2AcOKRl4y7pZsGYhJhqdue1mucUYO/e2QeBZJGkqqG+zF5AW0v8x29BHvMwViAonc8o9eelkJ8khYzc/Qeq05pZnR/N/Pqfc+68k=' - -before_install: - - go get -t -v ./... - -jobs: - allow_failures: - - go: tip - - include: - - stage: cross compilation - os: - - linux - script: - - GOOS=linux go build - - GOOS=darwin go build - - GOOS=freebsd go build - - GOOS=windows go build - - GOARCH=386 go build - - stage: cross compilation - os: - - osx - script: - - GOOS=linux go build - - GOOS=darwin go build - - GOOS=freebsd go build - - GOOS=windows go build - - stage: race detector - os: - - linux - script: - - go test -race -v ./... - - stage: race detector - os: - - osx - script: - - go test -race -v ./... - - stage: race detector - arch: ppc64le - os: - - linux - script: - - go test -race -v ./... diff --git a/README.md b/README.md index 8aee99d..894141e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# fasthttp [![Build Status](https://travis-ci.org/valyala/fasthttp.svg?branch=master)](https://travis-ci.org/valyala/fasthttp?branch=master) [![GoDoc](https://godoc.org/github.com/valyala/fasthttp?status.svg)](http://godoc.org/github.com/valyala/fasthttp) [![Go Report](https://goreportcard.com/badge/github.com/valyala/fasthttp)](https://goreportcard.com/report/github.com/valyala/fasthttp) [![Sourcegraph](https://sourcegraph.com/github.com/valyala/fasthttp/-/badge.svg)](https://sourcegraph.com/github.com/valyala/fasthttp?badge) +# fasthttp [![GoDoc](https://godoc.org/github.com/valyala/fasthttp?status.svg)](http://godoc.org/github.com/valyala/fasthttp) [![Go Report](https://goreportcard.com/badge/github.com/valyala/fasthttp)](https://goreportcard.com/report/github.com/valyala/fasthttp) [![Sourcegraph](https://sourcegraph.com/github.com/valyala/fasthttp/-/badge.svg)](https://sourcegraph.com/github.com/valyala/fasthttp?badge) ![FastHTTP – Fastest and reliable HTTP implementation in Go](https://github.com/fasthttp/docs-assets/raw/master/banner@0.5.png) diff --git a/fasthttpproxy/http.go b/fasthttpproxy/http.go index 0ba3092..6bc9c1e 100644 --- a/fasthttpproxy/http.go +++ b/fasthttpproxy/http.go @@ -22,7 +22,7 @@ func FasthttpHTTPDialer(proxy string) fasthttp.DialFunc { return FasthttpHTTPDialerTimeout(proxy, 0) } -// FasthttpHTTPDialer returns a fasthttp.DialFunc that dials using +// FasthttpHTTPDialerTimeout returns a fasthttp.DialFunc that dials using // the provided HTTP proxy using the given timeout. // // Example usage: diff --git a/fasthttpproxy/proxy_env.go b/fasthttpproxy/proxy_env.go index 22cc76e..2457ad5 100644 --- a/fasthttpproxy/proxy_env.go +++ b/fasthttpproxy/proxy_env.go @@ -14,6 +14,12 @@ import ( "github.com/valyala/fasthttp" ) +const ( + httpsScheme = "https" + httpScheme = "http" + tlsPort = "443" +) + // FasthttpProxyHTTPDialer returns a fasthttp.DialFunc that dials using // the the env(HTTP_PROXY, HTTPS_PROXY and NO_PROXY) configured HTTP proxy. // @@ -32,13 +38,6 @@ func FasthttpProxyHTTPDialer() fasthttp.DialFunc { // c := &fasthttp.Client{ // Dial: FasthttpProxyHTTPDialerTimeout(time.Second * 2), // } - -const ( - httpsScheme = "https" - httpScheme = "http" - tlsPort = "443" -) - func FasthttpProxyHTTPDialerTimeout(timeout time.Duration) fasthttp.DialFunc { proxier := httpproxy.FromEnvironment().ProxyFunc() diff --git a/prefork/prefork.go b/prefork/prefork.go index 9ace2ed..dc08b76 100644 --- a/prefork/prefork.go +++ b/prefork/prefork.go @@ -22,7 +22,9 @@ var ( defaultLogger = Logger(log.New(os.Stderr, "", log.LstdFlags)) // ErrOverRecovery is returned when the times of starting over child prefork processes exceed // the threshold. - ErrOverRecovery = errors.New("exceeding the value of RecoverThreshold") + ErrOverRecovery = errors.New("exceeding the value of RecoverThreshold") + + // ErrOnlyReuseportOnWindows is returned when Reuseport is false. ErrOnlyReuseportOnWindows = errors.New("windows only supports Reuseport = true") ) diff --git a/uri_test.go b/uri_test.go index e2995f6..2faf825 100644 --- a/uri_test.go +++ b/uri_test.go @@ -395,6 +395,6 @@ func TestURIWithQuerystringOverride(t *testing.T) { uriString := string(u.RequestURI()) if uriString != "/?q1=foo&q2=bar&q4=quux" { - t.Fatalf("Expected Querystring to be overriden but was %s ", uriString) + t.Fatalf("Expected Querystring to be overridden but was %s ", uriString) } }