|
68 | 68 | mkdir -p output |
69 | 69 | mkdir -p rpc-cache |
70 | 70 |
|
| 71 | + # LOG_NAME with Block number and Timestamp(UTC+8) |
| 72 | + TIMESTAMP=$(TZ='Asia/Shanghai' date +'%Y%m%d-%H%M%S') |
| 73 | + LOG_NAME="mainnet${block_number}-${TIMESTAMP}" |
| 74 | + LOG_FILE="${LOG_NAME}.log" |
| 75 | + echo "LOG_NAME=${LOG_NAME}" >> $GITHUB_ENV |
| 76 | + echo "LOG_FILE=${LOG_FILE}" >> $GITHUB_ENV |
| 77 | +
|
71 | 78 | echo "Generating e2e proof for block $block_number..." |
72 | 79 | export JEMALLOC_SYS_WITH_MALLOC_CONF="retain:true,background_thread:true,metadata_thp:always,thp:always,dirty_decay_ms:10000,muzzy_decay_ms:10000,abort_conf:true" |
73 | 80 | CENO_GPU_CACHE_LEVEL=0 RUSTFLAGS="-C target-feature=+avx2" \ |
|
78 | 85 | --block-number $block_number \ |
79 | 86 | --rpc-url ${{ secrets.RPC_URL_1 }} \ |
80 | 87 | --output-dir output \ |
81 | | - --cache-dir rpc-cache |
| 88 | + --cache-dir rpc-cache \ |
| 89 | + 2>&1 | tee "$LOG_FILE" |
82 | 90 |
|
83 | 91 | echo "e2e proof generated successfully" |
| 92 | +
|
| 93 | + - name: Profile trace from log file |
| 94 | + run: | |
| 95 | + echo "Profiling log file: ${{ env.LOG_FILE }}" |
| 96 | + python3 ci/trace_profiler.py "${{ env.LOG_FILE }}" |
| 97 | +
|
| 98 | + - name: Prepare Result Directory |
| 99 | + run: | |
| 100 | + # Create a temp directory outside the workspace to survive checkout |
| 101 | + TEMP_DIR="/tmp/benchmark_results" |
| 102 | + rm -rf "$TEMP_DIR" |
| 103 | + mkdir -p "$TEMP_DIR" |
| 104 | + |
| 105 | + # Copy files to temp directory |
| 106 | + cp "${{ env.LOG_NAME }}_breakdown_chip.md" "$TEMP_DIR/" |
| 107 | + cp "${{ env.LOG_NAME }}_breakdown_module.md" "$TEMP_DIR/" |
| 108 | + cp "${{ env.LOG_NAME }}_summary.md" "$TEMP_DIR/" |
| 109 | + |
| 110 | + echo "TEMP_DIR=$TEMP_DIR" >> $GITHUB_ENV |
| 111 | +
|
| 112 | + ### Update gh-pages |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + ref: gh-pages |
| 116 | + |
| 117 | + - name: Set up git |
| 118 | + run: | |
| 119 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 120 | + git config --global user.name "github-actions[bot]" |
| 121 | +
|
| 122 | + - name: Commit to gh-pages branch |
| 123 | + run: | |
| 124 | + GH_PAGES_PATH="benchmarks-dispatch/${{ github.head_ref || github.ref }}" |
| 125 | + echo "GH_PAGES_PATH=${GH_PAGES_PATH}" >> $GITHUB_ENV |
| 126 | + mkdir -p "${GH_PAGES_PATH}" |
| 127 | + |
| 128 | + # Copy files from temp directory back to workspace |
| 129 | + cp -r ${{ env.TEMP_DIR }}/* "${GH_PAGES_PATH}/" |
| 130 | + |
| 131 | + git add "${GH_PAGES_PATH}/" |
| 132 | + git commit --allow-empty -m "Add benchmark results for ${{ env.LOG_NAME }} at ${GH_PAGES_PATH}" |
| 133 | + |
| 134 | + # Push with retry logic |
| 135 | + MAX_RETRIES=10 |
| 136 | + RETRY_DELAY=5 |
| 137 | + ATTEMPT=0 |
| 138 | + SUCCESS=false |
| 139 | + while [ $ATTEMPT -lt $MAX_RETRIES ]; do |
| 140 | + echo "Attempt $((ATTEMPT + 1)) to push of $MAX_RETRIES..." |
| 141 | + git fetch origin gh-pages |
| 142 | + git merge origin/gh-pages --no-edit |
| 143 | + if git push origin gh-pages; then |
| 144 | + SUCCESS=true |
| 145 | + break |
| 146 | + else |
| 147 | + echo "Push failed. Retrying in $RETRY_DELAY seconds..." |
| 148 | + sleep $RETRY_DELAY |
| 149 | + ATTEMPT=$((ATTEMPT + 1)) |
| 150 | + fi |
| 151 | + done |
| 152 | + |
| 153 | + if [ "$SUCCESS" = false ]; then |
| 154 | + echo "Push failed after $MAX_RETRIES attempts" |
| 155 | + exit 1 |
| 156 | + fi |
| 157 | +
|
| 158 | + - name: Update summary with results |
| 159 | + run: | |
| 160 | + RESULT_URL="https://github.com/${{ github.repository }}/blob/gh-pages/${{ env.GH_PAGES_PATH }}/${{ env.LOG_NAME }}_summary.md" |
| 161 | + echo "### Results" >> $GITHUB_STEP_SUMMARY |
| 162 | + echo "[${{ env.LOG_NAME }}](${RESULT_URL})" >> $GITHUB_STEP_SUMMARY |
| 163 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 164 | + cat "${{ env.GH_PAGES_PATH }}/${{ env.LOG_NAME }}_summary.md" >> $GITHUB_STEP_SUMMARY |
| 165 | +
|
| 166 | + - name: Cleanup Temp Directory |
| 167 | + if: always() |
| 168 | + run: | |
| 169 | + if [ -d "/tmp/benchmark_results" ]; then |
| 170 | + echo "Cleaning up /tmp/benchmark_results..." |
| 171 | + rm -rf "/tmp/benchmark_results" |
| 172 | + fi |
| 173 | +
|
| 174 | + - name: Path to result |
| 175 | + run: | |
| 176 | + echo "https://github.com/${{ github.repository }}/blob/gh-pages/${{ env.GH_PAGES_PATH }}/${{ env.LOG_NAME }}_summary.md" |
84 | 177 | # fi |
85 | 178 | # |
86 | 179 | # # Verify input file exists |
|
0 commit comments