Skip to content

Run Benchmarks

Run Benchmarks #110

name: Run Benchmarks
on:
push:
branches:
- main
workflow_dispatch: # Allows the workflow to be triggered manually
inputs: # Optional inputs to customize the workflow when triggered manually
branch:
description: 'Branch to run benchmarks on'
required: false
default: 'main'
jobs:
run-benchmarks:
runs-on: ucc-benchmarks-8-core
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure the full history is fetched
# Build the Docker image
- name: Build Docker image
run: docker build -t ucc-benchmark .
# Run the benchmarks in the Docker container
- name: Run benchmarks
run: |
docker run --rm \
-v "/home/runner/work/ucc/ucc:/ucc" \
ucc-benchmark bash -c "
source /venv/bin/activate && \
./benchmarks/scripts/run_benchmarks.sh 8 && \
python ./benchmarks/scripts/plot_avg_benchmarks_over_time.py && \
python ./benchmarks/scripts/plot_latest_benchmarks.py
"
# Commit and push benchmark results
- name: Commit and push benchmark results
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Configure Git
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
# Ensure we are on the correct branch
git fetch origin ${{ github.head_ref || github.ref_name }}
git switch ${{ github.head_ref || github.ref_name }}
# Merge latest changes and resolve conflicts for .png files
git merge origin/${{ github.head_ref || github.ref_name }} || true
git checkout --theirs -- benchmarks/*.png
# Stage all changes (including resolved .png files)
git add benchmarks/*
git status
# Commit and push changes
git commit -m "Update benchmark results" || echo "No changes to commit"
git push origin HEAD:${{ github.head_ref || github.ref_name }}