2021-10-02 15:45:43 +03:00
|
|
|
name: Run Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Setup go
|
2023-12-11 16:37:53 +03:00
|
|
|
uses: actions/setup-go@v5
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
2024-02-14 07:35:16 +03:00
|
|
|
go-version: "^1.16"
|
2021-10-02 15:45:43 +03:00
|
|
|
- name: Checkout repository
|
2023-12-11 16:37:53 +03:00
|
|
|
uses: actions/checkout@v4
|
2021-10-02 15:45:43 +03:00
|
|
|
- name: Setup golangci-lint
|
2024-05-13 23:37:45 +03:00
|
|
|
uses: golangci/golangci-lint-action@v6
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
|
|
|
args: --verbose
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-23 12:06:39 +03:00
|
|
|
os: [ubuntu-latest]
|
2024-02-14 07:35:50 +03:00
|
|
|
go: [1.18, 1.19, "1.20", 1.21, 1.22]
|
2021-10-02 15:45:43 +03:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
go-build: ~/.cache/go-build
|
|
|
|
- os: macos-latest
|
|
|
|
go-build: ~/Library/Caches/go-build
|
|
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
GOPROXY: https://proxy.golang.org
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
2023-12-11 16:37:53 +03:00
|
|
|
uses: actions/setup-go@v5
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Checkout Code
|
2023-12-11 16:37:53 +03:00
|
|
|
uses: actions/checkout@v4
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
2024-02-14 07:35:16 +03:00
|
|
|
- uses: actions/cache@v4
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ matrix.go-build }}
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
|
|
|
go test -v -covermode=atomic -coverprofile=coverage.out
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2024-02-14 07:35:16 +03:00
|
|
|
uses: codecov/codecov-action@v4
|
2021-10-02 15:45:43 +03:00
|
|
|
with:
|
|
|
|
flags: ${{ matrix.os }},go-${{ matrix.go }}
|