-
Notifications
You must be signed in to change notification settings - Fork 529
111 lines (94 loc) · 3.09 KB
/
tests.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
106
107
108
109
110
111
name: Tests
on: [push, pull_request]
jobs:
compat-test:
strategy:
matrix:
version: ["1.17", "1.18", "1.19"]
runs-on: [self-hosted, X64]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
cache: false # don't use cache for self-hosted runners
# Just build tests without running them
- name: Build Test
run: go test -run=nope ./...
unit-test:
strategy:
matrix:
version: ["1.20", "1.21", "1.22", "1.23"]
runs-on: [self-hosted, X64]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
cache: false # don't use cache for self-hosted runners
- name: Unit Test
run: go test -race -covermode=atomic -coverprofile=coverage.txt ./...
- name: Codecov
run: bash <(curl -s https://codecov.io/bash)
ut-windows:
strategy:
matrix:
version: ["1.20", "1.21", "1.22", "1.23"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
cache: false # don't use cache for self-hosted runners
- name: Unit Test
run: go test -race -covermode=atomic ./...
hz-test-unix:
runs-on: [ self-hosted, X64 ]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false # don't use cache for self-hosted runners
- name: Setup Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
- name: Hz Test
if: contains(steps.changed-files.outputs.all_changed_files, 'cmd/hz')
run: |
cd cmd/hz
sh test_hz_unix.sh
hz-test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
- name: Install Protobuf
shell: pwsh
run: |
Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win64.zip -OutFile protoc-3.19.4-win64.zip
Expand-Archive protoc-3.19.4-win64.zip -DestinationPath protoc-3.19.4-win64
$GOPATH=go env GOPATH
Copy-Item -Path protoc-3.19.4-win64\bin\protoc.exe -Destination $GOPATH\bin
Copy-Item -Path protoc-3.19.4-win64\include\* -Destination cmd\hz\testdata\include\google -Recurse
protoc --version
- name: Hz Test
if: contains(steps.changed-files.outputs.all_changed_files, 'cmd/hz')
run: |
cd cmd/hz
sh test_hz_windows.sh