2020-01-29 05:24:22 +02:00
|
|
|
name: Run Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 11:19:05 +02:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 07:06:31 +02:00
|
|
|
- 'codecov.yml'
|
2020-01-29 05:24:22 +02:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 11:19:05 +02:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 07:06:31 +02:00
|
|
|
- 'codecov.yml'
|
2022-04-29 20:57:14 +02:00
|
|
|
workflow_dispatch:
|
2020-01-29 05:24:22 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2021-04-16 11:38:12 +02:00
|
|
|
# Each major Go release is supported until there are two newer major releases. https://golang.org/doc/devel/release.html#policy
|
2022-11-04 11:32:53 +02:00
|
|
|
# Echo tests with last four major releases (unless there are pressing vulnerabilities)
|
|
|
|
# As we depend on `golang.org/x/` libraries which only support last 2 Go releases we could have situations when
|
|
|
|
# we derive from last four major releases promise.
|
|
|
|
go: [1.17, 1.18, 1.19]
|
2020-01-29 05:24:22 +02:00
|
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
2022-04-29 20:57:14 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-01-29 05:24:22 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
2022-04-29 20:57:14 +02:00
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2020-01-29 05:24:22 +02:00
|
|
|
- name: Install Dependencies
|
2022-04-29 20:57:14 +02:00
|
|
|
run: go install golang.org/x/lint/golint@latest
|
2020-01-29 05:24:22 +02:00
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
|
|
|
golint -set_exit_status ./...
|
|
|
|
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2022-08-06 22:29:21 +02:00
|
|
|
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
|
|
|
|
uses: codecov/codecov-action@v3
|
2020-01-29 05:24:22 +02:00
|
|
|
with:
|
|
|
|
token:
|
|
|
|
fail_ci_if_error: false
|
2020-11-23 07:11:17 +02:00
|
|
|
benchmark:
|
|
|
|
needs: test
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2022-08-06 22:29:21 +02:00
|
|
|
go: [1.19]
|
2020-11-23 07:11:17 +02:00
|
|
|
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code (Previous)
|
2022-04-29 20:57:14 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-11-23 07:11:17 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.base_ref }}
|
|
|
|
path: previous
|
|
|
|
|
|
|
|
- name: Checkout Code (New)
|
2022-04-29 20:57:14 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-11-23 07:11:17 +02:00
|
|
|
with:
|
|
|
|
path: new
|
|
|
|
|
2022-04-29 20:57:14 +02:00
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2020-11-23 07:11:17 +02:00
|
|
|
- name: Install Dependencies
|
2022-04-29 20:57:14 +02:00
|
|
|
run: go install golang.org/x/perf/cmd/benchstat@latest
|
2020-11-23 07:11:17 +02:00
|
|
|
|
|
|
|
- name: Run Benchmark (Previous)
|
|
|
|
run: |
|
|
|
|
cd previous
|
2020-12-01 06:39:06 +02:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 07:11:17 +02:00
|
|
|
|
|
|
|
- name: Run Benchmark (New)
|
|
|
|
run: |
|
|
|
|
cd new
|
2020-12-01 06:39:06 +02:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 07:11:17 +02:00
|
|
|
|
|
|
|
- name: Run Benchstat
|
|
|
|
run: |
|
|
|
|
benchstat previous/benchmark.txt new/benchmark.txt
|