tests: test against multiple Qiskit versions #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- name: Build packages | |
run: | | |
pip install hatch | |
hatch build | |
- name: Store packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: dist/ | |
examples: | |
needs: build-packages | |
name: examples-${{ matrix.os }}-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.12'] | |
os: ["ubuntu-latest"] | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
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: Restore packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
- 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: | | |
./examples/run_all.sh | |
# tests: | |
# name: tests-${{ matrix.os }}-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.12'] | |
# os: ['ubuntu-latest'] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Check shell scripts | |
# uses: ludeeus/action-shellcheck@2.0.0 | |
# - name: Lock | |
# run: poetry install --sync | |
# - name: Check version numbers consistency | |
# run: poetry run poe version_check | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Check formatting | |
# run: poetry run poe format_check | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Linting | |
# run: poetry run poe lint | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Type checking | |
# run: poetry run poe typecheck | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Testing | |
# run: poetry run poe test --cov_opts="-a" # add to examples coverage | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Docs | |
# run: poetry run poe docs | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Generate coverage report | |
# run: poetry run coverage lcov -o coverage.lcov | |
# if: startsWith(matrix.os, 'ubuntu') | |
# - name: Upload coverage report | |
# uses: coverallsapp/github-action@v2 | |
# with: | |
# file: coverage.lcov | |
# parallel: true | |
# flag-name: run ${{ join(matrix.*, ' - ') }} | |
# if: startsWith(matrix.os, 'ubuntu') | |
# finish: | |
# needs: tests | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Close parallel coverage build | |
# uses: coverallsapp/github-action@v2 | |
# with: | |
# parallel-finished: true |