Skip to content

Commit 605adae

Browse files
authored
Merge pull request #352 from bulletmys/upd_ci
added Github Actions CI instead of Travis CI
2 parents eecedd1 + 42b87bf commit 605adae

6 files changed

Lines changed: 73 additions & 25 deletions

File tree

.github/workflows/easyjson.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: easyjson
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
name: Test with Go ${{ matrix.go }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
go: [ 1.17, 1.16, 1.15 ]
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Go ${{ matrix.go }}
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: ${{ matrix.go }}
24+
25+
- name: Install golint (for old go version)
26+
if: matrix.go < 1.16
27+
run: go get golang.org/x/lint/golint && go mod tidy
28+
29+
- name: Install golint
30+
if: matrix.go > 1.15
31+
run: go install golang.org/x/lint/golint@latest
32+
33+
- name: Build and Run tests
34+
run: make
35+
36+
test-non-amd64:
37+
runs-on: ubuntu-latest
38+
name: Test on ${{ matrix.distro }} ${{ matrix.arch }}
39+
strategy:
40+
matrix:
41+
include:
42+
- arch: ppc64le
43+
distro: ubuntu20.04
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: uraimo/run-on-arch-action@master
47+
with:
48+
arch: ${{ matrix.arch }}
49+
distro: ${{ matrix.distro }}
50+
install: |
51+
apt-get update
52+
apt install -y curl wget make gcc
53+
latestGo=$(curl "https://golang.org/VERSION?m=text")
54+
wget --quiet "https://dl.google.com/go/${latestGo}.linux-${{ matrix.arch }}.tar.gz"
55+
rm -f $(which go)
56+
rm -rf /usr/local/go
57+
tar -C /usr/local -xzf "${latestGo}.linux-${{ matrix.arch }}.tar.gz"
58+
run: |
59+
export PATH=/usr/local/go/bin:$PATH
60+
export PATH=~/go/bin:$PATH
61+
printf "Go Version: $(go version)\n"
62+
go install golang.org/x/lint/golint@latest
63+
make

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ clean:
66
rm -rf benchmark/*_easyjson.go
77

88
build:
9-
go build -i -o ./bin/easyjson ./easyjson
9+
go build -o ./bin/easyjson ./easyjson
1010

1111
generate: build
1212
bin/easyjson -stubs \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# easyjson [![Build Status](https://travis-ci.org/mailru/easyjson.svg?branch=master)](https://travis-ci.org/mailru/easyjson) [![Go Report Card](https://goreportcard.com/badge/github.com/mailru/easyjson)](https://goreportcard.com/report/github.com/mailru/easyjson)
1+
# easyjson [![Build Status](https://github.com/mailru/easyjson/actions/workflows/easyjson.yml/badge.svg)](https://travis-ci.org/mailru/easyjson) [![Go Report Card](https://goreportcard.com/badge/github.com/mailru/easyjson)](https://goreportcard.com/report/github.com/mailru/easyjson)
22

33
Package easyjson provides a fast and easy way to marshal/unmarshal Go structs
44
to/from JSON without the use of reflection. In performance tests, easyjson

tests/intern_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ func TestStringIntern(t *testing.T) {
2020
t.Fatalf("wrong value: %q", i.Field)
2121
}
2222
})
23-
if allocsPerRun != 1 {
24-
t.Fatalf("expected 1 allocs, got %f", allocsPerRun)
23+
if allocsPerRun > 1 {
24+
t.Fatalf("expected <= 1 allocs, got %f", allocsPerRun)
2525
}
2626

2727
var n NoIntern
@@ -35,7 +35,7 @@ func TestStringIntern(t *testing.T) {
3535
t.Fatalf("wrong value: %q", n.Field)
3636
}
3737
})
38-
if allocsPerRun != 2 {
39-
t.Fatalf("expected 2 allocs, got %f", allocsPerRun)
38+
if allocsPerRun > 2 {
39+
t.Fatalf("expected <= 2 allocs, got %f", allocsPerRun)
4040
}
4141
}

tests/nocopy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func TestNocopy(t *testing.T) {
5353
t.Fatalf("wrong value: %q", res.B)
5454
}
5555
})
56-
if allocsPerRun != 1 {
57-
t.Fatalf("noCopy field unmarshal: expected 1 allocs, got %f", allocsPerRun)
56+
if allocsPerRun > 1 {
57+
t.Fatalf("noCopy field unmarshal: expected <= 1 allocs, got %f", allocsPerRun)
5858
}
5959

6060
data = []byte(`{"a": "valueNoCopy"}`)
@@ -67,7 +67,7 @@ func TestNocopy(t *testing.T) {
6767
t.Fatalf("wrong value: %q", res.A)
6868
}
6969
})
70-
if allocsPerRun != 2 {
71-
t.Fatalf("copy field unmarshal: expected 2 allocs, got %f", allocsPerRun)
70+
if allocsPerRun > 2 {
71+
t.Fatalf("copy field unmarshal: expected <= 2 allocs, got %f", allocsPerRun)
7272
}
7373
}

0 commit comments

Comments
 (0)