This repository was archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 2.32 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: "Go Verify Build"
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
workflow_dispatch:
env:
GO_VER: 1.21.8
GO_VER_OLD: 1.18.7
GINKGO_VER: 2.13.2
jobs:
check-cyrillic-comments:
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- name: check cyrillic comments
run: |
grep --exclude-dir=".github" --exclude-dir=".git" -I -r --color -n -E "[А-Яа-яЁё]+" . && exit 1 || exit 0
validate-go:
needs:
- check-cyrillic-comments
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
- name: check go.mod
run: |
go mod tidy
git diff --exit-code go.mod
- name: go fmt
run: |
go fmt ./...
git diff --exit-code
golangci-lint:
needs:
- validate-go
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57
args: --out-format=colored-line-number
skip-cache: true
go-test-unit:
needs:
- golangci-lint
strategy:
fail-fast: false
matrix:
go-version:
- '1.21.8'
- '1.18.7'
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: unit test
run: |
go test -count 1 ./...
go-test-coverage:
needs:
- golangci-lint
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VER }}
- name: generate test coverage
run: |
go test ./... -coverprofile=./coverage.out
# https://github.com/vladopajic/go-test-coverage
- uses: vladopajic/go-test-coverage@v2.10.0
with:
config: ./.testcoverage.yml
profile: coverage.out
local-prefix: github.com/${{ github.repository }}