mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
Merge pull request #31 from D-Modem/claude/project-thread-qq4o90
AT command reference: follow D-Modem's, with each bump
This commit is contained in:
6 files changed
+77
-6
No files matched your search
@@ -1,4 +1,5 @@
|
||||
# docs: every function documented (tools/doc_check.py).
|
||||
# docs: every function documented (tools/doc_check.py), and the app's AT
|
||||
# command reference D-Modem's (tools/at_reference.py).
|
||||
# build: the APK (all four ABIs), the unit tests and lint.
|
||||
# native: the native engine on the runner against a dmodemd over loopback
|
||||
# SIP (native-test).
|
||||
@@ -61,6 +62,9 @@ jobs:
|
||||
- name: Every function documented
|
||||
run: python3 tools/doc_check.py
|
||||
|
||||
- name: The AT command reference is D-Modem's
|
||||
run: python3 tools/at_reference.py --check
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
# (a hung test ends here, not at GitHub's 6 hours)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# D-Modem bump: moves the external/d-modem-re submodule to D-Modem's
|
||||
# latest main and opens (or updates) a pull request for it, set to merge
|
||||
# latest main, with the AT command reference that comes with it (the
|
||||
# app's assets' copy, tools/at_reference.py), and opens (or updates) a pull request for it, set to merge
|
||||
# by itself once its checks pass. Daily, by hand (Actions > D-Modem bump >
|
||||
# Run workflow), or from D-Modem (a repository_dispatch of type
|
||||
# "d-modem-main", for when its main changes).
|
||||
@@ -70,6 +71,7 @@ jobs:
|
||||
exit 0
|
||||
fi
|
||||
git -C external/d-modem-re checkout --quiet "$new"
|
||||
python3 tools/at_reference.py
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
{
|
||||
echo 'log<<EOF'
|
||||
@@ -86,9 +88,9 @@ jobs:
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git checkout -B "$BRANCH"
|
||||
git add external/d-modem-re
|
||||
git add external/d-modem-re app/src/main/assets/docs
|
||||
git commit -m "Bump D-Modem to ${NEW:0:7}" \
|
||||
-m "external/d-modem-re: ${OLD:0:7} -> ${NEW:0:7} (D-Modem's main)." \
|
||||
-m "external/d-modem-re: ${OLD:0:7} -> ${NEW:0:7} (D-Modem's main), and its AT command reference." \
|
||||
-m "Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
|
||||
git push --force origin "$BRANCH"
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
`at_commands.pdf` is D-Modem's AT command reference, the A5 manual:
|
||||
`docs/at_commands.pdf` in [D-Modem/D-Modem](https://github.com/D-Modem/D-Modem),
|
||||
built from `docs/at/at_commands.tex` (`docs/at/build.sh`). This copy is
|
||||
from its main at 7f53883. When the manual changes, copy the new PDF here.
|
||||
from its main at 3f7d6b2. `tools/at_reference.py` copies it from the D-Modem submodule
|
||||
(`external/d-modem-re`); the D-Modem bump workflow runs it with each bump,
|
||||
and CI's docs job fails when this copy isn't the submodule's.
|
||||
|
||||
The app shows it in Settings, AT commands, and from the terminal's menu
|
||||
(`ui/AtReference.kt`).
|
||||
Binary file not shown.
+2
-1
@@ -61,7 +61,8 @@ CI (`.github/workflows/android.yml`) runs all three, and that check; it needs a
|
||||
`DMODEM_TOKEN` secret that can read the private D-Modem submodule.
|
||||
|
||||
`.github/workflows/d-modem-bump.yml` keeps the submodule on D-Modem's
|
||||
main: daily (or by hand) it opens a pull request that moves it, set to
|
||||
main: daily (or by hand) it opens a pull request that moves it, with the
|
||||
AT command reference in the app's assets (`tools/at_reference.py`), set to
|
||||
merge once CI passes. It needs a `DMODEM_BUMP_TOKEN` secret (its header
|
||||
says which permissions).
|
||||
|
||||
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright (C) 2026 Neo-Desktop
|
||||
#
|
||||
# at_reference.py - the app's AT command reference (its assets'
|
||||
# docs/at_commands.pdf) from the D-Modem submodule's
|
||||
# docs/at_commands.pdf, and the commit its README names
|
||||
#
|
||||
# tools/at_reference.py copies it, if it differs
|
||||
# tools/at_reference.py --check exit 1 if the app's copy is not the
|
||||
# submodule's
|
||||
"""The app's AT command reference from the D-Modem submodule's."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
DMODEM = os.path.join(ROOT, "external", "d-modem-re")
|
||||
SOURCE = os.path.join(DMODEM, "docs", "at_commands.pdf")
|
||||
ASSET = os.path.join(ROOT, "app", "src", "main", "assets", "docs", "at_commands.pdf")
|
||||
README = os.path.join(ROOT, "app", "src", "main", "assets", "docs", "README.md")
|
||||
|
||||
|
||||
def read(path):
|
||||
"""A file's bytes."""
|
||||
with open(path, "rb") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def commit():
|
||||
"""The submodule's commit, short."""
|
||||
return subprocess.run(["git", "-C", DMODEM, "rev-parse", "--short=7", "HEAD"],
|
||||
check=True, capture_output=True, text=True).stdout.strip()
|
||||
|
||||
|
||||
def main():
|
||||
"""Copy (or with --check, compare) the PDF; 1 when --check finds it stale."""
|
||||
if not os.path.exists(SOURCE):
|
||||
sys.exit(f"{SOURCE} not found: git submodule update --init external/d-modem-re")
|
||||
new = read(SOURCE)
|
||||
if new == read(ASSET):
|
||||
print("AT command reference: up to date")
|
||||
return 0
|
||||
if "--check" in sys.argv[1:]:
|
||||
print("AT command reference: the app's copy is not D-Modem's "
|
||||
"(tools/at_reference.py copies it)", file=sys.stderr)
|
||||
return 1
|
||||
with open(ASSET, "wb") as f:
|
||||
f.write(new)
|
||||
with open(README, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
text = re.sub(r"from its main at [0-9a-f]+\.", f"from its main at {commit()}.", text)
|
||||
with open(README, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
print(f"AT command reference: copied from D-Modem {commit()}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user