-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
162 additions
and
19 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,38 @@ | ||
name: setup-hathor-env | ||
description: Setup Hathor node environment | ||
inputs: | ||
python: | ||
description: The python version | ||
os: | ||
description: The OS name | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Poetry | ||
shell: bash | ||
run: pipx install poetry | ||
|
||
- name: Set up Python ${{ inputs.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python }} | ||
cache: 'poetry' | ||
|
||
- name: Install Ubuntu dependencies | ||
if: startsWith(inputs.os, 'ubuntu') | ||
run: | | ||
sudo apt-get -qy update | ||
sudo apt-get -qy install graphviz librocksdb-dev libsnappy-dev liblz4-dev | ||
shell: bash | ||
|
||
- name: Install macOS dependencies | ||
if: startsWith(inputs.os, 'macos') | ||
run: | | ||
brew cleanup -q | ||
# brew update -q | ||
brew install -q graphviz rocksdb pkg-config | ||
shell: bash | ||
|
||
- name: Install Poetry dependencies | ||
run: poetry install -n --no-root | ||
shell: bash |
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,34 @@ | ||
# yamllint disable rule:line-length | ||
name: benchmarking | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
benchmark_base_branch: | ||
name: Continuous Benchmarking base branch | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bencherdev/bencher@main | ||
- name: Install hyperfine | ||
run: | | ||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.12.0/hyperfine_1.12.0_amd64.deb | ||
sudo dpkg -i hyperfine_1.12.0_amd64.deb | ||
- uses: ./.github/actions/setup-hathor-env | ||
name: Setup Hathor node environment | ||
with: | ||
python: 3.11 | ||
os: ubuntu-22.04 | ||
- name: Track base branch benchmarks with Bencher | ||
run: | | ||
bencher run \ | ||
--project hathor-core \ | ||
--token '${{ secrets.BENCHER_API_TOKEN }}' \ | ||
--branch master \ | ||
--testbed ubuntu-22.04 \ | ||
--adapter shell_hyperfine \ | ||
--err \ | ||
--file bench_results.json \ | ||
'./extras/benchmarking/benchmark_sync_v2.sh' |
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
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,41 @@ | ||
# yamllint disable rule:line-length | ||
name: benchmarking | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
benchmark_pr_branch: | ||
name: Continuous Benchmarking PRs | ||
# DO NOT REMOVE: For handling Fork PRs see Pull Requests from Forks | ||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bencherdev/bencher@main | ||
- name: Install hyperfine | ||
run: | | ||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.12.0/hyperfine_1.12.0_amd64.deb | ||
sudo dpkg -i hyperfine_1.12.0_amd64.deb | ||
- uses: ./.github/actions/setup-hathor-env | ||
name: Setup Hathor node environment | ||
with: | ||
python: 3.11 | ||
os: ubuntu-22.04 | ||
- name: Track PR Benchmarks with Bencher | ||
run: | | ||
bencher run \ | ||
--project hathor-core \ | ||
--token '${{ secrets.BENCHER_API_TOKEN }}' \ | ||
--branch '${{ github.head_ref }}' \ | ||
--branch-start-point '${{ github.base_ref }}' \ | ||
--branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \ | ||
--testbed ubuntu-22.04 \ | ||
--adapter shell_hyperfine \ | ||
--err \ | ||
--github-actions '${{ secrets.GITHUB_TOKEN }}' \ | ||
--file bench_results.json \ | ||
'./extras/benchmarking/benchmark_sync_v2.sh' |
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,45 @@ | ||
N_BLOCKS=100 | ||
CACHE_SIZE=100000 | ||
TESTNET_DATA_DIR=server-data | ||
TCP_PORT=40403 | ||
AWAIT_INIT_DELAY=10 | ||
N_RUNS=2 | ||
BENCH_FILE=bench_results.json | ||
BENCH_DATA_DIR=bench-data | ||
|
||
BLUE='\033[0;34m' | ||
NO_COLOR='\033[0m' | ||
|
||
echo "${BLUE}Downloading testnet data...${NC}" | ||
mkdir $TESTNET_DATA_DIR | ||
poetry run hathor-cli quick_test --testnet --data $TESTNET_DATA_DIR --quit-after-n-blocks $N_BLOCKS > /dev/null 2>&1 | ||
|
||
echo "${BLUE}Running server node in the background...${NC}" | ||
poetry run hathor-cli run_node \ | ||
--testnet \ | ||
--data $TESTNET_DATA_DIR \ | ||
--cache \ | ||
--cache-size $CACHE_SIZE \ | ||
--x-localhost-only \ | ||
--listen tcp:$TCP_PORT \ | ||
> /dev/null 2>&1 & | ||
|
||
# Await initialization | ||
sleep $AWAIT_INIT_DELAY | ||
|
||
echo "${BLUE}Running benchmark...${NC}" | ||
hyperfine \ | ||
--runs $N_RUNS \ | ||
--export-json $BENCH_FILE \ | ||
--command-name "sync-v2 (up to $N_BLOCKS blocks)" \ | ||
--prepare "rm -rf $BENCH_DATA_DIR && mkdir $BENCH_DATA_DIR" \ | ||
" | ||
poetry run hathor-cli quick_test \ | ||
--testnet \ | ||
--data $BENCH_DATA_DIR \ | ||
--cache \ | ||
--cache-size $CACHE_SIZE \ | ||
--x-localhost-only \ | ||
--bootstrap tcp://localhost:$TCP_PORT \ | ||
--quit-after-n-blocks $N_BLOCKS | ||
" |