2022-11-20 06:17:50 +03:00
|
|
|
name: Run tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- dev
|
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2023-06-29 10:16:32 +03:00
|
|
|
- '.github/FUNDING.yml'
|
|
|
|
- '.github/release-drafter.yml'
|
|
|
|
- '.github/ISSUE_TEMPLATE/*'
|
|
|
|
- '.github/workflows/release-drafter.yaml'
|
|
|
|
- 'examples/*'
|
2022-11-20 06:17:50 +03:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2023-05-21 11:04:11 +03:00
|
|
|
- dev
|
2022-11-20 06:17:50 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2023-06-29 10:16:32 +03:00
|
|
|
- '.github/FUNDING.yml'
|
|
|
|
- '.github/release-drafter.yml'
|
|
|
|
- '.github/ISSUE_TEMPLATE/*'
|
|
|
|
- '.github/workflows/release-drafter.yaml'
|
|
|
|
- 'examples/*'
|
2022-11-20 06:17:50 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
GOPROXY: "https://proxy.golang.org"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
name: Run golangci-lint
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: '^1.16'
|
|
|
|
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup and run golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
|
|
|
with:
|
2023-03-08 19:51:06 +03:00
|
|
|
version: v1.51.2
|
2022-12-11 14:40:00 +03:00
|
|
|
args: --timeout 5m -v -E gofumpt -E gocritic -E misspell -E revive -E godot
|
2022-11-20 06:17:50 +03:00
|
|
|
test:
|
|
|
|
needs: lint
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-12-10 17:25:16 +03:00
|
|
|
go: [1.13, 1.19]
|
2022-11-20 06:17:50 +03:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
name: Go ${{ matrix.go }} @ ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os}}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-05-11 05:05:22 +03:00
|
|
|
go-version: ${{ matrix.go }}
|
2022-11-20 06:17:50 +03:00
|
|
|
|
|
|
|
- name: Print Go environment
|
|
|
|
id: go-env
|
|
|
|
run: |
|
|
|
|
printf "Using go at: $(which go)\n"
|
|
|
|
printf "Go version: $(go version)\n"
|
|
|
|
printf "\n\nGo environment:\n\n"
|
|
|
|
go env
|
|
|
|
printf "\n\nSystem environment:\n\n"
|
|
|
|
env
|
|
|
|
# Calculate the short SHA1 hash of the git commit
|
|
|
|
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
echo "GO_CACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Cache go modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.go-env.outputs.GO_CACHE }}
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go }}-go-ci
|
|
|
|
|
|
|
|
- name: Run unit tests
|
|
|
|
run: go test -v -race -coverprofile="codecov.report" -covermode=atomic
|
|
|
|
|
|
|
|
- name: Upload code coverage report to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
file: ./codecov.report
|
|
|
|
flags: unittests
|
|
|
|
name: codecov-ants
|
|
|
|
fail_ci_if_error: true
|
|
|
|
verbose: true
|
|
|
|
|