-
Notifications
You must be signed in to change notification settings - Fork 21
161 lines (145 loc) · 4.21 KB
/
ci.yaml
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
name: CI
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- run: |
go version
go get
- name: make test
run: |
echo '```' >> $GITHUB_STEP_SUMMARY
make test >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: |
go version
go get
- run: make build
- name: Extract short commit SHA
id: short-sha
run: echo "value=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# Upload some useful binaries for debug
- uses: actions/upload-artifact@v4
with:
name: fingerproxy_darwin_arm64_${{ steps.short-sha.outputs.value }}
path: bin/fingerproxy_darwin_arm64
- uses: actions/upload-artifact@v4
with:
name: fingerproxy_linux_amd64_${{ steps.short-sha.outputs.value }}
path: bin/fingerproxy_linux_amd64
build-echoserver:
name: Build echo server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true
- name: Build
run: |
go version
go get
go build -tags debug ./example/echo-server
./testdata/gencert.sh
- uses: actions/upload-artifact@v4
with:
name: echoserver-ci-only
path: |
echo-server
tls.crt
tls.key
e2e-test:
name: E2E test
runs-on: ubuntu-latest
needs: build-echoserver
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: echoserver-ci-only
- name: Setup curl
run: |
wget https://github.com/stunnel/static-curl/releases/download/8.6.0-1/curl-linux-x86_64-8.6.0.tar.xz
tar xf curl-linux-x86_64-8.6.0.tar.xz
./curl --version
- name: Test
run: |
chmod +x ./echo-server
./echo-server -verbose &
sleep 1
./curl -v --fail --insecure -o o.json https://localhost:8443/json
cat o.json | jq
test $(jq -r '.http2' o.json) = "3:100;4:10485760;2:0|1048510465|0|m,s,a,p"
test $(jq -r '.ja3' o.json) = "0149f47eabf9a20d0893e2a44e5a6323"
test $(jq -r '.ja4' o.json) = "t13d3112h2_e8f1e7e78f70_6bebaf5329ac"
test $(jq -r '."user-agent"' o.json) = "curl/8.6.0"
load-test:
name: Load test
runs-on: ubuntu-latest
needs: build-echoserver
strategy:
matrix:
number_of_requests: [1000, 10000, 50000]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: echoserver-ci-only
- name: Setup ab
run: |
sudo apt-get install -y apache2-utils
ab -V
- name: Test
run: |
chmod +x ./echo-server
./echo-server &
sleep 1
(
cat /proc/$!/status | grep VmRSS
ab -n ${{ matrix.number_of_requests }} -c 10 https://localhost:8443/
cat /proc/$!/status | grep VmRSS
) | tee -a $GITHUB_STEP_SUMMARY
benchmark:
name: Benchmark
runs-on: ubuntu-latest
needs: build-echoserver
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: echoserver-ci-only
- name: Setup wrk
run: |
sudo apt-get install -y wrk
wrk --version || true
- name: Benchmark
run: |
chmod +x ./echo-server
./echo-server &
sleep 1
wrk -d 30 -c 10 https://localhost:8443/ | tee -a $GITHUB_STEP_SUMMARY
kill $!
sleep 1
./echo-server --benchmark-control-group &
sleep 1
wrk -d 30 -c 10 https://localhost:8443/ | tee -a $GITHUB_STEP_SUMMARY