Generate Call Graph #176
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: Generate Call Graph | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'curve25519-dalek/src/**/*.rs' | |
| - 'curve25519-dalek/build.rs' | |
| - 'curve25519-dalek/Cargo.toml' | |
| - '.github/workflows/generate-callgraph.yml' | |
| - '.github/data/focus_dalek_entrypoints.json' | |
| schedule: | |
| # Run daily at 6:00 UTC to keep cache fresh (caches expire after 7 days of no access) | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| # Only allow one callgraph generation at a time | |
| concurrency: | |
| group: "callgraph" | |
| cancel-in-progress: true | |
| jobs: | |
| # Extract Verus and Rust versions from Cargo.toml metadata | |
| get-versions: | |
| name: Get Verus and Rust Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| verus_version: ${{ steps.extract.outputs.version }} | |
| rust_version: ${{ steps.extract.outputs.rust_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: curve25519-dalek/Cargo.toml | |
| sparse-checkout-cone-mode: false | |
| - name: Extract versions from Cargo.toml | |
| id: extract | |
| run: | | |
| METADATA=$(grep -A15 '\[package.metadata.verus\]' curve25519-dalek/Cargo.toml) | |
| VERSION=$(echo "$METADATA" | grep -E '^\s*release\s*=' | sed 's/.*= *"\([^"]*\)".*/\1/' | head -1) | |
| RUST_VERSION=$(echo "$METADATA" | grep -E '^\s*rust-version\s*=' | sed 's/.*= *"\([^"]*\)".*/\1/' | head -1) | |
| if [ -n "$VERSION" ]; then | |
| echo "Found Verus release version: $VERSION" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "No Verus release version found, will use latest" | |
| echo "version=" >> $GITHUB_OUTPUT | |
| fi | |
| if [ -n "$RUST_VERSION" ]; then | |
| echo "Found Rust version: $RUST_VERSION" | |
| echo "rust_version=$RUST_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "No Rust version found, will use default" | |
| echo "rust_version=" >> $GITHUB_OUTPUT | |
| fi | |
| # Generate the call graph using the external workflow | |
| generate: | |
| name: Generate Call Graph | |
| needs: get-versions | |
| uses: Beneficial-AI-Foundation/scip-callgraph/.github/workflows/generate-callgraph.yml@main | |
| with: | |
| github_url: https://github.com/Beneficial-AI-Foundation/dalek-lite | |
| github_path_prefix: curve25519-dalek | |
| project_path: curve25519-dalek | |
| deploy_mode: subpath | |
| subpath: callgraph | |
| skip_verification: false | |
| skip_similar_lemmas: false | |
| verus_version: ${{ needs.get-versions.outputs.verus_version }} | |
| rust_version: ${{ needs.get-versions.outputs.rust_version }} | |
| # Save the generated callgraph to cache for fast access by deploy workflow | |
| cache-callgraph: | |
| name: Cache Call Graph | |
| needs: generate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (for focus set data) | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: .github/data/focus_dalek_entrypoints.json | |
| sparse-checkout-cone-mode: false | |
| - name: Download callgraph viewer artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: callgraph-viewer | |
| path: callgraph | |
| - name: Add focus set to callgraph artifact | |
| run: | | |
| if [ -f .github/data/focus_dalek_entrypoints.json ]; then | |
| cp .github/data/focus_dalek_entrypoints.json callgraph/focus_dalek_entrypoints.json | |
| TOTAL=$(python3 -c "import json; print(json.load(open('.github/data/focus_dalek_entrypoints.json'))['metadata']['total'])" 2>/dev/null || echo "?") | |
| echo "✓ Added focus set (${TOTAL} entry-point functions)" | |
| else | |
| echo "⚠ No focus set file found at .github/data/focus_dalek_entrypoints.json, skipping" | |
| fi | |
| - name: Fix callgraph asset paths for subpath deployment | |
| run: | | |
| # Pre-fix the paths so deploy workflow doesn't need to | |
| if [ -f callgraph/index.html ]; then | |
| echo "Updating asset paths in callgraph/index.html" | |
| sed -i 's|"/callgraph/|"/dalek-lite/callgraph/|g' callgraph/index.html | |
| sed -i 's|href="/assets/|href="/dalek-lite/callgraph/assets/|g' callgraph/index.html | |
| sed -i 's|src="/assets/|src="/dalek-lite/callgraph/assets/|g' callgraph/index.html | |
| echo "Fixed asset paths" | |
| fi | |
| - name: Verify callgraph files exist | |
| run: | | |
| if [ -f callgraph/index.html ]; then | |
| echo "✓ Callgraph ready for caching ($(ls callgraph | wc -l) files)" | |
| else | |
| echo "✗ index.html NOT FOUND" | |
| exit 1 | |
| fi | |
| - name: Save callgraph to cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: callgraph | |
| key: callgraph-${{ github.sha }}-${{ github.run_id }} |