mirror of https://github.com/goccy/go-json.git
75 lines
2.0 KiB
YAML
75 lines
2.0 KiB
YAML
name: Go
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
jobs:
|
|
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
|
|
test:
|
|
name: Test
|
|
strategy:
|
|
matrix:
|
|
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
|
|
go-version: [ "1.15", "1.16", "1.17" ]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: setup Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: simple test
|
|
run: go test -v ./... -count=1
|
|
- name: test with GC pressure
|
|
run: go test -v ./... -count=1
|
|
env:
|
|
GOGC: 1
|
|
- name: test with race detector
|
|
run: go test -v -race ./... -count=1
|
|
bench:
|
|
name: Benchmark
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: setup Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
- name: checkout ( feature )
|
|
uses: actions/checkout@v2
|
|
- name: run benchmark ( feature )
|
|
run: cd benchmarks && go test -bench GoJson | tee $HOME/new.txt
|
|
- name: install benchstat
|
|
run: go install golang.org/x/perf/cmd/benchstat@latest
|
|
- name: checkout ( master )
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: master
|
|
- name: run benchmark ( master )
|
|
run: cd benchmarks && go test -bench GoJson | tee $HOME/old.txt
|
|
- name: compare benchmark results
|
|
run: benchstat $HOME/old.txt $HOME/new.txt
|
|
coverage:
|
|
name: Coverage
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: setup Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: measure coverage
|
|
run: make cover
|
|
- name: report coverage
|
|
run: |
|
|
bash <(curl -s https://codecov.io/bash)
|