mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
# Description of Changes This PR modernizes the project's Python tooling across GitHub Actions by migrating CI workflows from pip-based dependency management to `uv` and aligning Python execution with the engine project's managed environment. ### What was changed - Replaced `actions/setup-python` and ad-hoc `pip install` steps with `astral-sh/setup-uv` across CI workflows. - Configured shared `uv` dependency caching using `engine/pyproject.toml` and `engine/uv.lock`. - Updated Python script execution to use `uv run --project engine --locked` for a consistent runtime environment. - Replaced package installation steps with `uv sync` for the required dependency groups (e.g. `tools` and `cucumber`). - Added Docker image build validation for both production and development AI engine images. - Updated workflow cache configuration and Docker build context where required. - Removed obsolete Python requirements files that are no longer needed after the migration. - Applied minor Python code modernizations, including import cleanup, modern built-in generic type annotations (`list[...]`, `tuple[...]`, `float | None`), and small style improvements. - Removed unnecessary Python formatter/linter extensions from the development container configuration. ### Why the change was made - Standardize Python dependency management across the repository. - Reduce duplicated dependency installation logic in CI. - Improve workflow performance through shared dependency caching. - Ensure all Python utilities execute against the same locked dependency set managed by the engine project. - Simplify long-term maintenance by eliminating legacy requirements files and pip-specific workflow steps. --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have run `task check` to verify linters, typechecks, and tests pass - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details. --------- Signed-off-by: Carsten Drewes <c.drewes@stud.uni-hannover.de> Co-authored-by: albanobattistella <34811668+albanobattistella@users.noreply.github.com> Co-authored-by: kastenherri <116314318+kastenherri@users.noreply.github.com> Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: James Brunton <jbrunton96@gmail.com>
66 lines
2.6 KiB
Bash
66 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Runs the multi-node regression suite (behave features/multinode) against the clustered stack: brings it up if needed, runs non-destructive scenarios then @destructive failover ones, and restores any killed node.
|
|
# Usage: ./run-multinode-regression.sh [--no-failover] [--no-seed]
|
|
# @known_gap scenarios are expected to fail - they mark work not yet done, so a non-zero exit is fine while those are open.
|
|
set -uo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
COMPOSE="docker compose -f docker-compose-multinode.yml"
|
|
CUKE_DIR="../cucumber"
|
|
RUN_FAILOVER=1
|
|
SEED=1
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--no-failover) RUN_FAILOVER=0 ;;
|
|
--no-seed) SEED=0 ;;
|
|
esac
|
|
done
|
|
|
|
echo "==> Ensuring the multi-node stack is up..."
|
|
if ! docker inspect -f '{{.State.Health.Status}}' multinode-stirling-1 2>/dev/null | grep -q healthy; then
|
|
./start-multinode-test.sh $([ "$SEED" = 0 ] && echo --no-seed) || exit 1
|
|
elif [ "$SEED" = 1 ]; then
|
|
echo " stack already up; seeding (idempotent)..."
|
|
$COMPOSE --profile seed run --rm seed >/dev/null 2>&1 || echo " (seed reported issues, continuing)"
|
|
fi
|
|
|
|
echo "==> Checking Python + behave..."
|
|
if ! uv run --project ../../engine --locked --group cucumber python -c "import behave" 2>/dev/null; then
|
|
echo " could not load the central uv cucumber environment"; exit 1
|
|
fi
|
|
|
|
REPORT_DIR="$(pwd)/multinode/regression-report"
|
|
mkdir -p "$REPORT_DIR"
|
|
|
|
run_behave() { # $1=tags $2=label
|
|
echo "==> behave features/multinode --tags='$1' ($2)"
|
|
# behave.ini excludes features/multinode by default; -e here overrides that while still excluding the licence-gated enterprise suite.
|
|
( cd "$CUKE_DIR" && uv run --project ../../engine --locked --group cucumber python -m behave features/multinode -e "features/enterprise" \
|
|
--tags="$1" --no-capture --format plain --format html --outfile "$REPORT_DIR/$2.html" )
|
|
return $?
|
|
}
|
|
|
|
rc=0
|
|
run_behave "~@destructive" "core" || rc=1
|
|
|
|
if [ "$RUN_FAILOVER" = 1 ]; then
|
|
run_behave "@destructive" "failover" || rc=1
|
|
echo "==> Restoring any killed nodes..."
|
|
$COMPOSE up -d >/dev/null 2>&1
|
|
for n in multinode-stirling-1 multinode-stirling-2; do
|
|
for i in $(seq 1 24); do
|
|
[ "$(docker inspect -f '{{.State.Health.Status}}' "$n" 2>/dev/null)" = "healthy" ] && break
|
|
sleep 5
|
|
done
|
|
done
|
|
fi
|
|
|
|
echo
|
|
echo "============================================================"
|
|
echo " Regression run complete. Reports: $REPORT_DIR"
|
|
echo " Exit $rc (non-zero = at least one scenario failed;"
|
|
echo " @known_gap scenarios are expected to fail - see the report)."
|
|
echo " Stack left running: http://localhost:8080 (admin / stirling)"
|
|
echo "============================================================"
|
|
exit $rc
|