-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from Syndica/19/cicd-gossip
feat(ci/cd): add running gossip + benchmarks
- Loading branch information
Showing
8 changed files
with
242 additions
and
169 deletions.
There are no files selected for viewing
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
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 |
This file was deleted.
Oops, something went wrong.
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
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 |
Oops, something went wrong.