-
-
Notifications
You must be signed in to change notification settings - Fork 64
210 lines (205 loc) · 6.21 KB
/
test.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Test
on:
push:
branches:
- master
pull_request:
jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip tests]')"
strategy:
matrix:
go-version: [1.20.x]
runs-on: ubuntu-20.04
env:
GO111MODULE: on
GOFLAGS: "-mod=vendor"
COVERAGE: "true"
REDIS_URL: "redis://localhost:6379/2"
services:
redis:
image: redis:7.0-alpine
ports: ["6379:6379"]
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30
steps:
- uses: actions/checkout@v3
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install bison
- uses: actions/cache@v1
with:
path: vendor
key: vendor-${{ hashFiles('**/go.sum') }}
restore-keys: |
vendor-
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: make test
- name: Report coverage
uses: coverallsapp/github-action@v2
with:
file: coverage.out
parallel: true
flag-name: ${{ matrix.go-version }}-ubuntu
- name: Build
if: matrix['go-version'] == '1.20.x'
run: |
make build
- name: Upload linux build
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
uses: actions/upload-artifact@v1
with:
name: anycable-go-Linux-x86_64
path: dist/anycable-go
test-macos:
if: "!contains(github.event.head_commit.message, '[ci skip tests]')"
strategy:
matrix:
go-version: [1.20.x]
runs-on: macos-11
env:
GO111MODULE: on
GOFLAGS: "-mod=vendor"
COVERAGE: "true"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Install system deps
run: |
brew install bison
- uses: actions/cache@v3
with:
path: vendor
key: vendor-${{ hashFiles('**/go.sum') }}
restore-keys: |
vendor-
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- name: Run tests
run: make test
- name: Report coverage
uses: coverallsapp/github-action@v2
with:
file: coverage.out
parallel: true
flag-name: ${{ matrix.go-version }}-macos
- name: Build
if: matrix['go-version'] == '1.20.x'
run: |
make build
- name: Upload MacOS build
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
uses: actions/upload-artifact@v1
with:
name: anycable-go-Darwin-x86_64
path: dist/anycable-go
test-conformance:
if: "!contains(github.event.head_commit.message, '[ci skip tests]')"
needs: [test, test-macos]
strategy:
matrix:
test_command:
- benchmarks
- test-features
- test-conformance
- test-conformance-http
- test-conformance-nats
- test-conformance-nats-embedded
- test-conformance-ssl
- test-conformance-broker-http
- test-conformance-broker-redis
- test-conformance-broker-nats
runs-on: ubuntu-latest
env:
GO111MODULE: on
GOFLAGS: "-mod=vendor"
BUILD_ARGS: "-race"
GORACE: "halt_on_error=1"
COVERAGE: "true"
GOCOVERDIR: "_icoverdir_"
BUNDLE_GEMFILE: .circleci/Gemfile
BUNDLE_PATH: ./vendor/bundle
# Specify REDIS_URL explicitly, so Makefile doesn't check the presence of Redis
REDIS_URL: redis://localhost:6379/
ANYCABLE_DISABLE_TELEMETRY: "true"
services:
redis:
image: redis:6.2-alpine
ports: ["6379:6379"]
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30
nats:
image: nats:alpine
ports: ["4222:4222"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.20.x
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install bison
- uses: ruby/setup-ruby@v1
with:
# Use <3.0 since go-mruby's Rakefile has some problems with keyword arguments compatibility
ruby-version: 2.7
bundler-cache: true
- uses: actions/cache@v3
with:
path: vendor
key: vendor-${{ hashFiles('**/go.sum') }}
restore-keys: |
vendor-
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- name: Install websocket-bench & gops
if: matrix.test_command == 'benchmarks'
env:
GO111MODULE: off
run: |
go get -u github.com/anycable/websocket-bench
go get -u github.com/google/gops
- name: Run tests
run: |
bundle install
mkdir _icoverdir_
make ${{ matrix.test_command }}
- name: Format coverage
continue-on-error: true
run: |
go tool covdata textfmt -i _icoverdir_ -o coverage.out
- name: Check if has coverage?
id: coverage
run: |
if [ -s coverage.out ]; then
echo "coverage found"
echo "COVERAGE=yes" >> $GITHUB_OUTPUT
else
echo "no coverage found"
echo "COVERAGE=no" >> $GITHUB_OUTPUT
fi
- name: Report coverage
if: steps.coverage.outputs.COVERAGE == 'yes'
uses: coverallsapp/github-action@v2
with:
file: coverage.out
parallel: true
format: golang
flag-name: integration-${{ matrix.test_command }}
coverage:
runs-on: ubuntu-latest
needs: [test, test-macos, test-conformance]
steps:
- uses: coverallsapp/github-action@v2
with:
parallel-finished: true