DWARF Perf History #45
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: DWARF Perf History | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'ghostscope-dwarf/**' | |
| - 'bins/dwarf-tool/**' | |
| - 'scripts/dwarf-perf/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - '.github/workflows/dwarf-perf-history.yml' | |
| schedule: | |
| - cron: '17 3 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: dwarf-perf-history-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| LLVM_SYS_181_PREFIX: /usr/lib/llvm-18 | |
| jobs: | |
| build: | |
| name: Build DWARF Perf History | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 75 | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/.target_tmp/dwarf-perf-history | |
| DWARF_PERF_RESULTS_DIR: ${{ github.workspace }}/.tmp/dwarf-perf-results | |
| DWARF_PERF_SITE_DIR: ${{ github.workspace }}/.tmp/dwarf-perf-site | |
| DWARF_PERF_HISTORY_BRANCH: dwarf-perf-history-data | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Configure GitHub Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install LLVM 18 and jq | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 18 | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev jq | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@1.88.0 | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-dwarf-perf-history-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-dwarf-perf-history-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-dwarf-perf-history-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-dwarf-perf-history-cargo-index- | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.target_tmp/dwarf-perf-history | |
| key: ${{ runner.os }}-dwarf-perf-history-target-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-dwarf-perf-history-target- | |
| - name: Prepare result directories | |
| run: mkdir -p "$DWARF_PERF_RESULTS_DIR" | |
| - name: Run baseline | |
| run: | | |
| set -euo pipefail | |
| ./scripts/dwarf-perf/build_corpus.sh | |
| parse_targets=( | |
| parse-stress | |
| rust-parse-stress | |
| cpp-template-stress | |
| rust-generic-stress | |
| cpp-deep-namespace | |
| ) | |
| combine_args=() | |
| primary_json="" | |
| for target in "${parse_targets[@]}"; do | |
| result_json="$DWARF_PERF_RESULTS_DIR/main-${target}.json" | |
| ./scripts/dwarf-perf/run_baseline.sh \ | |
| --skip-build \ | |
| --results-dir "$DWARF_PERF_RESULTS_DIR" \ | |
| --result-name "main-${target}" \ | |
| --runs 10 \ | |
| --cargo-target-dir "$CARGO_TARGET_DIR" \ | |
| --parse-target "$target" | |
| if [[ -z "$primary_json" ]]; then | |
| primary_json="$result_json" | |
| else | |
| combine_args+=(--additional "$result_json") | |
| fi | |
| done | |
| python3 scripts/dwarf-perf/combine_baselines.py \ | |
| --primary "$primary_json" \ | |
| "${combine_args[@]}" \ | |
| --output "$DWARF_PERF_RESULTS_DIR/main.json" | |
| - name: Restore history state worktree | |
| env: | |
| REPO_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| run: | | |
| set -euo pipefail | |
| if git ls-remote --exit-code --heads "$REPO_URL" "$DWARF_PERF_HISTORY_BRANCH" >/dev/null 2>&1; then | |
| git clone --depth 1 --branch "$DWARF_PERF_HISTORY_BRANCH" "$REPO_URL" "$DWARF_PERF_SITE_DIR" | |
| else | |
| mkdir -p "$DWARF_PERF_SITE_DIR" | |
| git init "$DWARF_PERF_SITE_DIR" | |
| git -C "$DWARF_PERF_SITE_DIR" checkout -b "$DWARF_PERF_HISTORY_BRANCH" | |
| git -C "$DWARF_PERF_SITE_DIR" remote add origin "$REPO_URL" | |
| fi | |
| - name: Publish history site | |
| run: | | |
| set -euo pipefail | |
| python3 scripts/dwarf-perf/publish_history.py \ | |
| --baseline "$DWARF_PERF_RESULTS_DIR/main.json" \ | |
| --site-dir "$DWARF_PERF_SITE_DIR" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --sha "$GITHUB_SHA" \ | |
| --ref "$GITHUB_REF_NAME" \ | |
| --event "$GITHUB_EVENT_NAME" \ | |
| --run-id "$GITHUB_RUN_ID" \ | |
| --run-number "$GITHUB_RUN_NUMBER" \ | |
| --run-attempt "$GITHUB_RUN_ATTEMPT" \ | |
| --run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
| - name: Commit and push history state | |
| run: | | |
| set -euo pipefail | |
| git -C "$DWARF_PERF_SITE_DIR" add . | |
| if git -C "$DWARF_PERF_SITE_DIR" diff --cached --quiet; then | |
| echo "No history changes to persist" | |
| else | |
| git -C "$DWARF_PERF_SITE_DIR" \ | |
| -c user.name='github-actions[bot]' \ | |
| -c user.email='41898282+github-actions[bot]@users.noreply.github.com' \ | |
| commit -m "chore: update dwarf perf history for ${GITHUB_SHA::12}" | |
| git -C "$DWARF_PERF_SITE_DIR" push origin "$DWARF_PERF_HISTORY_BRANCH" | |
| fi | |
| - name: Remove git metadata from published site | |
| run: rm -rf "$DWARF_PERF_SITE_DIR/.git" | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ${{ github.workspace }}/.tmp/dwarf-perf-site | |
| - name: Publish summary | |
| run: | | |
| cat >> "$GITHUB_STEP_SUMMARY" <<EOF | |
| ## DWARF Perf History | |
| - Baseline JSON: \`${DWARF_PERF_RESULTS_DIR}/main.json\` | |
| - History state branch: \`${DWARF_PERF_HISTORY_BRANCH}\` | |
| - Pages base path: ${{ steps.pages.outputs.base_path }} | |
| - Pages deployment: configured through \`GitHub Actions\` | |
| EOF | |
| - name: Upload history artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dwarf-perf-history-${{ github.run_id }} | |
| path: | | |
| ${{ github.workspace }}/.tmp/dwarf-perf-results/*.json | |
| ${{ github.workspace }}/.tmp/dwarf-perf-site/** | |
| deploy: | |
| name: Deploy DWARF Perf History | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |