151 lines (147 loc) · 3.82 KB
/
pr.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
name: CI
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
# Check if there any dirty change for go mod tidy
go-mod:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Checkout code
uses: actions/checkout@v2
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: lint
uses: golangci/golangci-lint-action@v2.5.1
with:
version: latest
args: --timeout 5m
skip-go-installation: true
tests-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Run tests
run: go test --timeout 5m ./...
continue-on-error: true
tests-on-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Run tests
run: make test
tests-on-unix:
runs-on: ubuntu-latest
strategy:
matrix:
golang:
- 1.16
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.golang }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.golang }}-
- name: Run tests
run: make test
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
golang:
- 1.16
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.golang }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.golang }}-
- name: Get mtg proxy
env:
GO111MODULES: on
run: go get github.com/gotd/mtg@master && go mod tidy
- name: Run tests
env:
GOTD_TEST_EXTERNAL: 1
GOTD_MTPROXY_ADDR: "localhost:3128"
# Run all tests that starts with "TestExternalE2E".
run: go test -v -run ^TestExternalE2E ./...
coverage:
runs-on: ubuntu-latest
strategy:
matrix:
golang:
- 1.16
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Unshallow
run: git fetch --prune --unshallow
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.golang }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: coverage-${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
coverage-${{ runner.os }}-go-${{ matrix.golang }}-
- name: Run tests with coverage
run: make coverage
- name: Send coverage
uses: codecov/codecov-action@v1
with:
file: profile.out
check-generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Check that go generate does not make changes
run: make check_generated