Add CI load test. #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: echo-server | |
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: echo-server | |
- 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, 100000] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: echo-server | |
- 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 $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: echo-server | |
- 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 $GITHUB_STEP_SUMMARY | |
kill $! | |
sleep 1 | |
./echo-server --benchmark-control-group & | |
sleep 1 | |
wrk -d 30 -c 10 https://localhost:8443/ | tee $GITHUB_STEP_SUMMARY | |
kill $ECHOSERVER_PID |