Skip to content

Commit

Permalink
Merge pull request #161 from Syndica/19/cicd-gossip
Browse files Browse the repository at this point in the history
feat(ci/cd): add running gossip + benchmarks
  • Loading branch information
0xNineteen authored Jun 10, 2024
2 parents 9132247 + 75126c2 commit 8d556c3
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 169 deletions.
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

0 comments on commit 8d556c3

Please sign in to comment.