Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci/cd): add running gossip + benchmarks #161

Merged
merged 17 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: check

on:
push:
branches: [main, pre-release]
pull_request:
branches: [main, pre-release]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.12.0

- name: lint
run: |
zig fmt --check src/
zig fmt --check build.zig

unused_imports:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: remove unused imports
run: python remove_unused.py src/

test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: setup-zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.12.0

- name: test
run: zig build test

benchmarks:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: setup-zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.12.0

- name: benchmarks
run: zig build -Doptimize=ReleaseSafe benchmark

gossip:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- name: checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: setup-zig
uses: goto-bus-stop/setup-zig@v1
with:
version: 0.12.0

- name: build release
run: zig build -Doptimize=ReleaseSafe
- name: run gossip
run: bash scripts/gossip_test.sh 120 # in seconds
79 changes: 0 additions & 79 deletions .github/workflows/test.yml

This file was deleted.

33 changes: 33 additions & 0 deletions scripts/gossip_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
usage() {
echo "Usage: $0 <duration_in_seconds>"
exit 1
}

# Check if an argument is provided
if [ -z "$1" ]; then
echo "Error: No duration provided."
usage
fi

# Check if the argument is a valid number
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
echo "Error: Duration must be a positive integer."
usage
fi

echo "Running gossip test for $1 seconds"

# build and run gossip
./zig-out/bin/sig gossip \
-e entrypoint.testnet.solana.com:8001 \
-e entrypoint2.testnet.solana.com:8001 2>&1 &

# Get the process ID of the last background command
PID=$!

# Sleep for N seconds
sleep $1

# Kill the process
kill $PID
Loading
Loading