name: "Ophyd Devices Install"
description: "Install BEC Widgets and related os dependencies"
inputs:
  BEC_CORE_BRANCH: # id of input
    required: false
    default: "main"
    description: "Branch of BEC Core to install"
  OPHYD_DEVICES_BRANCH: # id of input
    required: false
    default: "main"
    description: "Branch of Ophyd Devices to install"
  PYTHON_VERSION: # id of input
    required: false
    default: "3.11"
    description: "Python version to use"

runs:
  using: "composite"
  steps:
    - name: Setup Python
      uses: actions/setup-python@v5
      with:
        python-version: ${{ inputs.PYTHON_VERSION }}

    - name: Checkout BEC Core
      uses: actions/checkout@v4
      with:
        repository: bec-project/bec
        ref: ${{ inputs.BEC_CORE_BRANCH }}
        path: ./bec

    - name: Checkout Ophyd Devices
      uses: actions/checkout@v4
      with:
        repository: bec-project/ophyd_devices
        ref: ${{ inputs.OPHYD_DEVICES_BRANCH }}
        path: ./ophyd_devices

    - name: Install Python dependencies
      shell: bash
      run: |
        pip install uv
        uv pip install --system -e ./ophyd_devices[dev]
        uv pip install --system -e ./bec/bec_lib[dev]
        uv pip install --system -e ./bec/bec_server[dev]
