Microbench ToplingDB #4
This file contains hidden or 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
| name: Microbench ToplingDB | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| rocksdb_image: | |
| description: GHCR image for official rocksdb standalone (empty = ghcr.io/<owner>/nebula-standalone-rocksdb:latest) | |
| required: false | |
| default: "" | |
| topling_image: | |
| description: GHCR image for topling standalone (empty = ghcr.io/<owner>/nebula-standalone-topling:latest) | |
| required: false | |
| default: "" | |
| bootstrap_pages: | |
| description: If true and no pages-site snapshot exists, bootstrap empty Pages site (first publish only) | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "false" | |
| - "true" | |
| permissions: | |
| contents: read | |
| packages: read | |
| concurrency: | |
| group: microbench-toplingdb-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| BENCH_ROOT: ${{ github.workspace }} | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| bench: | |
| name: ${{ matrix.profile }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| profile: [rocksdb, conservative, enterprise] | |
| steps: | |
| - name: Checkout nebula-bench | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.8" | |
| - name: Install microbench deps | |
| run: python3 -m pip install --upgrade pip && python3 -m pip install -r scripts/ci/microbench-requirements.txt | |
| - name: Login to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull image and run profile microbench | |
| env: | |
| ROCKSDB_IMAGE: ${{ inputs.rocksdb_image != '' && inputs.rocksdb_image || format('ghcr.io/{0}/nebula-standalone-rocksdb:latest', github.repository_owner) }} | |
| TOPLING_IMAGE: ${{ inputs.topling_image != '' && inputs.topling_image || format('ghcr.io/{0}/nebula-standalone-topling:latest', github.repository_owner) }} | |
| ENTERPRISE_WRITE_BUFFER_SIZE: "128M" | |
| ENTERPRISE_LOCAL_TEMP_DIR: "/tmp" | |
| run: | | |
| set -euo pipefail | |
| if grep -RInE 'cmake|make build|docker build' scripts/ci/run-profile-microbench.sh >/dev/null; then | |
| echo "unexpected compile hooks in run-profile-microbench.sh" >&2 | |
| exit 1 | |
| fi | |
| bash scripts/ci/run-profile-microbench.sh "${{ matrix.profile }}" | |
| - name: Upload profile output | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: microbench-${{ matrix.profile }} | |
| path: output/microbench-${{ matrix.profile }}-* | |
| if-no-files-found: warn | |
| report: | |
| name: microbench-report | |
| needs: bench | |
| if: ${{ !cancelled() && needs.bench.result == 'success' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| actions: read | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| concurrency: | |
| group: github-pages-deploy | |
| cancel-in-progress: false | |
| steps: | |
| - name: Checkout nebula-bench | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.8" | |
| - name: Download microbench artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: output | |
| pattern: microbench-* | |
| merge-multiple: true | |
| - name: Generate microbench report | |
| run: bash scripts/ci/generate-microbench-report.sh output output/microbench-report | |
| - name: Upload microbench report artifact | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: microbench-report | |
| path: output/microbench-report/ | |
| if-no-files-found: error | |
| - name: Download latest pages-site snapshot | |
| id: pages_snap | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p output/pages-site | |
| set +e | |
| bash scripts/ci/download-latest-pages-site.sh output/pages-site | |
| rc=$? | |
| set -e | |
| if [[ "${rc}" -eq 0 ]]; then | |
| echo "found=true" >> "${GITHUB_OUTPUT}" | |
| elif [[ "${rc}" -eq 2 ]]; then | |
| echo "found=false" >> "${GITHUB_OUTPUT}" | |
| else | |
| exit "${rc}" | |
| fi | |
| - name: Decide Pages publish | |
| id: pages_gate | |
| run: | | |
| set -euo pipefail | |
| found="${{ steps.pages_snap.outputs.found }}" | |
| bootstrap="${{ inputs.bootstrap_pages }}" | |
| if [[ "${found}" == "true" ]]; then | |
| echo "publish=true" >> "${GITHUB_OUTPUT}" | |
| echo "mode=merge" >> "${GITHUB_OUTPUT}" | |
| elif [[ "${bootstrap}" == "true" ]]; then | |
| bash scripts/ci/bootstrap-pages-site.sh output/pages-site | |
| echo "publish=true" >> "${GITHUB_OUTPUT}" | |
| echo "mode=bootstrap" >> "${GITHUB_OUTPUT}" | |
| else | |
| echo "publish=false" >> "${GITHUB_OUTPUT}" | |
| echo "mode=skip" >> "${GITHUB_OUTPUT}" | |
| { | |
| echo "## Pages" | |
| echo | |
| echo "Pages 未更新:缺少 pages-site 快照(且未开启 bootstrap_pages)。" | |
| } >> "${GITHUB_STEP_SUMMARY}" | |
| fi | |
| - name: Merge microbench run into pages site | |
| if: steps.pages_gate.outputs.publish == 'true' | |
| env: | |
| ACTIONS_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| set -euo pipefail | |
| bash scripts/ci/merge-pages-site.sh \ | |
| output/pages-site \ | |
| microbench \ | |
| "${GITHUB_RUN_ID}" \ | |
| output/microbench-report \ | |
| "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| - name: Upload pages-site snapshot artifact | |
| if: steps.pages_gate.outputs.publish == 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pages-site | |
| path: output/pages-site/ | |
| if-no-files-found: error | |
| retention-days: 90 | |
| - name: Upload Pages artifact | |
| if: steps.pages_gate.outputs.publish == 'true' | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: output/pages-site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| if: steps.pages_gate.outputs.publish == 'true' | |
| uses: actions/deploy-pages@v5 | |
| - name: Publish report links | |
| if: always() | |
| env: | |
| PAGE_URL: ${{ steps.deployment.outputs.page_url }} | |
| PUBLISH: ${{ steps.pages_gate.outputs.publish }} | |
| run: | | |
| set -euo pipefail | |
| run_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| { | |
| echo "## Nebula microbench" | |
| echo | |
| echo "**Workflow run:** ${run_url}" | |
| echo | |
| echo "**Artifact:** 下载 \`microbench-report\` → 打开 \`report.html\`" | |
| echo | |
| } >> "${GITHUB_STEP_SUMMARY}" | |
| if [[ "${PUBLISH}" == "true" && "${{ steps.deployment.outcome }}" == "success" && -n "${PAGE_URL}" ]]; then | |
| base="${PAGE_URL%/}/" | |
| { | |
| echo "**Pages 首页表:** ${base}" | |
| echo | |
| echo "| 报告 | URL |" | |
| echo "| --- | --- |" | |
| echo "| 本次 microbench | ${base}microbench/runs/${{ github.run_id }}/report.html |" | |
| echo "| 索引表 | ${base} |" | |
| } >> "${GITHUB_STEP_SUMMARY}" | |
| fi |