mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-22 13:37:32 +08:00
* ci: streamline pull request checks and run the full matrix daily Refs #3055 * ci: run runtime contracts only on affected Core checks * test(ci): distinguish SDK checks from SDK publication * fix(ci): retain legacy regressions and scope production image builds * docs(ci): clarify focused regressions and production image selection
92 lines
3.3 KiB
YAML
92 lines
3.3 KiB
YAML
name: Plugins / Misc plugin tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "plugins/pytest.ini"
|
|
- "plugins/misc/**"
|
|
- ".github/workflows/plugins-misc-tests.yml"
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: plugin-misc-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
defaults:
|
|
run:
|
|
working-directory: plugins
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- uses: astral-sh/setup-uv@v5
|
|
|
|
# Each misc plugin imports its own modules through sys.path tricks, so every
|
|
# suite runs in its own interpreter and its own environment; requirements.txt
|
|
# is the per-plugin dependency declaration (manifests do not carry them).
|
|
- name: Run every misc plugin suite in isolation
|
|
run: |
|
|
set -uo pipefail
|
|
status=0
|
|
ran=0
|
|
for plugin in misc/*/; do
|
|
plugin="${plugin%/}"
|
|
name="$(basename "$plugin")"
|
|
if [ ! -d "$plugin/tests" ]; then
|
|
echo "::notice::$name has no tests/ directory; skipped"
|
|
continue
|
|
fi
|
|
ran=$((ran + 1))
|
|
env_dir="$RUNNER_TEMP/venv-$name"
|
|
echo "=== $name ==="
|
|
if ! uv venv "$env_dir" --python 3.11 >/dev/null; then
|
|
echo "::error::$name test environment could not be created"
|
|
status=1
|
|
continue
|
|
fi
|
|
python_bin="$env_dir/bin/python"
|
|
install_args=(--python "$python_bin"
|
|
'https://files.pythonhosted.org/packages/f2/c7/c870377771cbe27e047b19778b5f249b15efef52409358901af94d13e6c0/langbot_plugin-0.7.4-py3-none-any.whl#sha256=596ecd776c13efa6f6cfe178463dc4a967653238548c9569195cdbb5aa47506e'
|
|
pytest pytest-asyncio)
|
|
if [ -s "$plugin/requirements.txt" ]; then
|
|
install_args+=(-r "$plugin/requirements.txt")
|
|
fi
|
|
# Plugins that need a newer SDK pin it in their own requirements-dev.txt.
|
|
if [ -s "$plugin/requirements-dev.txt" ]; then
|
|
install_args=(--python "$python_bin" -r "$plugin/requirements-dev.txt")
|
|
fi
|
|
if ! uv pip install "${install_args[@]}" >/dev/null; then
|
|
echo "::error::$name dependencies could not be installed"
|
|
status=1
|
|
continue
|
|
fi
|
|
if [ ! -s "$plugin/requirements-dev.txt" ]; then
|
|
if ! "$python_bin" -c 'from importlib.metadata import version; assert version("langbot-plugin") == "0.7.4"'; then
|
|
echo "::error::$name did not use the expected released SDK"
|
|
status=1
|
|
continue
|
|
fi
|
|
fi
|
|
if ! (cd "$plugin" && "$python_bin" -m pytest tests -q -p no:cacheprovider); then
|
|
echo "::error::$name test suite failed"
|
|
status=1
|
|
fi
|
|
done
|
|
if [[ "$ran" -eq 0 ]]; then
|
|
echo "::error::No misc plugin suites were found"
|
|
status=1
|
|
fi
|
|
echo "Attempted $ran misc suites"
|
|
exit $status
|