2020-04-26 06:11:35 +03:00
|
|
|
name: Go
|
2021-09-02 11:28:09 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
2020-04-26 06:11:35 +03:00
|
|
|
jobs:
|
2021-03-11 17:43:21 +03:00
|
|
|
build:
|
|
|
|
name: Build on limited environment
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: build
|
|
|
|
run: docker-compose run go-json
|
2020-12-30 12:06:43 +03:00
|
|
|
test:
|
2020-04-26 06:11:35 +03:00
|
|
|
name: Test
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-01-10 23:16:37 +03:00
|
|
|
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
|
2021-09-02 11:28:09 +03:00
|
|
|
go-version: [ "1.15", "1.16", "1.17" ]
|
2020-04-26 06:11:35 +03:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2020-12-30 13:32:38 +03:00
|
|
|
- name: setup Go ${{ matrix.go-version }}
|
2020-10-06 19:49:58 +03:00
|
|
|
uses: actions/setup-go@v2
|
2020-04-26 06:11:35 +03:00
|
|
|
with:
|
2020-10-06 19:53:58 +03:00
|
|
|
go-version: ${{ matrix.go-version }}
|
2020-12-30 13:32:38 +03:00
|
|
|
- name: checkout
|
2020-04-26 06:11:35 +03:00
|
|
|
uses: actions/checkout@v2
|
2020-12-30 13:32:38 +03:00
|
|
|
- name: simple test
|
2021-06-06 12:44:10 +03:00
|
|
|
run: go test -v ./... -count=1
|
2020-12-30 13:32:38 +03:00
|
|
|
- name: test with GC pressure
|
2021-06-06 12:44:10 +03:00
|
|
|
run: go test -v ./... -count=1
|
2020-12-30 13:32:38 +03:00
|
|
|
env:
|
|
|
|
GOGC: 1
|
|
|
|
- name: test with race detector
|
2021-06-06 12:44:10 +03:00
|
|
|
run: go test -v -race ./... -count=1
|
2021-05-03 10:25:44 +03:00
|
|
|
bench:
|
|
|
|
name: Benchmark
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: setup Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-02 11:28:09 +03:00
|
|
|
go-version: 1.17
|
2021-05-09 07:47:38 +03:00
|
|
|
- name: checkout ( feature )
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: run benchmark ( feature )
|
|
|
|
run: cd benchmarks && go test -bench GoJson | tee $HOME/new.txt
|
2021-09-02 11:28:09 +03:00
|
|
|
- name: install benchstat
|
|
|
|
run: go install golang.org/x/perf/cmd/benchstat@latest
|
2021-05-09 07:47:38 +03:00
|
|
|
- name: checkout ( master )
|
2021-05-03 10:25:44 +03:00
|
|
|
uses: actions/checkout@v2
|
2021-05-09 07:47:38 +03:00
|
|
|
with:
|
|
|
|
ref: master
|
|
|
|
- name: run benchmark ( master )
|
|
|
|
run: cd benchmarks && go test -bench GoJson | tee $HOME/old.txt
|
|
|
|
- name: compare benchmark results
|
2021-09-02 11:28:09 +03:00
|
|
|
run: benchstat $HOME/old.txt $HOME/new.txt
|
2020-12-30 12:06:43 +03:00
|
|
|
coverage:
|
|
|
|
name: Coverage
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: setup Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-02 11:28:09 +03:00
|
|
|
go-version: 1.17
|
2020-12-30 12:06:43 +03:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: measure coverage
|
2021-03-18 11:51:23 +03:00
|
|
|
run: make cover
|
2020-12-30 12:06:43 +03:00
|
|
|
- name: report coverage
|
|
|
|
run: |
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|