Skip to content

Debug pytest on ubuntu-20.04 and 3.12 #8

Debug pytest on ubuntu-20.04 and 3.12

Debug pytest on ubuntu-20.04 and 3.12 #8

Workflow file for this run

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary: GitHub workflow for running CI jobs manually, for testing
#
# This workflow can only be executed manually, using the "Run workflow" button
# on https://github.com/quantumlib/Cirq/actions/workflows/debug.yaml
# Clicking the "Run workflow" button there will present a form interface with
# various options for the characteristics of the run.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
name: Debug CI jobs
on:
workflow_dispatch:
inputs:
what-to-debug:
description: "What to debug:"
type: choice
default: pytest
options:
- pytest
- coverage
- windows
- macos
py-version:
description: "Python version:"
type: choice
default: "3.12"
options:
- "3.10"
- "3.11"
- "3.12"
os:
description: "Runner OS:"
type: choice
default: ubuntu-20.04
options:
- ubuntu-22.04
- ubuntu-20.04
- macos-15
- macos-14
- macos-13
- windows-2025
- windows-2022
- windows-2019
verbose:
description: "Verbose tracing:"
type: boolean
default: false
multiple-workers:
description: "Use multiple pytest workers?"
type: boolean
default: true
run-name: Debug ${{inputs.what-to-debug}} on ${{inputs.os}} and ${{inputs.py-version}}
jobs:
pytest:
name: Run pytest on ${{github.event.inputs.os}} with Python ${{github.event.inputs.py-version}}
runs-on: ${{github.event.inputs.os}}
steps:
- name: Do miscellaneous preliminary configuration steps
id: config
run: |
mkdir -p ~/.cache/pip
case "${{github.event.inputs.os}}" in
macos*)
echo "arch=arm64" >> "$GITHUB_OUTPUT"
;;
*)
echo "arch=x64" >> "$GITHUB_OUTPUT"
;;
esac
- name: Check out a copy of the Cirq git repository
uses: actions/checkout@v4
- name: Set up Python
id: python
uses: actions/setup-python@v5
with:
python-version: ${{github.event.inputs.py-version}}
architecture: ${{steps.config.outputs.arch}}
cache: pip
cache-dependency-path: |
dev_tools/requirements/*.txt
dev_tools/requirements/deps/*.txt
- name: Install Python requirements
run: |
pip install --upgrade pip setuptools wheel
pip install --upgrade --upgrade-strategy eager -r dev_tools/requirements/dev.env.txt
# - name: Start Quil dependencies
# run: docker compose -f cirq-rigetti/docker-compose.test.yaml up -d
- name: Run pytest
run: |
commonflags="--durations=20 --ignore=cirq-core/cirq/contrib"
workers="-n auto"
if [[ "${{github.event.inputs.multiple-workers}}" == "false" ]]; then
workers="-n0"
fi
extraflags=""
if [[ "${{github.event.inputs.verbose}}" == "true" ]]; then
extraflags="-vsx --trace-config --full-trace --setup-show"
fi
# Save information to the run log, in case it's needed for debugging.
echo "─────────────────────────────────────────────────────────────"
which python
python --version
pip list
echo "─────────────────────────────────────────────────────────────"
set -x -e
check/pytest "$workers" "$commonflags" "$extraflags" # --rigetti-integration
# - name: Stop Quil dependencies
# run: docker compose -f cirq-rigetti/docker-compose.test.yaml down