refactor: separate actions in substructure, run as bash script
This commit is contained in:
36
checkout_repositories/action.yml
Normal file
36
checkout_repositories/action.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: "BEC Plugin Repository Checkout"
|
||||
description: "Install and test a BEC plugin repository"
|
||||
inputs:
|
||||
PLUGIN_REPO_NAME:
|
||||
description: "URL of the BEC Plugin Repository to install"
|
||||
required: true
|
||||
default: ""
|
||||
BEC_PLUGIN_REPO_BRANCH:
|
||||
description: "Branch of the BEC Plugin Repository to install"
|
||||
required: false
|
||||
default: "main"
|
||||
BEC_CORE_BRANCH:
|
||||
description: "Branch of BEC Core to install"
|
||||
required: false
|
||||
default: "main"
|
||||
BEC_WIDGETS_BRANCH:
|
||||
description: "Branch of BEC Widgets to install"
|
||||
required: false
|
||||
default: "main"
|
||||
OPHYD_DEVICES_BRANCH:
|
||||
description: "Branch of Ophyd Devices to install"
|
||||
required: false
|
||||
default: "main"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout BEC Plugin Repository
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x run_ci.sh
|
||||
./run_ci.sh "${{ inputs.BEC_PLUGIN_REPO_URL }}" \
|
||||
"${{ inputs.BEC_PLUGIN_REPO_BRANCH }}" \
|
||||
"${{ inputs.BEC_CORE_BRANCH }}" \
|
||||
"${{ inputs.BEC_WIDGETS_BRANCH }}" \
|
||||
"${{ inputs.OPHYD_DEVICES_BRANCH }}"
|
||||
63
checkout_repositories/run_ci.sh
Normal file
63
checkout_repositories/run_ci.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PLUGIN_REPO_NAME="https://gitea.psi.ch/bec/$1.git"
|
||||
PLUGIN_BRANCH="$2"
|
||||
CORE_BRANCH="$3"
|
||||
WIDGETS_BRANCH="$4"
|
||||
OPHYD_DEVICES_BRANCH="$5"
|
||||
|
||||
echo "--- Repository checkouts begin ---"
|
||||
|
||||
# --- Step 1: Checkout Plugin ---
|
||||
echo "=== Checkout BEC Plugin ==="
|
||||
mkdir -p ./_plugin_checkout_/
|
||||
cd ./_plugin_checkout_/
|
||||
if git clone --depth 1 --branch "$PLUGIN_BRANCH" "$PLUGIN_URL" plugin_repo; then
|
||||
echo "Plugin checkout successful"
|
||||
else
|
||||
echo "Plugin checkout failed, trying default branch"
|
||||
git clone --depth 1 "$PLUGIN_URL" plugin_repo
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# --- Step 2: Checkout Core ---
|
||||
echo "=== Checkout BEC Core ==="
|
||||
mkdir -p ./_bec_checkout_/
|
||||
cd ./_bec_checkout_/
|
||||
if git clone --depth 1 --branch "$CORE_BRANCH" https://github.com/bec-project/bec.git bec_core; then
|
||||
echo "Core checkout successful"
|
||||
else
|
||||
echo "Core checkout failed, trying default branch"
|
||||
git clone --depth 1 https://github.com/bec-project/bec.git bec_core
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
# --- Step 3: Checkout Widgets ---
|
||||
echo "=== Checkout BEC Widgets ==="
|
||||
mkdir -p ./_bec_widgets_checkout_/
|
||||
cd ./_bec_widgets_checkout_/
|
||||
if git clone --depth 1 --branch "$WIDGETS_BRANCH" https://github.com/bec-project/bec-widgets.git bec_widgets; then
|
||||
echo "Widgets checkout successful"
|
||||
else
|
||||
echo "Widgets checkout failed, trying default branch"
|
||||
git clone --depth 1 https://github.com/bec-project/bec-widgets.git bec_widgets
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
# --- Step 4: Checkout Ophyd Devices ---
|
||||
echo "=== Checkout Ophyd Devices ==="
|
||||
mkdir -p ./_ophyd_devices_checkout_/
|
||||
cd ./_ophyd_devices_checkout_/
|
||||
if git clone --depth 1 --branch "$OPHYD_DEVICES_BRANCH" https://github.com/bec-project/bec-ophyd-devices.git bec_ophyd_devices; then
|
||||
echo "Ophyd Devices checkout successful"
|
||||
else
|
||||
echo "Ophyd Devices checkout failed, trying default branch"
|
||||
git clone --depth 1 https://github.com/bec-project/bec-ophyd-devices.git bec_ophyd_devices
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "--- All checkouts complete ---"
|
||||
16
install_apt_packages/action.yml
Normal file
16
install_apt_packages/action.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
name: "Install APT Packages"
|
||||
description: "Install system packages via apt-get"
|
||||
inputs:
|
||||
APT_PACKAGES:
|
||||
description: "List of system packages to install via apt-get"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install APT Packages
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x run_ci.sh
|
||||
./run_ci.sh "${{ inputs.APT_PACKAGES }}" \
|
||||
14
install_apt_packages/run_ci.sh
Normal file
14
install_apt_packages/run_ci.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
APT_PACKAGES="$1"
|
||||
|
||||
echo "--- Installing APT Packages ---"
|
||||
|
||||
# --- Step 1: Install APT Packages ---
|
||||
echo "=== Install APT Packages ==="
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y $APT_PACKAGES
|
||||
|
||||
echo "=== Completed APT Package Installation ==="
|
||||
24
install_python_env/action.yml
Normal file
24
install_python_env/action.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Install Python Environment
|
||||
description: Set up a Python virtual environment and install required packages
|
||||
inputs:
|
||||
PLUGIN_REPO_NAME:
|
||||
description: "Name of the plugin repository to install dependencies for"
|
||||
required: true
|
||||
default: ""
|
||||
PYTHON_VERSION:
|
||||
description: "Python version to use"
|
||||
required: false
|
||||
default: "3.11"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ inputs.PYTHON_VERSION }}
|
||||
- name: Install Python Environment
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x run_ci.sh
|
||||
./run_ci.sh "${{ inputs.PLUGIN_REPO_NAME }}"
|
||||
21
install_python_env/run_ci.sh
Normal file
21
install_python_env/run_ci.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PLUGIN_REPO_NAME="$1"
|
||||
|
||||
echo "--- Installing Python Environment ---"
|
||||
|
||||
# --- Step 1: Install Python Packages ---
|
||||
echo "=== Install Python Environment ==="
|
||||
echo "Running on Python version $(python -V)"
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
pip install uv
|
||||
uv pip install --system -e ./_bec_checkout_/bec/bec_lib/[dev]
|
||||
uv pip install --system -e ./_bec_checkout_/bec/bec_ipython_client
|
||||
uv pip install --system -e ./_bec_checkout_/bec/bec_server[dev]
|
||||
uv pip install --system -e ./_bec_widgets_checkout_/bec_widgets[dev,pyside6]
|
||||
uv pip install --system -e ./_ophyd_devices_checkout_/ophyd_devices[dev]
|
||||
pip install -e "./_plugin_checkout_/${PLUGIN_REPO_NAME}[dev]"
|
||||
|
||||
echo "=== Completed Python Environment Installation ==="
|
||||
16
run_pytest_for_plugin/action.yml
Normal file
16
run_pytest_for_plugin/action.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
name: Run Pytest for Plugin
|
||||
description: "Run pytest for the specified BEC plugin repository"
|
||||
inputs:
|
||||
PLUGIN_REPO_NAME:
|
||||
description: "Name of the plugin repository to run tests for"
|
||||
required: true
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Run Pytest for Plugin
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x run_ci.sh
|
||||
./run_ci.sh "${{ inputs.PLUGIN_REPO_NAME }}"
|
||||
13
run_pytest_for_plugin/run_ci.sh
Normal file
13
run_pytest_for_plugin/run_ci.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PLUGIN_REPO_NAME="$1"
|
||||
|
||||
echo "--- Running Pytest for Plugin: $PLUGIN_REPO_NAME ---"
|
||||
|
||||
cd ./_plugin_checkout_/"$PLUGIN_REPO_NAME"
|
||||
|
||||
# --- Step 1: Run Pytest ---
|
||||
pytest --random-order --cov=. --cov-config=./pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./tests/ || test $? -eq 5
|
||||
|
||||
echo "=== Completed Pytest for Plugin: $PLUGIN_REPO_NAME ==="
|
||||
Reference in New Issue
Block a user