refactor: add log outputs to jobs

This commit is contained in:
2025-09-23 23:15:21 -05:00
parent aef6872b48
commit 19d1220eae

View File

@@ -63,66 +63,101 @@ runs:
echo "PLUGIN_REPO_NAME=${PLUGIN_REPO_NAME}" >> $GITHUB_ENV #$GITEA_ENV
echo "Plugin repository name: $PLUGIN_REPO_NAME"
echo "Exit Code: 0" >> $LOG_FILE
- name: Checkout BEC Core
shell: bash
id: bec_core_checkout
run: |
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/checkout_bec_core.log"
echo "Cloning BEC Core repository" >> $LOG_FILE 2>&1
echo "Using branch: ${{ inputs.BEC_CORE_BRANCH }}" >> $LOG_FILE 2>&1
# Create a temporary directory for the plugin repository
mkdir -p ./_bec_checkout_/
cd ./_bec_checkout_/
# Clone the repository with fallback for branch
if git clone --depth 1 --branch "${{ inputs.BEC_CORE_BRANCH }}" https://github.com/bec-project/bec.git; then
echo "Successfully cloned with branch ${{ inputs.BEC_CORE_BRANCH }}"
if git clone --depth 1 --branch "${{ inputs.BEC_CORE_BRANCH }}" https://github.com/bec-project/bec.git >> $LOG_FILE 2>&1; then
echo "Successfully cloned with branch ${{ inputs.BEC_CORE_BRANCH }}" >> $LOG_FILE 2>&1
else
echo "Failed to clone with branch ${{ inputs.BEC_CORE_BRANCH }}, trying without specific branch"
git clone --depth 1 https://github.com/bec-project/bec.git
echo "Failed to clone with branch ${{ inputs.BEC_CORE_BRANCH }}, trying without specific branch" >> $LOG_FILE 2>&1
git clone --depth 1 https://github.com/bec-project/bec.git >> $LOG_FILE 2>&1
fi
echo "Exit Code: 0" >> $LOG_FILE
cd ../
- name: Install Ophyd Devices
shell: bash
id: ophyd_devices_checkout
run: |
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/checkout_ophyd_devices.log"
# Create a temporary directory for the plugin repository
mkdir -p ./_ophyd_devices_checkout_/
cd ./_ophyd_devices_checkout_/
echo "Cloning Ophyd Devices repository" >> $LOG_FILE 2>&1
echo "Using branch: ${{ inputs.OPHYD_DEVICES_BRANCH }}" >> $LOG_FILE 2>&1
# Clone the repository with fallback for branch
if git clone --depth 1 --branch "${{ inputs.OPHYD_DEVICES_BRANCH }}" https://github.com/bec-project/ophyd_devices.git; then
echo "Successfully cloned with branch ${{ inputs.OPHYD_DEVICES_BRANCH }}"
if git clone --depth 1 --branch "${{ inputs.OPHYD_DEVICES_BRANCH }}" https://github.com/bec-project/ophyd_devices.git >> $LOG_FILE 2>&1; then
echo "Successfully cloned with branch ${{ inputs.OPHYD_DEVICES_BRANCH }}" >> $LOG_FILE 2>&1
else
echo "Failed to clone with branch ${{ inputs.OPHYD_DEVICES_BRANCH }}, trying without specific branch"
git clone --depth 1 https://github.com/bec-project/ophyd_devices.git
echo "Failed to clone with branch ${{ inputs.OPHYD_DEVICES_BRANCH }}, trying without specific branch" >> $LOG_FILE 2>&1
git clone --depth 1 https://github.com/bec-project/ophyd_devices.git >> $LOG_FILE 2>&1
fi
echo "Exit Code: 0" >> $LOG_FILE
cd ../
- name: Install BEC Widgets
shell: bash
id: bec_widgets_checkout
run: |
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/checkout_bec_widgets.log"
# Create a temporary directory for the plugin repository
mkdir -p ./_bec_widgets_checkout_/
cd ./_bec_widgets_checkout_/
echo "Cloning BEC Widgets repository" >> $LOG_FILE 2>&1
echo "Using branch: ${{ inputs.BEC_WIDGETS_BRANCH }}" >> $LOG_FILE 2>&1
# Clone the repository with fallback for branch
if git clone --depth 1 --branch "${{ inputs.BEC_WIDGETS_BRANCH }}" https://github.com/bec-project/bec_widgets.git; then
echo "Successfully cloned with branch ${{ inputs.BEC_WIDGETS_BRANCH }}"
if git clone --depth 1 --branch "${{ inputs.BEC_WIDGETS_BRANCH }}" https://github.com/bec-project/bec_widgets.git >> $LOG_FILE 2>&1; then
echo "Successfully cloned with branch ${{ inputs.BEC_WIDGETS_BRANCH }}" >> $LOG_FILE 2>&1
else
echo "Failed to clone with branch ${{ inputs.BEC_WIDGETS_BRANCH }}, trying without specific branch"
git clone --depth 1 https://github.com/bec-project/bec_widgets.git
echo "Failed to clone with branch ${{ inputs.BEC_WIDGETS_BRANCH }}, trying without specific branch" >> $LOG_FILE 2>&1
git clone --depth 1 https://github.com/bec-project/bec_widgets.git >> $LOG_FILE 2>&1
fi
echo "Exit Code: 0" >> $LOG_FILE
cd ../
- name: Install APT_PACKAGES
if: ${{ inputs.APT_PACKAGES != '' }}
shell: bash
run: |
echo "Installing additional APT packages: ${{ inputs.APT_PACKAGES }}"
sudo apt-get update
sudo apt-get install -y ${{ inputs.APT_PACKAGES }}
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/install_apt_packages.log"
echo "Installing additional APT packages: ${{ inputs.APT_PACKAGES }}" >> $LOG_FILE 2>&1
sudo apt-get update >> $LOG_FILE 2>&1
sudo apt-get install -y ${{ inputs.APT_PACKAGES }} >> $LOG_FILE 2>&1
- name: Setup Python
uses: actions/setup-python@v4
@@ -132,26 +167,52 @@ runs:
- name: Install Python dependencies
shell: bash
run: |
python -m pip install --upgrade pip
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/install_python_dependencies.log"
echo "Installing Python dependencies" >> $LOG_FILE 2>&1
echo "Using Python version: $(python --version)" >> $LOG_FILE 2>&1
python -m pip install --upgrade pip >> $LOG_FILE 2>&1
# Install Core dependencies
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 uv >> $LOG_FILE 2>&1
uv pip install --system -e ./_bec_checkout_/bec/bec_lib/[dev] >> $LOG_FILE 2>&1
uv pip install --system -e ./_bec_checkout_/bec/bec_ipython_client >> $LOG_FILE 2>&1
uv pip install --system -e ./_bec_checkout_/bec/bec_server[dev] >> $LOG_FILE 2>&1
uv pip install --system -e ./_bec_widgets_checkout_/bec_widgets[dev,pyside6] >> $LOG_FILE 2>&1
uv pip install --system -e ./_ophyd_devices_checkout_/ophyd_devices[dev] >> $LOG_FILE 2>&1
# plugin repo name was stored earlier
source $GITHUB_ENV
pip install -e "./_plugin_checkout_/${PLUGIN_REPO_NAME}[dev]"
pip install -e "./_plugin_checkout_/${PLUGIN_REPO_NAME}[dev]" >> $LOG_FILE 2>&1
echo "Exit Code: 0" >> $LOG_FILE
- name: Run pytest for Plugin
shell: bash
run: |
# Create log directory
OUTPUT_DIR="$PWD/outputs" # absolute path
LOG_FILE="${OUTPUT_DIR}/pytest_plugin.log"
echo "Running pytest for plugin repository" >> $LOG_FILE 2>&1
source $GITHUB_ENV
cd "./_plugin_checkout_/${PLUGIN_REPO_NAME}"
pytest --random-order --cov=. --cov-config=./pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./tests/ || test $? -eq 5
# run pytest and capture its exit code
pytest --random-order --cov=. --cov-config=./pyproject.toml \
--cov-branch --cov-report=xml --no-cov-on-fail ./tests/ \
>> "$LOG_FILE" 2>&1 || rc=$?
# pytest --random-order --cov=. --cov-config=./pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./tests/ || test $? -eq 5 >> $LOG_FILE 2>&1
rc=${rc:-0}
if [ "$rc" -eq 0 ] || [ "$rc" -eq 5 ]; then
echo "Exit Code: 0" >> $LOG_FILE
else
echo "Exit Code: $rc" >> $LOG_FILE
fi
# - name: Checkout BEC Core