mirror of
https://github.com/nyakang/nyaterm.git
synced 2026-11-06 00:07:41 +00:00
Introduced a new job in the GitHub Actions workflow for the Plugin SDK, which includes steps for checking out the repository, setting up Rust with necessary components, installing Linux dependencies, checking formatting, building SDK guests, and verifying the packaged SDK. Updated the Rust gate job dependencies to include the new plugin-sdk job. Additionally, refactored the NyaTermApp to improve the handling of floating panel close actions based on the current panel state, ensuring better user experience. Enhanced plugin management by implementing shutdown procedures and revising invocation checks to include expected revisions, improving stability and error handling during plugin operations. Added comprehensive tests for the plugin service to validate the new functionality and ensure robust performance across various scenarios.
53 lines
2.3 KiB
Python
53 lines
2.3 KiB
Python
"""Repeatable plugin acceptance checks; --workspace adds repository-wide checks."""
|
|
from pathlib import Path
|
|
import argparse
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
import uuid
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--workspace", action="store_true")
|
|
options = parser.parse_args()
|
|
checks = [
|
|
["cargo", "fmt", "--manifest-path", "examples/plugins/guests/Cargo.toml", "--all", "--", "--check"],
|
|
[sys.executable, "scripts/plugins/build.py", "--fixtures"],
|
|
["cargo", "package", "--locked", "-p", "nyaterm-plugin-api", "--allow-dirty"],
|
|
["cargo", "test", "--locked", "-p", "nyaterm-core", "--test", "plugins"],
|
|
["cargo", "test", "--locked", "-p", "nyaterm-store", "plugin_preferences"],
|
|
["cargo", "test", "--locked", "-p", "nyaterm-plugin-host"],
|
|
["cargo", "test", "--locked", "-p", "nyaterm-desktop", "features::plugins"],
|
|
]
|
|
if options.workspace:
|
|
checks += [
|
|
["cargo", "build", "--locked"],
|
|
["cargo", "check", "--locked", "--workspace"],
|
|
["cargo", "test", "--locked", "--workspace"],
|
|
["cargo", "fmt", "--all", "--", "--check"],
|
|
["cargo", "clippy", "--locked", "--workspace", "--all-targets"],
|
|
[sys.executable, "scripts/ci/check_architecture.py"],
|
|
]
|
|
# Each invocation owns its logs, including guest build/packaging failures.
|
|
# Reruns must not erase the evidence from a previous failed check.
|
|
logs = ROOT / "target/plugin-verification" / f"run-{uuid.uuid4().hex}"
|
|
logs.mkdir(parents=True, exist_ok=True)
|
|
results = []
|
|
for index, command in enumerate(checks):
|
|
log = logs / f"{index:02d}.log"
|
|
print("Running " + " ".join(command), flush=True)
|
|
with log.open("w", encoding="utf-8") as stream:
|
|
result = subprocess.run(command, cwd=ROOT, stdout=stream, stderr=subprocess.STDOUT)
|
|
results.append({"command": command, "exit_code": result.returncode, "log": str(log.relative_to(ROOT))})
|
|
(logs / "results.json").write_text(json.dumps(results, indent=2) + "\n", encoding="utf-8")
|
|
print(f"Exit {result.returncode}: {log}", flush=True)
|
|
if any(result["exit_code"] for result in results):
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|