Skip to content

v2.15.0rc1

v2.15.0rc1 #157

name: Automated Benchmarks
on:
workflow_dispatch:
release:
types: [published]
jobs:
build_wheels:
name: Build macos wheels
runs-on: macos-14
steps:
- uses: actions/checkout@v6
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/macos-26
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: Build tket C++
run: conan create tket --user tket --channel stable --build=missing -o boost/*:header_only=True -o tklog/*:shared=True -o tket/*:shared=True -tf ""
- name: Build wheel
run: |
cd pytket
# Ensure wheels are compatible with MacOS 12.0 and later:
export WHEEL_PLAT_NAME=macosx_12_0_arm64
python3.11 -m pip install -U pip build delocate
TKET_VERSION=`cat ../TKET_VERSION` python3.11 -m build
delocate-wheel -v -w "$GITHUB_WORKSPACE/wheelhouse/" "dist/pytket-"*".whl"
- name: Save Wheel
uses: actions/upload-artifact@v7
with:
name: pytket_wheel
path: wheelhouse/
compile-and-compare:
name: Compile and compare
runs-on: macos-26
needs: build_wheels
steps:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Download wheel
uses: actions/download-artifact@v8
with:
name: pytket_wheel
- name: Install dependencies
run: |
pip install --pre --extra-index-url https://${{ secrets.BENCHMARKING_ARTIFACTORY_USER }}:${{ secrets.BENCHMARKING_ARTIFACTORY_TOKEN }}@quantinuumsw.jfrog.io/artifactory/api/pypi/pypi_local/simple/ pytket_benchmarking
pip install pytket-*.whl
pip list
- name: Checkout pytket-benchmarking-store
uses: actions/checkout@v6
with:
repository: quantinuum/pytket-benchmarking-store
path: pytket-benchmarking-store
- name: Perform Compilation
run: |
(
pytket_benchmarking compile QiskitL3 HeavyHex3x3 pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_hh
pytket_benchmarking compile PytketL2 HeavyHex3x3 pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_hh
pytket_benchmarking compile PytketL3 HeavyHex3x3 pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_hh
) &
(
pytket_benchmarking compile QiskitL3 FullyConnected pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_fc
pytket_benchmarking compile PytketL2 FullyConnected pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_fc
pytket_benchmarking compile PytketL3 FullyConnected pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set compilations_fc
) &
wait
- name: Generating Report
run: pytket_benchmarking pdf-report -s pytket-benchmarking-store/benchmarking_circuits/benchmarking_mini_set -c compilations_fc -c compilations_hh -x FullyConnected -x HeavyHex3x3 -o report.pdf
- name: Save compiled circuits
uses: actions/upload-artifact@v7
with:
name: automated_benchmarks_compiled
path: |
compilations_hh
compilations_fc
report.pdf
- name: Upload Report
run: |
# https://stackoverflow.com/a/78933760
PYTKET_VERSION=$(python -c "import pytket; print(pytket.__version__)")
FILE_PATH="report.pdf"
CHANNEL_ID="G01CP0YFFA7"
TOKEN="${{ secrets.PYTKET_BENCHMARKING_SLACK_BOT_TOKEN }}"
FILENAME=$(basename "$FILE_PATH")
# Get the file size using macOS compatible stat command. use stat -c%s "$FILE_PATH" otherwise
FILE_SIZE=$(stat -f%z "$FILE_PATH")
# Stage 1: Get an upload URL
UPLOAD_URL_RESPONSE=$(curl -s -F files=@"$FILENAME" -F filename="$FILENAME" -F token=$TOKEN -F length=$FILE_SIZE https://slack.com/api/files.getUploadURLExternal)
UPLOAD_URL=$(echo "$UPLOAD_URL_RESPONSE" | jq -r '.upload_url')
FILE_ID=$(echo "$UPLOAD_URL_RESPONSE" | jq -r '.file_id')
if [ "$UPLOAD_URL" == "null" ]; then
echo "Error getting upload URL: $UPLOAD_URL_RESPONSE"
exit 1
fi
# Stage 2: Upload the file to the provided URL
UPLOAD_RESPONSE=$(curl -s -X POST \
-T "$FILE_PATH" \
-H "Content-Type: application/octet-stream" \
"$UPLOAD_URL")
if [ $? -ne 0 ]; then
echo "Error uploading file: $UPLOAD_RESPONSE"
exit 1
fi
# Stage 3: Complete the upload, and post the message and the file
COMPLETE_RESPONSE=$(curl -s -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json;charset=utf-8" \
-d '{
"files": [
{
"id": "'"$FILE_ID"'"
}
],
"channel_id": "'"$CHANNEL_ID"'",
"initial_comment": "Benchmarking results with pytket version '"$PYTKET_VERSION"'"
}' \
https://slack.com/api/files.completeUploadExternal)
if [ "$(echo "$COMPLETE_RESPONSE" | jq -r '.ok')" != "true" ]; then
echo "Error completing upload: $COMPLETE_RESPONSE"
exit 1
fi