2020-01-29 08:54:22 +05:30
|
|
|
name: Run Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 10:19:05 +01:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 05:06:31 +00:00
|
|
|
- 'codecov.yml'
|
2020-01-29 08:54:22 +05:30
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 10:19:05 +01:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 05:06:31 +00:00
|
|
|
- 'codecov.yml'
|
2022-04-29 21:57:14 +03:00
|
|
|
workflow_dispatch:
|
2020-01-29 08:54:22 +05:30
|
|
|
|
2022-12-08 19:37:15 +02:00
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
|
2020-01-29 08:54:22 +05:30
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2021-04-16 12:38:12 +03: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 08:54:22 +05:30
|
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
2022-04-29 21:57:14 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-01-29 08:54:22 +05:30
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
2022-04-29 21:57:14 +03:00
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2020-01-29 08:54:22 +05:30
|
|
|
- name: Run Tests
|
2022-11-21 16:05:30 +02:00
|
|
|
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
|
|
|
|
|
|
|
- name: Install dependencies for checks
|
2020-01-29 08:54:22 +05:30
|
|
|
run: |
|
2022-11-21 16:05:30 +02:00
|
|
|
go install golang.org/x/lint/golint@latest
|
|
|
|
go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
|
|
|
|
- name: Run golint
|
|
|
|
run: golint -set_exit_status ./...
|
|
|
|
|
|
|
|
- name: Run staticcheck
|
|
|
|
run: staticcheck ./...
|
2020-01-29 08:54:22 +05:30
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2022-08-06 23:29:21 +03:00
|
|
|
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
|
|
|
|
uses: codecov/codecov-action@v3
|
2020-01-29 08:54:22 +05:30
|
|
|
with:
|
|
|
|
token:
|
|
|
|
fail_ci_if_error: false
|
2020-11-23 05:11:17 +00:00
|
|
|
benchmark:
|
|
|
|
needs: test
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2022-08-06 23:29:21 +03:00
|
|
|
go: [1.19]
|
2020-11-23 05:11:17 +00:00
|
|
|
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code (Previous)
|
2022-04-29 21:57:14 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-11-23 05:11:17 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.base_ref }}
|
|
|
|
path: previous
|
|
|
|
|
|
|
|
- name: Checkout Code (New)
|
2022-04-29 21:57:14 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-11-23 05:11:17 +00:00
|
|
|
with:
|
|
|
|
path: new
|
|
|
|
|
2022-04-29 21:57:14 +03:00
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2020-11-23 05:11:17 +00:00
|
|
|
- name: Install Dependencies
|
2022-04-29 21:57:14 +03:00
|
|
|
run: go install golang.org/x/perf/cmd/benchstat@latest
|
2020-11-23 05:11:17 +00:00
|
|
|
|
|
|
|
- name: Run Benchmark (Previous)
|
|
|
|
run: |
|
|
|
|
cd previous
|
2020-12-01 04:39:06 +00:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 05:11:17 +00:00
|
|
|
|
|
|
|
- name: Run Benchmark (New)
|
|
|
|
run: |
|
|
|
|
cd new
|
2020-12-01 04:39:06 +00:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 05:11:17 +00:00
|
|
|
|
|
|
|
- name: Run Benchstat
|
|
|
|
run: |
|
|
|
|
benchstat previous/benchmark.txt new/benchmark.txt
|