chore: bump py version to 0.7.3 (#21) #3
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: Pytket Worker integration test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: "--cfg=ci_run" | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
UV_VERSION: "0.4.29" | |
jobs: | |
test: | |
name: Test Pytket Worker + SC22 Example | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
server-type: ["rust", "python"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mozilla-actions/[email protected] | |
if: ${{ matrix.server-type == 'rust' }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Build server | |
run: cd tierkreis-server && cargo build | |
if: ${{ matrix.server-type == 'rust' }} | |
- name: Install poetry (for pytket worker) | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.7.1 | |
- name: Build python wheel | |
run: | | |
set -e | |
pip install --upgrade build | |
python -m build --outdir dist ./python/ | |
- name: Retarget pytket_worker dependency onto wheel | |
run: | | |
set -e | |
set -x # Echo out the resolution of wildcard below | |
cd python/pytket_worker | |
poetry add $(readlink -f $(pwd)/../../dist/*.whl) | |
- name: Install (Rust) | |
run: | | |
set -e | |
pip install $(ls dist/*.whl)'[sc22-example,runtime,tksl]' | |
(cd python/pytket_worker && poetry install) | |
if: ${{ matrix.server-type == 'rust' }} | |
- name: Install (Python) | |
run: | | |
set -e | |
set -x | |
(cd python/pytket_worker && poetry build) | |
pip install ./python/pytket_worker/dist/*.whl $(ls ./dist/*.whl)'[sc22-example,test]' | |
pip install pytest pytest-asyncio | |
if: ${{ matrix.server-type == 'python' }} | |
- name: Pytest pytket_worker (python only) | |
# The --import-mode gets pytest to use the installed tierkreis package | |
# (with Rust binaries), rather than the sources in the tierkreis directory. | |
# Run the pytket tests (off by default), and only the pytket tests | |
run: cd python && pytest --import-mode=append --pytket -m pytket | |
if: ${{ matrix.server-type == 'python' }} | |
- name: Test from command line (Rust) | |
env: | |
SERVER: target/debug/tierkreis-server | |
CONFIG_FILE: .github/workflows/pytket_integration_config.json | |
RUN_SCRIPT: .github/workflows/run_with_server | |
run: | | |
# run pytest with local server | |
$RUN_SCRIPT $SERVER $CONFIG_FILE "cd ./python/examples && python sc22_example.py localhost:8090" | |
if: ${{ matrix.server-type == 'rust' }} | |
- name: Test from command line (Python) | |
run: python ./python/examples/sc22_example.py # No host/port --> PyRuntime | |
if: ${{ matrix.server-type == 'python' }} |