sozu/.github/workflows/benchmark.yml

217 lines
6.2 KiB
YAML

---
name: Benchmark
on: [ push, pull_request ]
env:
CARGO_TERM_COLOR: always
jobs:
build-bombardier:
name: Build Bombardier 💣️
runs-on: ubuntu-latest
steps:
- name: Clone bombardier
uses: actions/checkout@v4
with:
repository: codesenberg/bombardier
path: .
- uses: actions/setup-go@v5
with:
go-version: '1.18'
check-latest: false
- name: Build bombardier
run: go build -o bombardier
- name: 📤 Upload bombardier
uses: actions/upload-artifact@v4
with:
name: bombardier
path: bombardier
build-lagging_server:
name: Build Lagging_Server ⚡️
runs-on: ubuntu-latest
steps:
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Clone lagging_server
uses: actions/checkout@v4
with:
repository: CleverCloud/lagging_server
path: .
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
prefix-key: "lagging_server"
- name: Build lagging_server
run: cargo build --release
- name: 📤 Upload lagging_server
uses: actions/upload-artifact@v4
with:
name: lagging_server
path: target/release/lagging_server
build-sozu:
name: Build Sozu 🦀
runs-on: ubuntu-latest
steps:
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
prefix-key: "sozu"
- name: Build Sozu
run: cargo build --release
- name: 📤 Upload sozu
uses: actions/upload-artifact@v4
with:
name: sozu
path: target/release/sozu
build-bench-logger:
name: Build bench_logger 🦀
runs-on: ubuntu-latest
steps:
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
prefix-key: "sozu"
- name: Build Sozu bench logger (for benchmarking)
run: cargo build --release --example bench_logger
- name: 📤 Upload sozu bench logger
uses: actions/upload-artifact@v4
with:
name: bench_logger
path: target/release/examples/bench_logger
bench:
name: Benchmark 🎯
runs-on: ubuntu-latest
needs: [build-bombardier, build-lagging_server, build-sozu]
steps:
- uses: actions/checkout@v4
- name: 📥 Download bombardier
uses: actions/download-artifact@v4
with:
name: bombardier
path: .github/workflows
- name: 📥 Download lagging_server
uses: actions/download-artifact@v4
with:
name: lagging_server
path: .github/workflows
- name: 📥 Download sozu
uses: actions/download-artifact@v4
with:
name: sozu
path: .github/workflows
- name: Host mapping sozu.io domains
run: |
sudo echo "0.0.0.0 sozu.io" | sudo tee -a /etc/hosts
sudo echo "0.0.0.0 rsa-2048.sozu.io" | sudo tee -a /etc/hosts
sudo echo "0.0.0.0 rsa-4096.sozu.io" | sudo tee -a /etc/hosts
sudo echo "0.0.0.0 ecdsa.sozu.io" | sudo tee -a /etc/hosts
- name: Generate TLS key rsa 2048
working-directory: .github/workflows
run: |
openssl req -newkey rsa:2048 -nodes -keyout rsa-2048.key -out rsa-2048.csr -config rsa-2048.cnf
openssl x509 -req -days 365 -in rsa-2048.csr -signkey rsa-2048.key -out rsa-2048.pem -extensions req_ext -extfile rsa-2048.cnf
sudo cp rsa-2048.pem /usr/local/share/ca-certificates/rsa-2048.crt
sudo update-ca-certificates
- name: Generate TLS key rsa 4096
working-directory: .github/workflows
run: |
openssl req -newkey rsa:4096 -nodes -keyout rsa-4096.key -out rsa-4096.csr -config rsa-4096.cnf
openssl x509 -req -days 365 -in rsa-4096.csr -signkey rsa-4096.key -out rsa-4096.pem -extensions req_ext -extfile rsa-4096.cnf
sudo cp rsa-4096.pem /usr/local/share/ca-certificates/rsa-4096.crt
sudo update-ca-certificates
- name: Generate TLS key ecdsa
working-directory: .github/workflows
run: |
openssl ecparam -name prime256v1 -genkey -out ecdsa.key
openssl req -new -key ecdsa.key -out ecdsa.csr -config ecdsa.cnf
openssl x509 -req -days 365 -in ecdsa.csr -signkey ecdsa.key -out ecdsa.pem -extensions req_ext -extfile ecdsa.cnf
sudo cp ecdsa.pem /usr/local/share/ca-certificates/ecdsa.crt
sudo update-ca-certificates
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Fix rights
working-directory: .github/workflows
run: |
chmod +x bombardier
chmod +x lagging_server
chmod +x sozu
- name: ⚡ Launch bench
working-directory: .github/workflows
run: python bench.py
bench-logs:
name: benchmark the logger
runs-on: ubuntu-latest
needs: [build-sozu, build-bench-logger]
steps:
- uses: actions/checkout@v4
- name: 📥 Download sozu
uses: actions/download-artifact@v4
with:
name: sozu
path: .github/workflows
- name: 📥 Download sozu bench logger
uses: actions/download-artifact@v4
with:
name: bench_logger
path: .github/workflows
- name: Fix rights
working-directory: .github/workflows
run: |
chmod +x sozu
chmod +x bench_logger
- name: Bench the logs
working-directory: .github/workflows
run: python bench_logs.py