mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
Merge pull request #352 from bulletmys/upd_ci
added Github Actions CI instead of Travis CI
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
name: easyjson
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test with Go ${{ matrix.go }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
go: [ 1.17, 1.16, 1.15 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go ${{ matrix.go }}
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
|
||||
- name: Install golint (for old go version)
|
||||
if: matrix.go < 1.16
|
||||
run: go get golang.org/x/lint/golint && go mod tidy
|
||||
|
||||
- name: Install golint
|
||||
if: matrix.go > 1.15
|
||||
run: go install golang.org/x/lint/golint@latest
|
||||
|
||||
- name: Build and Run tests
|
||||
run: make
|
||||
|
||||
test-non-amd64:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test on ${{ matrix.distro }} ${{ matrix.arch }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch: ppc64le
|
||||
distro: ubuntu20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: uraimo/run-on-arch-action@master
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
distro: ${{ matrix.distro }}
|
||||
install: |
|
||||
apt-get update
|
||||
apt install -y curl wget make gcc
|
||||
latestGo=$(curl "https://golang.org/VERSION?m=text")
|
||||
wget --quiet "https://dl.google.com/go/${latestGo}.linux-${{ matrix.arch }}.tar.gz"
|
||||
rm -f $(which go)
|
||||
rm -rf /usr/local/go
|
||||
tar -C /usr/local -xzf "${latestGo}.linux-${{ matrix.arch }}.tar.gz"
|
||||
run: |
|
||||
export PATH=/usr/local/go/bin:$PATH
|
||||
export PATH=~/go/bin:$PATH
|
||||
printf "Go Version: $(go version)\n"
|
||||
go install golang.org/x/lint/golint@latest
|
||||
make
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
arch:
|
||||
- amd64
|
||||
- ppc64le
|
||||
language: go
|
||||
|
||||
go:
|
||||
- tip
|
||||
- stable
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
||||
install:
|
||||
- go get golang.org/x/lint/golint
|
||||
@@ -6,7 +6,7 @@ clean:
|
||||
rm -rf benchmark/*_easyjson.go
|
||||
|
||||
build:
|
||||
go build -i -o ./bin/easyjson ./easyjson
|
||||
go build -o ./bin/easyjson ./easyjson
|
||||
|
||||
generate: build
|
||||
bin/easyjson -stubs \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# easyjson [](https://travis-ci.org/mailru/easyjson) [](https://goreportcard.com/report/github.com/mailru/easyjson)
|
||||
# easyjson [](https://travis-ci.org/mailru/easyjson) [](https://goreportcard.com/report/github.com/mailru/easyjson)
|
||||
|
||||
Package easyjson provides a fast and easy way to marshal/unmarshal Go structs
|
||||
to/from JSON without the use of reflection. In performance tests, easyjson
|
||||
|
||||
@@ -20,8 +20,8 @@ func TestStringIntern(t *testing.T) {
|
||||
t.Fatalf("wrong value: %q", i.Field)
|
||||
}
|
||||
})
|
||||
if allocsPerRun != 1 {
|
||||
t.Fatalf("expected 1 allocs, got %f", allocsPerRun)
|
||||
if allocsPerRun > 1 {
|
||||
t.Fatalf("expected <= 1 allocs, got %f", allocsPerRun)
|
||||
}
|
||||
|
||||
var n NoIntern
|
||||
@@ -35,7 +35,7 @@ func TestStringIntern(t *testing.T) {
|
||||
t.Fatalf("wrong value: %q", n.Field)
|
||||
}
|
||||
})
|
||||
if allocsPerRun != 2 {
|
||||
t.Fatalf("expected 2 allocs, got %f", allocsPerRun)
|
||||
if allocsPerRun > 2 {
|
||||
t.Fatalf("expected <= 2 allocs, got %f", allocsPerRun)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ func TestNocopy(t *testing.T) {
|
||||
t.Fatalf("wrong value: %q", res.B)
|
||||
}
|
||||
})
|
||||
if allocsPerRun != 1 {
|
||||
t.Fatalf("noCopy field unmarshal: expected 1 allocs, got %f", allocsPerRun)
|
||||
if allocsPerRun > 1 {
|
||||
t.Fatalf("noCopy field unmarshal: expected <= 1 allocs, got %f", allocsPerRun)
|
||||
}
|
||||
|
||||
data = []byte(`{"a": "valueNoCopy"}`)
|
||||
@@ -67,7 +67,7 @@ func TestNocopy(t *testing.T) {
|
||||
t.Fatalf("wrong value: %q", res.A)
|
||||
}
|
||||
})
|
||||
if allocsPerRun != 2 {
|
||||
t.Fatalf("copy field unmarshal: expected 2 allocs, got %f", allocsPerRun)
|
||||
if allocsPerRun > 2 {
|
||||
t.Fatalf("copy field unmarshal: expected <= 2 allocs, got %f", allocsPerRun)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user