Skip to content

Commit be43fdb

Browse files
author
Achille
authored
go 1.17 + build with github actions (#96)
* go 1.17 + build with github actions * push * github actions don't support anchors in yaml * run benchmarks against main branch on push * fix benchstat install * install benchstat with Go 1.17 * fix location of benchmark artifacts * fix location of benchmark artifacts * run benchmarks five times
1 parent 5de42cc commit be43fdb

6 files changed

Lines changed: 94 additions & 28 deletions

File tree

.circleci/config.yml

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

.github/workflows/benchmark.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Benchmark
2+
3+
on:
4+
- pull_request
5+
6+
jobs:
7+
benchmark:
8+
strategy:
9+
matrix:
10+
ref:
11+
- master
12+
- ${{ github.sha }}
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Steup Go
18+
uses: actions/setup-go@v2
19+
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
with:
23+
ref: ${{ matrix.ref }}
24+
25+
- name: Run Benchmarks
26+
run: go test -v -run '^$$' -bench '(Marshal|Unmarshal)$$/codeResponse' -benchmem -cpu 1 -count 5 ./json | tee bench.txt
27+
28+
- name: Upload Benchmarks
29+
uses: actions/upload-artifact@v2
30+
with:
31+
name: ${{ matrix.ref }}
32+
path: bench.txt
33+
34+
benchstat:
35+
needs: [benchmark]
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Steup Go
40+
uses: actions/setup-go@v2
41+
with:
42+
go-version: 1.17
43+
44+
- name: Setup Benchstat
45+
run: go install golang.org/x/perf/cmd/benchstat@latest
46+
47+
- name: Download Benchmark Results
48+
uses: actions/download-artifact@v2
49+
with:
50+
path: .
51+
52+
- name: Run Benchstat
53+
run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt
54+
55+
- name: Upload Benchstat Results
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: benchstat
59+
path: benchstat.txt

.github/workflows/go.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test
2+
3+
on:
4+
- pull_request
5+
6+
jobs:
7+
test:
8+
strategy:
9+
matrix:
10+
go:
11+
- 1.14
12+
- 1.15
13+
- 1.16
14+
- 1.17
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Setup Go ${{ matrix.go }}
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
26+
- name: Download Dependencies
27+
run: go mod download
28+
29+
- name: Run Tests
30+
run: make test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# encoding [![Circle CI](https://circleci.com/gh/segmentio/encoding.svg?style=shield&circle-token=9bc6038a8e264684efe602003bb52c26835fc400)](https://circleci.com/gh/segmentio/encoding) [![Go Report Card](https://goreportcard.com/badge/github.com/segmentio/encoding)](https://goreportcard.com/report/github.com/segmentio/encoding) [![GoDoc](https://godoc.org/github.com/segmentio/encoding?status.svg)](https://godoc.org/github.com/segmentio/encoding)
1+
# encoding ![build status](https://github.com/segmentio/encoding/actions/workflows/go.yml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/segmentio/encoding)](https://goreportcard.com/report/github.com/segmentio/encoding) [![GoDoc](https://godoc.org/github.com/segmentio/encoding?status.svg)](https://godoc.org/github.com/segmentio/encoding)
22

33
Go package containing implementations of encoders and decoders for various data
44
formats.

json/reflect.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// +build go1.17
1+
//go:build go1.18
2+
// +build go1.18
23

34
package json
45

json/reflect_optimize.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// +build !go1.17
1+
//go:build !go1.18
2+
// +build !go1.18
23

34
package json
45

0 commit comments

Comments
 (0)