mirror of
https://github.com/labstack/echo.git
synced 2024-12-18 16:20:53 +02:00
100 lines
2.5 KiB
YAML
100 lines
2.5 KiB
YAML
name: Run Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '**.go'
|
|
- 'go.*'
|
|
- '_fixture/**'
|
|
- '.github/**'
|
|
- 'codecov.yml'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '**.go'
|
|
- 'go.*'
|
|
- '_fixture/**'
|
|
- '.github/**'
|
|
- 'codecov.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
# Each major Go release is supported until there are two newer major releases. https://golang.org/doc/devel/release.html#policy
|
|
# Echo tests with last four major releases
|
|
go: [1.16, 1.17, 1.18, 1.19]
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Install Dependencies
|
|
run: go install golang.org/x/lint/golint@latest
|
|
|
|
- name: Run Tests
|
|
run: |
|
|
golint -set_exit_status ./...
|
|
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
token:
|
|
fail_ci_if_error: false
|
|
benchmark:
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
go: [1.19]
|
|
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout Code (Previous)
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.base_ref }}
|
|
path: previous
|
|
|
|
- name: Checkout Code (New)
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: new
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Install Dependencies
|
|
run: go install golang.org/x/perf/cmd/benchstat@latest
|
|
|
|
- name: Run Benchmark (Previous)
|
|
run: |
|
|
cd previous
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
|
|
|
- name: Run Benchmark (New)
|
|
run: |
|
|
cd new
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
|
|
|
- name: Run Benchstat
|
|
run: |
|
|
benchstat previous/benchmark.txt new/benchmark.txt
|