Skip to content
Draft
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
121 changes: 121 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CI
on:
pull_request:
branches:
- master
jobs:
build-binaries:
runs-on: [self-hosted, linux, x64]
env:
NIX_PATH: nixpkgs=channel:nixos-unstable
BASE_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fetch base commit
run: |
echo "CHECKOUT_COMMIT=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
- name: Setup ccache
run: |
mkdir -p /data/ccache
export CCACHE_DIR=/data/ccache
export CCACHE_MAXSIZE=50G
ccache -M 50G
ccache -s
- name: Build both binaries
env:
CCACHE_DIR: /data/ccache
run: |
mkdir -p ${{ runner.temp }}/binaries/base
mkdir -p ${{ runner.temp }}/binaries/head
nix-shell --command "just build-assumeutxo-binaries-guix $BASE_SHA $CHECKOUT_COMMIT"
cp binaries/base/bitcoind ${{ runner.temp }}/binaries/base/bitcoind
cp binaries/head/bitcoind ${{ runner.temp }}/binaries/head/bitcoind
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: bitcoind-binaries
path: ${{ runner.temp }}/binaries/
assumeutxo:
needs: build-binaries
strategy:
matrix:
include:
- network: signet
timeout: 20
utxo_path: /var/lib/bitcoin/utxo-signet-160000.dat
dbcache: 550
- network: mainnet-default
timeout: 600
utxo_path: /var/lib/bitcoin/utxo-840000.dat
dbcache: 550
- network: mainnet-large
timeout: 600
utxo_path: /var/lib/bitcoin/utxo-840000.dat
dbcache: 32000
runs-on: [self-hosted, linux, x64]
timeout-minutes: ${{ matrix.timeout }}
env:
NIX_PATH: nixpkgs=channel:nixos-unstable
UTXO_PATH: ${{ matrix.utxo_path }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: bitcoind-binaries
path: ${{ runner.temp }}/binaries
- name: Set binary permissions
run: |
chmod +x ${{ runner.temp }}/binaries/base/bitcoind
chmod +x ${{ runner.temp }}/binaries/head/bitcoind
- name: Fetch base commit
run: |
echo "CHECKOUT_COMMIT=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
- name: Run AssumeUTXO ${{ matrix.network }}
env:
TMP_DATADIR: "${{ runner.temp }}/base_datadir"
BINARIES_DIR: "${{ runner.temp }}/binaries"
run: |
env

# Patch binary shared object dependencies
nix-shell --command "patch-binary $BINARIES_DIR/head/bitcoind"
nix-shell --command "patch-binary $BINARIES_DIR/base/bitcoind"

# Run test
mkdir -p "$TMP_DATADIR"
nix-shell --command "just run-assumeutxo-${{ matrix.network }}-ci $BASE_SHA $CHECKOUT_COMMIT $TMP_DATADIR $UTXO_PATH ${{ runner.temp }}/results.json ${{ matrix.dbcache }} ${{ runner.temp }}/pngs $BINARIES_DIR"
- uses: actions/upload-artifact@v4
with:
name: result-${{ matrix.network }}
path: "${{ runner.temp }}/results.json"
- uses: actions/upload-artifact@v4
with:
name: pngs-${{ matrix.network }}
path: "${{ runner.temp }}/pngs/*.png"
- uses: actions/upload-artifact@v4
with:
name: flamegraph-${{ matrix.network }}
path: "**/*-flamegraph.svg"
- name: Write GitHub and runner context files
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
RUNNER_CONTEXT: ${{ toJSON(runner) }}
run: |
mkdir contexts
echo "$GITHUB_CONTEXT" | nix-shell -p jq --command "jq 'del(.token)' > contexts/github.json"
echo "$RUNNER_CONTEXT" > contexts/runner.json
- name: Upload context metadata as artifact
uses: actions/upload-artifact@v4
with:
name: run-metadata-${{ matrix.network }}
path: ./contexts/
Loading
Loading