diff --git a/.copier-answers.yml b/.copier-answers.yml index 8f9faa8..39bfe07 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -2,7 +2,7 @@ # It is needed to track the repo template version, and editing may break things. # This file will be overwritten by copier on template updates. -_commit: v1.1.2 +_commit: v1.2.2 _src_path: https://github.com/bec-project/plugin_copier_template.git make_commit: true project_name: bec_testing_plugin diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..ab4aa4c --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CI for bec_testing_plugin +on: + push: + pull_request: + workflow_dispatch: + inputs: + BEC_WIDGETS_BRANCH: + description: "Branch of BEC Widgets to install" + required: false + type: string + default: "main" + BEC_CORE_BRANCH: + description: "Branch of BEC Core to install" + required: false + type: string + default: "main" + OPHYD_DEVICES_BRANCH: + description: "Branch of Ophyd Devices to install" + required: false + type: string + default: "main" + BEC_PLUGIN_REPO_BRANCH: + description: "Branch of the BEC Plugin Repository to install" + required: false + type: string + default: "main" + PYTHON_VERSION: + description: "Python version to use" + required: false + type: string + default: "3.11" + +permissions: + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + env: + QTWEBENGINE_DISABLE_SANDBOX: 1 + QT_QPA_PLATFORM: "offscreen" + + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "${{ inputs.PYTHON_VERSION || '3.11' }}" + + - name: Checkout BEC Core + uses: actions/checkout@v4 + with: + repository: bec/bec + ref: "${{ inputs.BEC_CORE_BRANCH || 'main' }}" + path: ./bec + + - name: Checkout Ophyd Devices + uses: actions/checkout@v4 + with: + repository: bec/ophyd_devices + ref: "${{ inputs.OPHYD_DEVICES_BRANCH || 'main' }}" + path: ./ophyd_devices + + - name: Checkout BEC Widgets + uses: actions/checkout@v4 + with: + repository: bec/bec_widgets + ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}" + path: ./bec_widgets + + - name: Checkout BEC Plugin Repository + uses: actions/checkout@v4 + with: + repository: bec/bec_testing_plugin + ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}" + path: ./bec_testing_plugin + + - name: Install dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb + sudo apt-get -y install libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1 + + - name: Install Python dependencies + shell: bash + run: | + pip install uv + uv pip install --system -e ./ophyd_devices + uv pip install --system -e ./bec/bec_lib[dev] + uv pip install --system -e ./bec/bec_ipython_client + uv pip install --system -e ./bec/bec_server[dev] + uv pip install --system -e ./bec_widgets[dev,pyside6] + uv pip install --system -e ./bec_testing_plugin + + - name: Run Pytest with Coverage + id: coverage + run: pytest --random-order --cov=./bec_testing_plugin --cov-config=./bec_testing_plugin/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./bec_testing_plugin/tests/ || test $? -eq 5 diff --git a/bec_testing_plugin/macros/README.md b/bec_testing_plugin/macros/README.md new file mode 100644 index 0000000..3777499 --- /dev/null +++ b/bec_testing_plugin/macros/README.md @@ -0,0 +1,6 @@ +# Macros + +This directory is intended to store macros which will be loaded automatically when starting BEC. +Macros are small functions to make repetitive tasks easier. Functions defined in python files in this directory will be accessible from the BEC console. +Please do not put any code outside of function definitions here. If you wish for code to be automatically run when starting BEC, see the startup script at bec_testing_plugin/bec_ipython_client/startup/post_startup.py +For a guide on writing macros, please see: https://bec.readthedocs.io/en/latest/user/command_line_interface.html#how-to-write-a-macro diff --git a/bec_testing_plugin/macros/__init__.py b/bec_testing_plugin/macros/__init__.py new file mode 100644 index 0000000..e69de29