feat: update repo with copier template for gitea migration
This commit is contained in:
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
# It is needed to track the repo template version, and editing may break things.
|
# It is needed to track the repo template version, and editing may break things.
|
||||||
# This file will be overwritten by copier on template updates.
|
# This file will be overwritten by copier on template updates.
|
||||||
|
|
||||||
_commit: v0.3.3
|
_commit: v1.2.2
|
||||||
_src_path: https://github.com/bec-project/plugin_copier_template.git
|
_src_path: https://github.com/bec-project/plugin_copier_template.git
|
||||||
|
make_commit: false
|
||||||
project_name: superxas_bec
|
project_name: superxas_bec
|
||||||
widget_plugins_input: []
|
widget_plugins_input: []
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
name: CI for superxas_bec
|
||||||
|
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/superxas_bec
|
||||||
|
ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
|
||||||
|
path: ./superxas_bec
|
||||||
|
|
||||||
|
- 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 ./superxas_bec
|
||||||
|
|
||||||
|
- name: Run Pytest with Coverage
|
||||||
|
id: coverage
|
||||||
|
run: pytest --random-order --cov=./superxas_bec --cov-config=./superxas_bec/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./superxas_bec/tests/ || test $? -eq 5
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
_exclude:
|
|
||||||
- ".gitea/"
|
|
||||||
- ".git/"
|
|
||||||
- "CHANGELOG.md"
|
|
||||||
# imports
|
|
||||||
|
|
||||||
_jinja_extensions:
|
|
||||||
- bec_lib.utils.copier_jinja_filters.CopierFilters
|
|
||||||
|
|
||||||
# predefined values
|
|
||||||
# make sure these have 'when: false' so that the questions are not asked and the items are not saved in answers.yml
|
|
||||||
|
|
||||||
test_directories:
|
|
||||||
type: str
|
|
||||||
multiselect: true
|
|
||||||
default: ["tests_bec_ipython_client", "tests_bec_widgets", "tests_dap_services", "tests_devices", "tests_file_writer", "tests_scans"]
|
|
||||||
when: false
|
|
||||||
|
|
||||||
copyright_year:
|
|
||||||
type: int
|
|
||||||
default: 2025
|
|
||||||
when: false
|
|
||||||
|
|
||||||
# questions
|
|
||||||
|
|
||||||
project_name:
|
|
||||||
type: str
|
|
||||||
help: What is your project name?
|
|
||||||
|
|
||||||
widget_plugins_input:
|
|
||||||
# Defines the list of plugin widgets, following:
|
|
||||||
# - name: widget name in snake case
|
|
||||||
# use_ui: whether to generate a .ui file
|
|
||||||
type: yaml
|
|
||||||
multiline: true
|
|
||||||
default: []
|
|
||||||
|
|
||||||
# derived from questions: single point of configuration for plugin class names etc.
|
|
||||||
|
|
||||||
widget_plugins:
|
|
||||||
type: yaml
|
|
||||||
multiline: true
|
|
||||||
default: >
|
|
||||||
{% if not widget_plugins_input %} []
|
|
||||||
{% else %}
|
|
||||||
{% for wp in widget_plugins_input %}
|
|
||||||
- module: {{ wp.name }} # Module name for the whole plugin
|
|
||||||
class: {{ wp.name | snake_to_pascal }} # Class name for the plugin widget
|
|
||||||
use_ui: {{ wp.use_ui }} # Whether to create a .ui file and import it
|
|
||||||
{% if wp.use_ui %}
|
|
||||||
ui_module: {{ wp.name }}_ui # Module name for the compiled python UI
|
|
||||||
ui_class: Ui_{{ wp.name | snake_to_pascal }} # Class name for the compiled python UI
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
when: false
|
|
||||||
|
|
||||||
|
|
||||||
# other configuration
|
|
||||||
|
|
||||||
ui_fileinfo: # would like to save this programatically when generated but don't see how
|
|
||||||
type: yaml
|
|
||||||
multiline: true
|
|
||||||
default: >
|
|
||||||
{% if not widget_plugins %} []
|
|
||||||
{% else %}
|
|
||||||
{% for wp in widget_plugins %}
|
|
||||||
{% if wp.use_ui %}
|
|
||||||
- ui_file: {{ project_name }}/bec_widgets/widgets/{{ wp.module }}/{{ wp.module }}.ui
|
|
||||||
out_file: {{ project_name }}/bec_widgets/widgets/{{ wp.module }}/{{ wp.ui_module }}.py
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
when: false
|
|
||||||
|
|
||||||
_tasks:
|
|
||||||
- "git init --initial-branch=main"
|
|
||||||
- >
|
|
||||||
{% if not ui_fileinfo %} echo "No .ui files to process"
|
|
||||||
{% else %}
|
|
||||||
{% for info in ui_fileinfo %}pyside6-uic {{ info.ui_file }} -o {{ info.out_file }};
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
- "git add -A; git commit -a -m 'Init repo {{ project_name }} at template version {{ _commit }}'"
|
|
||||||
@@ -3,8 +3,12 @@ Pre-startup script for BEC client. This script is executed before the BEC client
|
|||||||
is started. It can be used to add additional command line arguments.
|
is started. It can be used to add additional command line arguments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from bec_lib.service_config import ServiceConfig
|
from bec_lib.service_config import ServiceConfig
|
||||||
|
|
||||||
|
import superxas_bec
|
||||||
|
|
||||||
|
|
||||||
def extend_command_line_args(parser):
|
def extend_command_line_args(parser):
|
||||||
"""
|
"""
|
||||||
@@ -16,8 +20,13 @@ def extend_command_line_args(parser):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
# def get_config() -> ServiceConfig:
|
def get_config() -> ServiceConfig:
|
||||||
# """
|
"""
|
||||||
# Create and return the service configuration.
|
Create and return the ServiceConfig for the plugin repository
|
||||||
# """
|
"""
|
||||||
# return ServiceConfig(redis={"host": "localhost", "port": 6379})
|
deployment_path = os.path.dirname(os.path.dirname(os.path.dirname(superxas_bec.__file__)))
|
||||||
|
files = os.listdir(deployment_path)
|
||||||
|
if "bec_config.yaml" in files:
|
||||||
|
return ServiceConfig(config_path=os.path.join(deployment_path, "bec_config.yaml"))
|
||||||
|
else:
|
||||||
|
return ServiceConfig(redis={"host": "localhost", "port": 6379})
|
||||||
|
|||||||
@@ -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 superxas_bec/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
|
||||||
Reference in New Issue
Block a user