diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 9a919ff..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,117 +0,0 @@ -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 $BASE_SHA $CHECKOUT_COMMIT" - cp build-base/src/bitcoind ${{ runner.temp }}/binaries/base/bitcoind - cp build-head/src/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 - mkdir -p "$TMP_DATADIR" - CMD="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\"" - echo "Running command: $CMD" - eval "$CMD" - - 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/ diff --git a/.github/workflows/publish-results.yml b/.github/workflows/publish-results.yml deleted file mode 100644 index 9d29324..0000000 --- a/.github/workflows/publish-results.yml +++ /dev/null @@ -1,298 +0,0 @@ -name: Publish Results -on: - workflow_run: - workflows: ["CI"] - types: [completed] -jobs: - build: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - permissions: - actions: read - contents: write - checks: read - env: - NETWORKS: "mainnet-default,mainnet-large,signet" - outputs: - speedups: ${{ steps.organize.outputs.speedups }} - pr-number: ${{ steps.organize.outputs.pr-number }} - steps: - - uses: actions/checkout@v4 - with: - ref: gh-pages - - name: Download artifacts - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh run download ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} - - - name: Extract artifacts - run: | - for network in ${NETWORKS//,/ }; do - if [ -d "result-${network}" ]; then - mkdir -p "${network}-results" - mv "result-${network}/results.json" "${network}-results/" - fi - - if [ -d "flamegraph-${network}" ]; then - mkdir -p "${network}-flamegraph" - mv "flamegraph-${network}"/* "${network}-flamegraph/" - fi - - if [ -d "run-metadata-${network}" ]; then - mkdir -p "${network}-metadata" - mv "run-metadata-${network}"/* "${network}-metadata/" - fi - - if [ -d "pngs-${network}" ]; then - mkdir -p "${network}-plots" - mv "pngs-${network}"/*.png "${network}-plots/" - fi - done - - name: Organize results - id: organize - uses: actions/github-script@v7 - with: - script: | - const fs = require('fs'); - const path = require('path'); - const networks = process.env.NETWORKS.split(','); - let prNumber = 'main'; - let runId; - - // First, extract metadata and get PR number - for (const network of networks) { - if (fs.existsSync(`${network}-metadata/github.json`)) { - const metadata = JSON.parse(fs.readFileSync(`${network}-metadata/github.json`, 'utf8')); - prNumber = metadata.event.pull_request?.number || prNumber; - runId = metadata.run_id; - } - } - - if (!runId) { - console.error('No valid metadata found for any network'); - process.exit(1); - } - - // Create directory structure - const resultDir = `results/pr-${prNumber}/${runId}`; - fs.mkdirSync(resultDir, { recursive: true }); - - // Now copy metadata files - for (const network of networks) { - if (fs.existsSync(`${network}-metadata/github.json`)) { - const metadataDir = `${resultDir}/${network}-metadata`; - fs.mkdirSync(metadataDir, { recursive: true }); - fs.copyFileSync(`${network}-metadata/github.json`, `${metadataDir}/github.json`); - } - } - - // Process each network's results - const combinedResults = { - results: [], - speedups: {} - }; - - for (const network of networks) { - if (fs.existsSync(`${network}-results`)) { - const networkResults = JSON.parse(fs.readFileSync(`${network}-results/results.json`, 'utf8')); - let baseMean, headMean; - - // Add network name to each result and collect means - networkResults.results.forEach(result => { - result.network = network; - combinedResults.results.push(result); - if (result.command.includes('base')) { - baseMean = result.mean; - } else if (result.command.includes('head')) { - headMean = result.mean; - } - }); - - // Calculate speedup if we have both measurements - if (baseMean && headMean) { - const speedup = baseMean > 0 ? ((baseMean - headMean) / baseMean * 100).toFixed(1) : 'N/A'; - combinedResults.speedups[network] = speedup; - } - - // Move flamegraphs - if (fs.existsSync(`${network}-flamegraph`)) { - fs.readdirSync(`${network}-flamegraph`).forEach(file => { - const sourceFile = `${network}-flamegraph/${file}`; - const targetFile = `${resultDir}/${network}-${file}`; - fs.copyFileSync(sourceFile, targetFile); - }); - } - - // Move plots - if (fs.existsSync(`${network}-plots`)) { - const targetPlotsDir = `${resultDir}/${network}-plots`; - fs.mkdirSync(targetPlotsDir, { recursive: true }); - fs.readdirSync(`${network}-plots`).forEach(plot => { - const sourcePlot = `${network}-plots/${plot}`; - const targetPlot = `${targetPlotsDir}/${plot}`; - fs.copyFileSync(sourcePlot, targetPlot); - }); - } - } - } - - // Write combined results - fs.writeFileSync(`${resultDir}/results.json`, JSON.stringify(combinedResults, null, 2)); - - // Create index.html for this run - const indexHtml = ` - -
-| Command | -Mean (s) | -Std Dev | -User (s) | -System (s) | -
|---|---|---|---|---|
| - ${result.command.replace( - /\((\w+)\)/, - (_, commit) => `(${commit.slice(0, 8)})` - )} - | -${result.mean.toFixed(3)} | -${result.stddev?.toFixed(3) || 'N/A'} | -${result.user.toFixed(3)} | -${result.system.toFixed(3)} | -