Repository navigation
Introduce the ability to generate LabOP files for a Lab Compiler protocol #29
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Python ${{ matrix.python }} / ${{ matrix.dependencies }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.11", "3.12"] | |
| dependencies: [core, robots] | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install core dependencies | |
| if: matrix.dependencies == 'core' | |
| run: uv sync --locked | |
| - name: Install optional robot SDKs | |
| if: matrix.dependencies == 'robots' | |
| run: uv sync --locked --all-extras | |
| - name: Lint and type check | |
| if: matrix.python == '3.12' && matrix.dependencies == 'robots' | |
| run: | | |
| uv run --no-sync ruff check . | |
| uv run --no-sync mypy | |
| - name: Run tests | |
| run: uv run --no-sync pytest -q | |
| labop: | |
| name: Optional upstream LabOP integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7 | |
| with: | |
| python-version: "3.12" | |
| - run: uv sync --locked | |
| - name: Generate compiler artifacts | |
| run: | | |
| uv run --no-sync python -m examples.labop_export --out build/labop_check/operations | |
| uv run --no-sync python -m examples.cloning --target manual --out build/labop_check/cloning | |
| - name: Install upstream in a separate environment | |
| run: | | |
| uv run --no-sync python -m venv integrations/labop/.venv | |
| integrations/labop/.venv/bin/python -m pip install -r integrations/labop/requirements.txt | |
| - name: Check exported plans with upstream | |
| run: integrations/labop/.venv/bin/python integrations/labop/check.py build/labop_check | |
| build: | |
| name: Build and check distributions | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7 | |
| with: | |
| python-version: "3.12" | |
| - run: uv sync --locked | |
| - name: Check release tag matches package version | |
| if: github.event_name == 'release' | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| uv run --no-sync python - <<'PY' | |
| import os | |
| from importlib.metadata import version | |
| expected = f"v{version('lab-compiler')}" | |
| if os.environ["RELEASE_TAG"] != expected: | |
| raise SystemExit(f"Release tag must be {expected}") | |
| PY | |
| - name: Build wheel and source distribution | |
| run: uv build --no-sources | |
| - name: Check PyPI metadata and README | |
| run: uv run --no-sync twine check --strict dist/* | |
| - name: Check isolated installs from wheel and source distribution | |
| run: | | |
| for artifact in dist/*.whl dist/*.tar.gz; do | |
| environment="$RUNNER_TEMP/install-$(basename "$artifact")" | |
| uv venv "$environment" | |
| uv pip install --python "$environment/bin/python" "$artifact" | |
| "$environment/bin/python" -I scripts/check_install.py | |
| done | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: distributions | |
| path: dist/ | |
| if-no-files-found: error |