Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: test against multiple Qiskit versions #143

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15cbaf8
Pin Python version
airwoodix Feb 23, 2024
de40dc1
gitignore: simplify
airwoodix Feb 23, 2024
30c9709
pyproject: switch to PyPA/PEP-621 format, use hatchling build backend
airwoodix Feb 23, 2024
6e223f6
workflows: prototype testing with uv and qiskit version in matrix
airwoodix Feb 23, 2024
fb7534f
workflows: run examples against wheel
airwoodix Feb 23, 2024
8495058
workflows/package_tests: fix job name
airwoodix Feb 23, 2024
b612974
workflows/tests: apply qiskit override
airwoodix Feb 23, 2024
f0400bd
workflows/tests: build packages separately
airwoodix Feb 23, 2024
5df262f
workflows/tests: run linter and tests
airwoodix Feb 23, 2024
bc379eb
workflows/tests: add coverage report
airwoodix Feb 23, 2024
eaac906
workflows/{docs,release}: test transition to hatch/uv
airwoodix Feb 23, 2024
2790ee5
workflows/tests: don't install package as editable
airwoodix Feb 23, 2024
d378581
workflows/{docs,release}: re-enable
airwoodix Feb 23, 2024
985ad25
dev-deps: add pylatexenc
airwoodix Feb 23, 2024
f142700
workflows/tests: expand matrix
airwoodix Feb 23, 2024
193bc59
workflows/tests: adjust job name
airwoodix Feb 23, 2024
fa47351
workflows/package-tests: use isolated venv
airwoodix Feb 23, 2024
791bf69
workflows/package-tests: activate venv when necessary
airwoodix Feb 23, 2024
2079e02
workflows/tests: re-enable
airwoodix Feb 23, 2024
a94ee06
test_primitives: skip backend compat test for qiskit <1
airwoodix Feb 23, 2024
26d668f
changelog: add entries for #143
airwoodix Feb 23, 2024
dad44ec
test_primitives: fix pytest skipif
airwoodix Feb 23, 2024
feefba3
dev-deps: bump pytest-httpx
airwoodix Feb 23, 2024
f7183dc
workflows/tests: move resolution-strategy switch to test-packages
airwoodix Feb 23, 2024
eb19342
workflows/tests: remove resolution strategy
airwoodix Feb 23, 2024
0ebf5c5
readme: update build status badge
airwoodix Feb 23, 2024
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
29 changes: 16 additions & 13 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,28 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.7.1'
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: "poetry"
- name: Check Poetry lock file consistency
run: poetry check --lock
python-version: 3.12
cache: "pip"
- name: Install uv
run: |
# https://github.com/astral-sh/uv/issues/1386#issuecomment-1947801083
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
pip install uv
- name: Install dependencies
run: poetry install --sync
run: |
# FIXME: https://github.com/Qiskit/qiskit_sphinx_theme/issues/567
echo 'furo==2023.9.10' > furo-override.txt
uv pip compile pyproject.toml --all-extras --override furo-override.txt > requirements.txt
uv pip sync --strict requirements.txt
uv pip install 'qiskit-aqt-provider @ .'
- name: Check version numbers consistency
run: poetry run poe version_check
run: poe version_check
- name: Build documentation
run: poetry run poe docs
run: poe docs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
Expand Down
104 changes: 0 additions & 104 deletions .github/workflows/poetry.yml

This file was deleted.

21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ on:
push:
tags:
- 'v*'
# Run on manual triggers
workflow_dispatch:
jobs:
wheel-build:
release:
name: Build and Publish Release Artifacts
runs-on: ubuntu-latest
environment: release
Expand All @@ -17,17 +19,18 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.7.1'
python-version: 3.12
- name: Install uv
run: |
# https://github.com/astral-sh/uv/issues/1386#issuecomment-1947801083
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
pip install uv
- name: Install release dependencies
run: pip install -U typer mistletoe
run: |
uv pip install typer mistletoe hatch
- name: Build packages
run: |
poetry build
shell: bash
hatch build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
163 changes: 163 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Tests
on:
push:
branches:
- master
pull_request:
# Run on manual triggers
workflow_dispatch:
env:
PYTHONIOENCODING: utf-8
jobs:
build-packages:
name: build-packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "pip"
- name: Install uv
run: |
# https://github.com/astral-sh/uv/issues/1386#issuecomment-1947801083
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
pip install uv
- name: Build packages
run: |
uv pip install hatch
hatch build
- name: Store packages
uses: actions/upload-artifact@v4
with:
name: packages
path: dist/
examples:
needs: build-packages
name: examples-py${{ matrix.python-version }}-qiskit${{ matrix.qiskit-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
qiskit-version: ['0.46.0', '1.0.1']
python-version: ['3.9', '3.10', '3.11', '3.12']
os: ["ubuntu-latest"]
steps:
- name: Checkout examples # FIXME: ship examples with source distribution
uses: actions/checkout@v4
with:
sparse-checkout: |
examples
sparse-checkout-cone-mode: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
pip install uv
uv venv
# FIXME: https://github.com/astral-sh/uv/issues/1386
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
- name: Restore packages
uses: actions/download-artifact@v4
with:
name: packages
path: dist
- name: Install package wheel
run: |
# there is only one wheel in dist/
echo "qiskit==${{ matrix.qiskit-version }}" > override.txt
uv pip install --strict --override override.txt "qiskit-aqt-provider[examples] @ $(ls dist/*.whl)"
- name: Run examples
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
./examples/run_all.sh
tests:
name: tests-py${{ matrix.python-version }}-qiskit${{ matrix.qiskit-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
qiskit-version: ['0.46.0', '1.0.1']
python-version: ['3.9', '3.10', '3.11', '3.12']
os: ['ubuntu-latest']
steps:
- uses: actions/checkout@v4
- name: Check shell scripts
uses: ludeeus/action-shellcheck@2.0.0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install uv
run: |
pip install uv
uv venv
# https://github.com/astral-sh/uv/issues/1386
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
- name: Lock dependencies
run: |
echo "qiskit==${{ matrix.qiskit-version }}" > qiskit-override.txt
# FIXME: https://github.com/Qiskit/qiskit_sphinx_theme/issues/567
echo 'furo==2023.9.10' > furo-override.txt
uv pip compile pyproject.toml --all-extras --override qiskit-override.txt --override furo-override.txt | tee requirements.txt
- name: Install project
run: |
uv pip sync --strict requirements.txt
uv pip install 'qiskit-aqt-provider @ .' # for the plugins
- name: Check version numbers consistency
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe version_check
- name: Check formatting
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe format_check
- name: Linting
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe lint
- name: Type checking
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe typecheck
- name: Run examples with coverage
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
./examples/run_all.sh -c
- name: Run tests with coverage
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe test --cov_opts="-a" # add to examples coverage
- name: Build docs
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
poe docs
- name: Generate coverage report
run: |
# FIXME: https://github.com/astral-sh/uv/issues/1910
source $VIRTUAL_ENV/bin/activate
coverage lcov -o coverage.lcov
- name: Upload coverage report
uses: coverallsapp/github-action@v2
with:
file: coverage.lcov
parallel: true
flag-name: run ${{ join(matrix.*, ' - ') }}
finish:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Close parallel coverage build
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
Loading