From a71480a4ae3e5f76e832bab9f89f68716194da3d Mon Sep 17 00:00:00 2001 From: csh Date: Wed, 12 Aug 2026 08:34:19 +0800 Subject: [PATCH] :wrench: chore(workflow): require Python 3.11 in runners --- .gitea/workflows/checks.yml | 8 ++++---- .gitea/workflows/prepare.yml | 5 +++-- .gitea/workflows/sync-tsl-playbook.yml | 2 +- .gitea/workflows/update-thirdparty-skills.yml | 13 +++++++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/checks.yml b/.gitea/workflows/checks.yml index d2d60173..9bf59d5e 100644 --- a/.gitea/workflows/checks.yml +++ b/.gitea/workflows/checks.yml @@ -118,7 +118,7 @@ jobs: # 注:经 workflow_run 触发,事件 payload 为 workflow_run,不含 PR title; # lint 脚本会回落到 head commit message 校验(PR 标题本身不再校验)。 echo "🔍 检查 commit message 规范(上游事件: $SOURCE_EVENT)..." - python3 .gitea/ci/commit_message_lint.py + python3.11 .gitea/ci/commit_message_lint.py echo "✅ Lint 检查通过" - name: 🧪 运行全量测试 @@ -135,14 +135,14 @@ jobs: npm ci --ignore-scripts --no-audit --no-fund --no-bin-links echo "📋 覆盖:CLI、subtree/snapshot 部署路线、模板同步、文档一致性" - python3 -m unittest discover -s test -p "test_*.py" -v + python3.11 -m unittest discover -s test -p "test_*.py" -v echo "✅ Python 测试通过" echo "========================================" echo "🧭 TSL Syntax Reference 结构检查" echo "========================================" - python3 skills/tsl-syntax-reference/scripts/lookup.py --check + python3.11 skills/tsl-syntax-reference/scripts/lookup.py --check echo "✅ TSL Syntax Reference 结构检查通过" echo "========================================" @@ -156,7 +156,7 @@ jobs: echo "🔗 文档链接检查" echo "========================================" - python3 test/integration/check_doc_links.py + python3.11 test/integration/check_doc_links.py echo "✅ 文档链接检查通过" echo "🎉 所有测试完成" diff --git a/.gitea/workflows/prepare.yml b/.gitea/workflows/prepare.yml index a0c57eca..4cf23461 100644 --- a/.gitea/workflows/prepare.yml +++ b/.gitea/workflows/prepare.yml @@ -41,13 +41,14 @@ jobs: declare -A package_for=( [git]="git" [python3]="python3" + [python3.11]="python3.11" [curl]="curl" [flock]="util-linux" [realpath]="coreutils" [node]="nodejs" [npm]="npm" ) - required_commands=(git python3 curl flock realpath node npm) + required_commands=(git python3 python3.11 curl flock realpath node npm) missing_commands=() missing_packages=() declare -A seen_packages=() @@ -91,7 +92,7 @@ jobs: fi done - python3 -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else "Python 3.11 or newer is required")' + python3.11 -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else "Python 3.11 or newer is required")' { echo "## Prepare 环境" diff --git a/.gitea/workflows/sync-tsl-playbook.yml b/.gitea/workflows/sync-tsl-playbook.yml index 987c08db..51b9b6f3 100644 --- a/.gitea/workflows/sync-tsl-playbook.yml +++ b/.gitea/workflows/sync-tsl-playbook.yml @@ -154,7 +154,7 @@ jobs: trap cleanup EXIT bundle="$build_dir/tsl-playbook" - python3 "$BUILD_SCRIPT" --output "$bundle" + python3.11 "$BUILD_SCRIPT" --output "$bundle" # 本 workflow 在目标分支上仅拥有以下路径。 managed_paths=( diff --git a/.gitea/workflows/update-thirdparty-skills.yml b/.gitea/workflows/update-thirdparty-skills.yml index 3609adfb..ea5ff510 100644 --- a/.gitea/workflows/update-thirdparty-skills.yml +++ b/.gitea/workflows/update-thirdparty-skills.yml @@ -129,6 +129,9 @@ jobs: run: | set -euo pipefail cd "$REPO_DIR" + PYTHON_BIN="${PYTHON_BIN:-$(command -v python3.11 || command -v python3)}" + "$PYTHON_BIN" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else "Python 3.11 or newer is required")' + export PYTHON_BIN echo "========================================" echo "📦 Refresh thirdparty/skill snapshots" @@ -216,7 +219,7 @@ jobs: } emit_sources_tsv() { - python3 - "$MANIFEST_PATH" <<'PY' + "$PYTHON_BIN" - "$MANIFEST_PATH" <<'PY' import json import sys @@ -419,9 +422,11 @@ jobs: THIRDPARTY_BRANCH="${THIRDPARTY_BRANCH:-thirdparty/skill}" TARGET_BRANCH="${TARGET_BRANCH:-main}" MANIFEST_PATH="${MANIFEST_PATH:-.gitea/ci/thirdparty_skills.json}" + PYTHON_BIN="${PYTHON_BIN:-$(command -v python3.11 || command -v python3)}" + "$PYTHON_BIN" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else "Python 3.11 or newer is required")' emit_sources_tsv() { - python3 - "$MANIFEST_PATH" <<'PY' + "$PYTHON_BIN" - "$MANIFEST_PATH" <<'PY' import json import sys @@ -464,7 +469,7 @@ jobs: local data_dir_rel="$5" local scripts_dir_rel="$6" - python3 - "$snapshot_root" "$output_dir" "$platform_config_rel" "$template_root_rel" "$data_dir_rel" "$scripts_dir_rel" <<'PY' + "$PYTHON_BIN" - "$snapshot_root" "$output_dir" "$platform_config_rel" "$template_root_rel" "$data_dir_rel" "$scripts_dir_rel" <<'PY' import json import pathlib import shutil @@ -566,7 +571,7 @@ jobs: local output_dir="$2" local include_paths="$3" - python3 - "$snapshot_root" "$output_dir" "$include_paths" <<'PY' + "$PYTHON_BIN" - "$snapshot_root" "$output_dir" "$include_paths" <<'PY' import os import pathlib import shutil