Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ jobs:
- name: Checkout current PR
uses: actions/checkout@v4

- name: Checkout main branch
- name: Checkout baseline branch
uses: actions/checkout@v4
with:
ref: main
path: _canbench_main_branch
path: _canbench_baseline_branch

- uses: actions/cache@v4
with:
Expand Down
16 changes: 8 additions & 8 deletions scripts/ci_run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ CANBENCH_JOB_NAME=$2
# Must match the file path specified in the GitHub Action.
COMMENT_MESSAGE_PATH=/tmp/canbench_result_${CANBENCH_JOB_NAME}

# GitHub CI is expected to have the main branch checked out in this folder.
MAIN_BRANCH_DIR=_canbench_main_branch
# GitHub CI is expected to have the baseline branch checked out in this folder.
BASELINE_BRANCH_DIR=_canbench_baseline_branch

CANBENCH_OUTPUT=/tmp/canbench_output.txt

CANBENCH_RESULTS_FILE="$CANISTER_PATH/canbench_results.yml"
MAIN_BRANCH_RESULTS_FILE="$MAIN_BRANCH_DIR/$CANBENCH_RESULTS_FILE"
BASELINE_BRANCH_RESULTS_FILE="$BASELINE_BRANCH_DIR/$CANBENCH_RESULTS_FILE"

CANBENCH_RESULTS_CSV_FILE="/tmp/canbench_results_${CANBENCH_JOB_NAME}.csv"

Expand Down Expand Up @@ -78,12 +78,12 @@ time=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
# Print output with correct formatting
echo "# \`canbench\` 🏋 (dir: $CANISTER_PATH) $commit_hash $time" > "$COMMENT_MESSAGE_PATH"

# Check for performance changes relative to the main branch.
if [ -f "$MAIN_BRANCH_RESULTS_FILE" ]; then
# Replace the current results with the main branch results.
mv "$MAIN_BRANCH_RESULTS_FILE" "$CANBENCH_RESULTS_FILE"
# Check for performance changes relative to the baseline branch.
if [ -f "$BASELINE_BRANCH_RESULTS_FILE" ]; then
# Replace the current results with the baseline branch results.
mv "$BASELINE_BRANCH_RESULTS_FILE" "$CANBENCH_RESULTS_FILE"

# Run canbench to compare results with the main branch.
# Run canbench to compare results with the baseline branch.
pushd "$CANISTER_PATH"
canbench --less-verbose --hide-results --show-summary --csv > "$CANBENCH_OUTPUT"
cp "./canbench_results.csv" "$CANBENCH_RESULTS_CSV_FILE"
Expand Down