docs(install): 补充 NVIDIA 驱动安装后的重启与排障说明 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Static Checks | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| - name: Check UTF-8 text files | |
| run: | | |
| python3 - <<'PY' | |
| from pathlib import Path | |
| paths = [ | |
| Path("readme.md"), | |
| Path("docs/usage.md"), | |
| Path("docs/maintenance.md"), | |
| Path("CLAUDE.md"), | |
| Path("package_kernel_space/manifest"), | |
| Path("package_user_space/manifest"), | |
| Path("scripts/patch-nvidia-grid-kernel-binary.py"), | |
| ] | |
| failed = False | |
| for path in paths: | |
| try: | |
| text = path.read_text(encoding="utf-8") | |
| except UnicodeDecodeError as exc: | |
| print(f"{path}: invalid UTF-8: {exc}") | |
| failed = True | |
| continue | |
| if "???" in text or "\ufffd" in text: | |
| print(f"{path}: possible mojibake marker found") | |
| failed = True | |
| raise SystemExit(1 if failed else 0) | |
| PY | |
| - name: Check package version consistency | |
| run: | | |
| python3 - <<'PY' | |
| import re | |
| from pathlib import Path | |
| workflow = Path(".github/workflows/test_release.yml").read_text(encoding="utf-8") | |
| package_version_match = re.search(r'this_pack_version: "([^"]+)"', workflow) | |
| driver_version_match = re.search(r'this_pack_nvidia_driver_version: "([^"]+)"', workflow) | |
| if not package_version_match or not driver_version_match: | |
| print("Unable to read this_pack_version or this_pack_nvidia_driver_version from test_release.yml") | |
| raise SystemExit(1) | |
| package_version = package_version_match.group(1) | |
| driver_version = driver_version_match.group(1) | |
| version_pattern = re.compile(rf'{re.escape(driver_version)}-\d+(?![\d.])') | |
| paths = [ | |
| Path("readme.md"), | |
| Path("docs/usage.md"), | |
| Path("docs/maintenance.md"), | |
| Path("CLAUDE.md"), | |
| Path(".github/workflows/test_release.yml"), | |
| ] | |
| failed = False | |
| for path in paths: | |
| text = path.read_text(encoding="utf-8") | |
| for match in sorted(set(version_pattern.findall(text))): | |
| if match != package_version: | |
| print(f"{path}: package version {match} does not match this_pack_version {package_version}") | |
| failed = True | |
| raise SystemExit(1 if failed else 0) | |
| PY | |
| - name: Check Python syntax | |
| run: | | |
| python3 -m py_compile scripts/patch-nvidia-grid-kernel-binary.py | |
| - name: Check shell syntax | |
| run: | | |
| find package_kernel_space/cmd package_user_space/cmd -maxdepth 1 -type f -print0 | | |
| while IFS= read -r -d '' file; do | |
| first_line="$(head -n 1 "$file")" | |
| if [ "$first_line" = "#!/bin/bash" ] || [ "$first_line" = "#!/bin/sh" ]; then | |
| echo "bash -n $file" | |
| bash -n "$file" | |
| fi | |
| done |