Merge pull request #105 from FredApps/fix/shared-appimage-cli-check

Run AppImage CLI regression checks in shared packaging lint
This commit is contained in:
FredApps authored and GitHub committed 2026-11-13 21:10:46 +01:00
commit 82834fe754
3 files changed
+54

No files matched your search

+3
View File
@@ -276,6 +276,9 @@ Lints all packaging configurations and metadata:
- `appstreamcli validate`
- Flatpak manifest consistency checks
- FreeBSD dry run & embedded icons verification
- AppImage desktop integration and bundled CLI/MCP tests, when the caller provides
`packaging/linux/apprun-test.sh` or `packaging/linux/apprun-cli-test.sh`. No app-local
workflow job is needed; a failing script fails the shared lint job.
#### Caller Example:
```yaml
+7
View File
@@ -67,6 +67,13 @@ runs:
bash packaging/linux/apprun-test.sh
fi
- name: AppImage bundled CLI and MCP entry point
shell: bash
run: |
if [ -f packaging/linux/apprun-cli-test.sh ]; then
bash packaging/linux/apprun-cli-test.sh
fi
- name: Linux tarball installer test
shell: bash
run: |
+44
View File
@@ -0,0 +1,44 @@
"""Exercise the shared AppImage CLI hook without building an app."""
from pathlib import Path
import subprocess
import tempfile
import unittest
import yaml
ROOT = Path(__file__).resolve().parents[1]
ACTION = yaml.safe_load((ROOT / 'actions/packaging-lint/action.yml').read_text())
STEP = next(s for s in ACTION['runs']['steps'] if s['name'] == 'AppImage bundled CLI and MCP entry point')
class PackagingCliTests(unittest.TestCase):
def run_hook(self, script=None):
with tempfile.TemporaryDirectory(prefix='packaging hook ') as directory:
root = Path(directory)
if script is not None:
target = root / 'packaging/linux/apprun-cli-test.sh'
target.parent.mkdir(parents=True)
target.write_text(script)
result = subprocess.run(['bash', '-e', '-o', 'pipefail', '-c', STEP['run']],
cwd=root, capture_output=True, text=True, timeout=10)
ran = (root / 'ran').exists()
return result, ran
def test_missing_hook_is_optional(self):
result, ran = self.run_hook()
self.assertEqual(result.returncode, 0, result.stderr)
self.assertFalse(ran)
def test_hook_runs_in_the_caller_checkout_without_executable_bit(self):
result, ran = self.run_hook('printf "CLI hook ran\\n"; touch ran\n')
self.assertEqual(result.returncode, 0, result.stderr)
self.assertTrue(ran)
self.assertIn('CLI hook ran', result.stdout)
def test_failure_is_not_swallowed(self):
result, _ = self.run_hook('echo "CLI regression" >&2; exit 37\n')
self.assertEqual(result.returncode, 37)
self.assertIn('CLI regression', result.stderr)
if __name__ == '__main__':
unittest.main()