Skip to content

Bump the python-packages group with 2 updates #1222

Bump the python-packages group with 2 updates

Bump the python-packages group with 2 updates #1222

Workflow file for this run

name: Build and test
on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop
- 'wheel/**'
- 'runci/**'
release:
types:
- created
- edited
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'
workflow_dispatch:
inputs:
run-integration-tests:
description: "Please type 'yes' to run also the integration tests (default 'no')."
required: true
default: "no"
env:
PYTKET_REMOTE_QUANTINUUM_USERNAME: ${{ secrets.PYTKET_REMOTE_QUANTINUUM_USERNAME }}
PYTKET_REMOTE_QUANTINUUM_PASSWORD: ${{ secrets.PYTKET_REMOTE_QUANTINUUM_PASSWORD }}
jobs:
quantinuum-checks:
name: Quantinuum - Build and test module
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.9
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Build and test (3.9)
if: github.event_name == 'push' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and test (3.10) mypy
shell: bash
if: |
matrix.os == 'macos-12' &&
(
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
) ||
github.event_name == 'release' ||
(
github.event_name == 'workflow_dispatch' &&
github.event.inputs.run-integration-tests == 'no'
)
)
run: |
./.github/workflows/build-test mypy
- name: Build and test (3.10) nomypy
if: |
matrix.os != 'macos-12' &&
(
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
) ||
github.event_name == 'release' ||
(
github.event_name == 'workflow_dispatch' &&
github.event.inputs.run-integration-tests == 'no'
)
)
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Build and test including integration (3.10) nomypy
if: |
matrix.os == 'ubuntu-22.04' &&
(
(
github.event_name == 'push' &&
(
contains(github.ref_name, 'main') ||
contains(github.ref_name, 'runci/')
)
) ||
github.event_name == 'schedule' ||
(
github.event_name == 'workflow_dispatch' &&
github.event.inputs.run-integration-tests == 'yes'
)
)
shell: bash
run: |
./.github/workflows/build-test nomypy integration
env:
PYTKET_RUN_REMOTE_TESTS: 1
- name: Set up Python 3.11
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build and test (3.11)
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
shell: bash
run: |
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v4
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefact-${{ matrix.os }}
path: wheelhouse/
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
timeout-minutes: 20
run: |
./.github/workflows/docs/check-build-docs
pecos_checks:
name: Run local-emulator tests
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install module
run: python -m pip install -v -e .[pecos]
- name: Install test requirements
run: python -m pip install --pre -r tests/test-requirements.txt
- name: Run local-emulator tests
env:
PYTKET_RUN_REMOTE_TESTS: 1
working-directory: ./tests
run: pytest integration/local_emulator_test.py
qa_checks:
name: Run backend tests with QA endpoint
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install module
run: python -m pip install -v -e .
- name: Install test requirements
run: python -m pip install --pre -r tests/test-requirements.txt
- name: Run tests with QA endpoint
env:
PYTKET_RUN_REMOTE_TESTS: 1
PYTKET_REMOTE_QUANTINUUM_API_URL: https://hqapi.quantinuum.com/
PYTKET_REMOTE_QUANTINUUM_GROUP: DEFAULT
PYTKET_REMOTE_QUANTINUUM_USERNAME: ${{ secrets.PYTKET_REMOTE_QUANTINUUM_USERNAME_QA }}
PYTKET_REMOTE_QUANTINUUM_PASSWORD: ${{ secrets.PYTKET_REMOTE_QUANTINUUM_PASSWORD_QA }}
PYTKET_REMOTE_QUANTINUUM_EMULATORS_ONLY: 1
working-directory: ./tests
run: pytest integration/
publish_to_pypi:
name: Publish to pypi
if: github.event_name == 'release'
needs: quantinuum-checks
runs-on: ubuntu-22.04
steps:
- name: Download all wheels
# downloading all three files into the wheelhouse
# all files are identical, so there will only be one file
uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: artefact-*
merge-multiple: true
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_QUANTINUUM_API_TOKEN }}
verbose: true
build_docs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: wheelhouse
- name: Install pip, wheel
run: pip install -U pip wheel
- name: Install extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do pip install $w ; done
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
timeout-minutes: 20
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v2
with:
path: .github/workflows/docs/extensions
publish_docs:
name: Publish docs
if: github.event_name == 'release'
needs: build_docs
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3