2020-11-26 17:11:11 +03:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags-ignore:
|
|
|
|
- '*.*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
|
|
|
|
jobs:
|
2021-02-09 14:57:14 +03:00
|
|
|
golangci:
|
|
|
|
name: lint
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
2023-01-09 15:57:53 +03:00
|
|
|
- name: Set up stable Go version
|
2023-01-09 16:02:52 +03:00
|
|
|
uses: actions/setup-go@v3
|
2022-04-12 17:11:52 +03:00
|
|
|
with:
|
2024-04-17 11:52:03 +03:00
|
|
|
go-version: '1.22'
|
2022-04-12 17:11:52 +03:00
|
|
|
- name: Get dependencies
|
|
|
|
run: go mod tidy
|
2021-02-09 14:57:14 +03:00
|
|
|
- name: Lint code with golangci-lint
|
2022-04-12 17:11:52 +03:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2021-02-09 14:57:14 +03:00
|
|
|
with:
|
2024-04-17 11:52:03 +03:00
|
|
|
version: v1.55.2
|
2021-02-09 14:57:14 +03:00
|
|
|
only-new-issues: true
|
2020-11-26 17:11:11 +03:00
|
|
|
tests:
|
|
|
|
name: Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-04-17 11:52:03 +03:00
|
|
|
go-version: ['1.18', '1.19', '1.20', '1.21', '1.22', 'stable']
|
2020-11-26 17:11:11 +03:00
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ matrix.go-version }}
|
2023-01-09 15:55:27 +03:00
|
|
|
uses: actions/setup-go@v3
|
2020-11-26 17:11:11 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get dependencies
|
|
|
|
run: go mod tidy
|
|
|
|
- name: Tests
|
2024-04-17 12:10:53 +03:00
|
|
|
run: go test ./... -v -cpu 2 -timeout 30s -race -cover -coverprofile=coverage.txt -covermode=atomic
|
2020-11-26 17:11:11 +03:00
|
|
|
- name: Coverage
|
|
|
|
run: |
|
2022-04-22 09:37:16 +03:00
|
|
|
go install github.com/axw/gocov/gocov@latest
|
2020-11-26 17:11:11 +03:00
|
|
|
gocov convert ./coverage.txt | gocov report
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|