name: Benchmarks on: workflow_dispatch: inputs: min_runs: description: "Minimum benchmark runs" required: false default: "30" quick: description: "Quick mode (fewer runs)" required: false default: "false" type: boolean jobs: benchmark-linux: name: Benchmark (Linux) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Set up Node uses: actions/setup-node@v4 with: node-version: "20" - name: Download dependencies run: go mod download - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y \ bubblewrap \ socat \ uidmap \ curl \ netcat-openbsd \ ripgrep \ hyperfine \ jq \ bc # Configure subuid/subgid echo "$(whoami):100000:65536" | sudo tee -a /etc/subuid echo "$(whoami):100000:65536" | sudo tee -a /etc/subgid sudo chmod u+s $(which bwrap) - name: Install benchstat run: go install golang.org/x/perf/cmd/benchstat@latest - name: Build greywall run: make build-ci - name: Run Go microbenchmarks run: | mkdir -p benchmarks go test -run=^$ -bench=. -benchmem -count=10 ./internal/sandbox/... | tee benchmarks/go-bench-linux.txt - name: Run CLI benchmarks run: | MIN_RUNS="${{ github.event.inputs.min_runs || '30' }}" QUICK="${{ github.event.inputs.quick || 'false' }}" if [[ "$QUICK" == "true" ]]; then ./scripts/benchmark.sh -q -o benchmarks else ./scripts/benchmark.sh -n "$MIN_RUNS" -o benchmarks fi - name: Upload benchmark results uses: actions/upload-artifact@v4 with: name: benchmark-results-linux path: benchmarks/ retention-days: 30 - name: Display results run: | echo "=== Linux Benchmark Results ===" echo "" for f in benchmarks/*.md; do [[ -f "$f" ]] && cat "$f" done echo "" echo "=== Go Microbenchmarks ===" grep -E '^Benchmark|^ok|^PASS' benchmarks/go-bench-linux.txt | head -50 || true