name: go test
on:
  push:
    tags:
      - v*
    branches:
      - master
  pull_request:
jobs:
  test:
    strategy:
      matrix:
        go-version: [1.13.x, 1.14.x]
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Install Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go-version }}
    - name: Test
      run: go test -v -cover ./...

  benchmark:
    runs-on: ubuntu-latest
    steps:
    - name: Install Go
      uses: actions/setup-go@v2
      with:
        go-version: 1.14.x
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Benchmark
      run: cd benchmark && go test -bench=. -test.benchmem
