Skip to content

Commit 94d0eea

Browse files
unknwonSourcegraph Bot
and
Sourcegraph Bot
authored
ci: migrate from Travis to GitHub Actions (go-macaron#5)
* ci: migrate from Travis to GitHub Actions * Init Go modules and fix lint errors * README Co-authored-by: Sourcegraph Bot <[email protected]>
1 parent 1bcf7d1 commit 94d0eea

File tree

7 files changed

+97
-18
lines changed

7 files changed

+97
-18
lines changed

.github/workflows/go.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Go
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
env:
7+
GOPROXY: "https://proxy.golang.org"
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Run golangci-lint
16+
uses: actions-contrib/golangci-lint@v1
17+
18+
test:
19+
name: Test
20+
strategy:
21+
matrix:
22+
go-version: [1.13.x, 1.14.x]
23+
platform: [ubuntu-latest, macos-latest, windows-latest]
24+
runs-on: ${{ matrix.platform }}
25+
steps:
26+
- name: Install Go
27+
uses: actions/setup-go@v1
28+
with:
29+
go-version: ${{ matrix.go-version }}
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
- name: Run unit tests
33+
run: go test -v -race -coverprofile=coverage -covermode=atomic ./...
34+
- name: Upload coverage report to Codecov
35+
uses: codecov/[email protected]
36+
with:
37+
file: ./coverage
38+
flags: unittests
39+
- name: Cache downloaded modules
40+
uses: actions/cache@v1
41+
with:
42+
path: ~/go/pkg/mod
43+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
44+
restore-keys: |
45+
${{ runner.os }}-go-

.travis.yml

-13
This file was deleted.

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# gzip [![Build Status](https://travis-ci.org/go-macaron/gzip.svg?branch=master)](https://travis-ci.org/go-macaron/gzip) [![](http://gocover.io/_badge/github.com/go-macaron/gzip)](http://gocover.io/github.com/go-macaron/gzip)
1+
# gzip
2+
3+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/go-macaron/gzip/Go?logo=github&style=for-the-badge)](https://github.com/go-macaron/gzip/actions?query=workflow%3AGo)
4+
[![codecov](https://img.shields.io/codecov/c/github/go-macaron/gzip/master?logo=codecov&style=for-the-badge)](https://codecov.io/gh/go-macaron/gzip)
5+
[![GoDoc](https://img.shields.io/badge/GoDoc-Reference-blue?style=for-the-badge&logo=go)](https://pkg.go.dev/github.com/go-macaron/gzip?tab=doc)
6+
[![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg?style=for-the-badge&logo=sourcegraph)](https://sourcegraph.com/github.com/go-macaron/gzip)
27

38
Middleware gzip provides compress to responses for [Macaron](https://github.com/go-macaron/macaron).
49

go.mod

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/go-macaron/gzip
2+
3+
go 1.13
4+
5+
require (
6+
github.com/klauspost/compress v1.10.3
7+
github.com/smartystreets/goconvey v1.6.4
8+
gopkg.in/macaron.v1 v1.3.5
9+
)

go.sum

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 h1:NjHlg70DuOkcAMqgt0+XA+NHwtu66MkTVVgR4fFWbcI=
2+
github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw=
3+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
4+
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
5+
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
6+
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
7+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
8+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
9+
github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8=
10+
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
11+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
12+
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
13+
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
14+
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
15+
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
16+
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
17+
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
18+
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
19+
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
20+
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
21+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
22+
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
23+
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
24+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
25+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
26+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
27+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
28+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
29+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
30+
gopkg.in/ini.v1 v1.46.0 h1:VeDZbLYGaupuvIrsYCEOe/L/2Pcs5n7hdO1ZTjporag=
31+
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
32+
gopkg.in/macaron.v1 v1.3.5 h1:FUA16VFBojxzfU75KqWrV/6BPv9O2R1GnybSGRie9QQ=
33+
gopkg.in/macaron.v1 v1.3.5/go.mod h1:uMZCFccv9yr5TipIalVOyAyZQuOH3OkmXvgcWwhJuP4=

gzip.go

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
const (
3030
_HEADER_ACCEPT_ENCODING = "Accept-Encoding"
3131
_HEADER_CONTENT_ENCODING = "Content-Encoding"
32-
_HEADER_CONTENT_LENGTH = "Content-Length"
3332
_HEADER_CONTENT_TYPE = "Content-Type"
3433
_HEADER_VARY = "Vary"
3534
)

gzip_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func Test_Gzip(t *testing.T) {
4646
So(err, ShouldBeNil)
4747
m.ServeHTTP(resp, req)
4848

49-
_, ok := resp.HeaderMap[_HEADER_CONTENT_ENCODING]
49+
_, ok := resp.Result().Header[_HEADER_CONTENT_ENCODING]
5050
So(ok, ShouldBeFalse)
5151

5252
ce := resp.Header().Get(_HEADER_CONTENT_ENCODING)
@@ -57,7 +57,7 @@ func Test_Gzip(t *testing.T) {
5757
req.Header.Set(_HEADER_ACCEPT_ENCODING, "gzip")
5858
m.ServeHTTP(resp, req)
5959

60-
_, ok = resp.HeaderMap[_HEADER_CONTENT_ENCODING]
60+
_, ok = resp.Result().Header[_HEADER_CONTENT_ENCODING]
6161
So(ok, ShouldBeTrue)
6262

6363
ce = resp.Header().Get(_HEADER_CONTENT_ENCODING)
@@ -95,7 +95,8 @@ func Test_ResponseWriter_Hijack(t *testing.T) {
9595
hj, ok := rw.(http.Hijacker)
9696
So(ok, ShouldBeTrue)
9797

98-
hj.Hijack()
98+
_, _, err := hj.Hijack()
99+
So(err, ShouldBeNil)
99100
})
100101

101102
r, err := http.NewRequest("GET", "/", nil)

0 commit comments

Comments
 (0)