CI for mx_bec / unit tests with pxii_bec (pull_request) Successful in 1m33s
CI for mx_bec / unit tests with pxi_bec (pull_request) Failing after 1m51s
CI for mx_bec / e2e tests with pxii_bec (pull_request) Successful in 1m54s
CI for mx_bec / unit tests with pxiii_bec (pull_request) Failing after 1m41s
CI for mx_bec / unit tests with pxi_bec (push) Failing after 1m40s
CI for mx_bec / e2e tests with pxii_bec (push) Successful in 1m42s
CI for mx_bec / unit tests with pxii_bec (push) Successful in 1m20s
CI for mx_bec / unit tests with pxiii_bec (push) Failing after 2m10s
CI for mx_bec / e2e tests with pxi_bec (pull_request) Failing after 3h0m5s
CI for mx_bec / e2e tests with pxiii_bec (pull_request) Failing after 3h0m4s
CI for mx_bec / e2e tests with pxi_bec (push) Failing after 3h0m4s
CI for mx_bec / e2e tests with pxiii_bec (push) Failing after 3h0m3s
174 lines
6.2 KiB
YAML
174 lines
6.2 KiB
YAML
name: CI for mx_bec
|
|
on:
|
|
# Pushes only trigger on main; every other branch is tested through its pull request, so that a
|
|
# push to a branch with an open pull request does not run everything twice.
|
|
push:
|
|
branches: [main]
|
|
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"
|
|
BEAMLINE_PLUGIN_BRANCH:
|
|
description: "Branch of the beamline plugins (pxi_bec, pxii_bec, pxiii_bec) to install"
|
|
required: false
|
|
type: string
|
|
default: "main"
|
|
PYTHON_VERSION:
|
|
description: "Python version to use"
|
|
required: false
|
|
type: string
|
|
default: "3.12"
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: "${{ matrix.suite }} tests with ${{ matrix.plugin }}"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# unit: tests/unit; e2e: tests/e2e, against BEC servers running the simulated beamline
|
|
suite: [unit, e2e]
|
|
# BEC works with exactly one beamline plugin installed, which is what the device server
|
|
# loads the mx_bec devices through: run against each of them individually
|
|
plugin: [pxi_bec, pxii_bec, pxiii_bec]
|
|
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.12' }}"
|
|
|
|
- name: Checkout BEC Plugin Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: bec/mx_bec
|
|
ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
|
|
path: ./mx_bec
|
|
|
|
- name: Lint for merge conflicts from template updates
|
|
shell: bash
|
|
# Find all Copier conflicts except this line
|
|
run: '! grep -r "<<<<<<< before updating" | grep -v "grep -r \"<<<<<<< before updating"'
|
|
|
|
# Use the same-named branch of the beamline plugin if it exists (e.g. a feature developed in both repos), otherwise main.
|
|
- name: Resolve beamline plugin branch
|
|
id: plugin
|
|
shell: bash
|
|
run: |
|
|
ref="${{ inputs.BEAMLINE_PLUGIN_BRANCH || github.head_ref || github.ref_name }}"
|
|
auth="$(printf 'x-access-token:%s' '${{ github.token }}' | base64 -w0)"
|
|
if git -c "http.extraheader=Authorization: Basic ${auth}" ls-remote --exit-code --heads \
|
|
"${{ github.server_url }}/bec/${{ matrix.plugin }}.git" "refs/heads/${ref}" >/dev/null; then
|
|
echo "Using ${{ matrix.plugin }} branch '${ref}'"
|
|
else
|
|
echo "${{ matrix.plugin }} has no branch '${ref}', using main"
|
|
ref=main
|
|
fi
|
|
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Checkout beamline plugin
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "bec/${{ matrix.plugin }}"
|
|
ref: "${{ steps.plugin.outputs.ref }}"
|
|
path: "./${{ matrix.plugin }}"
|
|
|
|
- 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: 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
|
|
# the end-to-end tests start their own redis server
|
|
sudo apt-get -y install redis-server
|
|
|
|
- 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/pytest_bec_e2e
|
|
uv pip install --system -e ./bec_widgets[dev]
|
|
# mx_bec pins its MX-internal dependencies (aarecommon, aare_config, ...) as direct URLs
|
|
# to the gitea registry. uv only accepts URL dependencies from packages named on the
|
|
# command line, so mx_bec must be installed together with the plugin which depends on it.
|
|
uv pip install --system -e ./mx_bec[dev] -e ./${{ matrix.plugin }}
|
|
|
|
- name: Run Pytest with Coverage
|
|
if: matrix.suite == 'unit'
|
|
id: coverage
|
|
run: |
|
|
if coverage run --rcfile=./mx_bec/pyproject.toml --branch --source=./mx_bec -m pytest --random-order ./mx_bec/tests/unit; then
|
|
coverage xml --rcfile=./mx_bec/pyproject.toml
|
|
else
|
|
test $? -eq 5
|
|
fi
|
|
|
|
- name: Run end-to-end tests
|
|
if: matrix.suite == 'e2e'
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ./e2e_files
|
|
pytest -v --start-servers --files-path "$PWD/e2e_files" ./mx_bec/tests/e2e
|
|
|
|
- name: Show server logs if the end-to-end tests fail
|
|
if: failure() && matrix.suite == 'e2e'
|
|
shell: bash
|
|
run: |
|
|
shopt -s nullglob
|
|
# the BEC services write their logs next to the bec checkout
|
|
for log in ./e2e_files/*.log ./bec/logs/*.log; do
|
|
echo "::group::${log}"
|
|
tail -n 200 "${log}"
|
|
echo "::endgroup::"
|
|
done
|