Skip to content

Address PR comments #223

Address PR comments

Address PR comments #223

# This workflow will install Python dependencies, run benchmarks and then publish the results to github
name: Run Benchmarks
on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to run benchmarks on'
required: false
default: 'main'
jobs:
run-benchmarks:
runs-on: ucc-benchmarks-8-core-U22.04
if: contains(github.event.head_commit.message, '[benchmark chore]') == false
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
# 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 "
export POETRY_VIRTUALENVS_IN_PROJECT=false POETRY_VIRTUALENVS_PATH=/venv && \
poetry run ./benchmarks/scripts/run_benchmarks.sh 8 && \
poetry run python ./benchmarks/scripts/plot_avg_benchmarks_over_time.py && \
poetry run python ./benchmarks/scripts/plot_latest_benchmarks.py
poetry run python ./benchmarks/scripts/plot_latest_expval_benchmarks.py
"
# Commit and push benchmark results
- name: Configure Git for commit
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: Commit and push results
if: ${{ !github.event.act }} # skip during local actions testing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git switch ${{ github.head_ref || github.ref_name }}
git add -f benchmarks/*
git status
git commit -m "Update benchmark results [benchmark chore]" || echo "No changes to commit"
git push origin HEAD:${{ github.head_ref || github.ref_name }} --force