Skip to content

Commit 40278c7

Browse files
committed
TMP: publish final-UI screenshots as annotations
1 parent ab36844 commit 40278c7

2 files changed

Lines changed: 48 additions & 26 deletions

File tree

‎.github/workflows/tmp_watch_assist_publish.yml‎

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,97 @@
11
name: TMP Watch Assist screenshots publish
22

33
on:
4+
push:
5+
branches:
6+
- watch-assist-push-to-talk-screenshots
7+
paths:
8+
- .github/workflows/tmp_watch_assist_publish.yml
49
workflow_dispatch:
5-
inputs:
6-
run_id:
7-
description: Run id holding the watch-assist-screenshots-2 artifact
8-
required: true
9-
artifact:
10-
description: Artifact name
11-
required: false
12-
default: watch-assist-screenshots-2
1310

1411
permissions:
1512
contents: read
1613
actions: read
1714

15+
env:
16+
SOURCE_RUN_ID: "37156491365"
17+
SOURCE_ARTIFACT: watch-assist-screenshots-2
18+
1819
jobs:
1920
publish:
2021
runs-on: ubuntu-latest
2122
timeout-minutes: 10
2223
steps:
2324
- uses: actions/download-artifact@v4
2425
with:
25-
name: ${{ inputs.artifact }}
26-
run-id: ${{ inputs.run_id }}
26+
name: ${{ env.SOURCE_ARTIFACT }}
27+
run-id: ${{ env.SOURCE_RUN_ID }}
2728
github-token: ${{ secrets.GITHUB_TOKEN }}
2829
path: artifact
2930

3031
- name: Encode screenshots
3132
run: |
32-
ls -laR artifact/screenshots
33-
python3 -c "import PIL" 2>/dev/null || pip install --quiet pillow
33+
ls -laR artifact
34+
pip install --quiet pillow
3435
python3 - <<'PY'
35-
import base64, hashlib, pathlib, io
36+
import base64, hashlib, io, pathlib
3637
from PIL import Image
3738
out = pathlib.Path("encoded"); out.mkdir(exist_ok=True)
39+
summary = []
3840
for png in sorted(pathlib.Path("artifact/screenshots").glob("*.png")):
41+
raw = png.read_bytes()
3942
im = Image.open(png).convert("RGB")
40-
buf = io.BytesIO(); im.save(buf, "JPEG", quality=80, optimize=True)
41-
data = buf.getvalue()
42-
b64 = base64.b64encode(data).decode()
43+
for quality in (85, 75, 65, 55, 45):
44+
buf = io.BytesIO(); im.save(buf, "JPEG", quality=quality, optimize=True)
45+
b64 = base64.b64encode(buf.getvalue()).decode()
46+
if len(b64) <= 72000:
47+
break
4348
(out / f"{png.stem}.b64").write_text(b64)
44-
print(png.stem, im.size, len(data), "bytes jpeg", len(b64), "b64", hashlib.sha256(data).hexdigest()[:16])
49+
colors = len(set(im.getdata()))
50+
summary.append(f"{png.stem} size={im.size} png={len(raw)} pngsha={hashlib.sha256(raw).hexdigest()[:12]} colors={colors} jpegq={quality} b64={len(b64)}")
51+
text = " | ".join(summary)
52+
print(text)
53+
print(f"::notice title=img-summary::{text}")
4554
PY
4655
56+
- name: App logs
57+
run: |
58+
for f in artifact/logs/*.log; do
59+
[ -s "$f" ] || continue
60+
body=$(tail -c 3000 "$f" | tr '\n' ' ' | tr -d '\r')
61+
echo "::notice title=applog $(basename "$f")::$body"
62+
done
63+
4764
- name: Annotate idle
4865
run: |
49-
f=encoded/idle.b64; [ -e "$f" ] || exit 0
50-
python3 - "$f" <<'PY'
66+
python3 - encoded/idle.b64 <<'PY'
5167
import sys, zlib, pathlib
52-
p = pathlib.Path(sys.argv[1]); s = p.read_text(); n = 3800
68+
p = pathlib.Path(sys.argv[1])
69+
if not p.exists(): sys.exit(0)
70+
s = p.read_text(); n = 8000
5371
chunks = [s[i:i+n] for i in range(0, len(s), n)]
5472
for i, c in enumerate(chunks, 1):
5573
print(f"::notice title=img {p.stem} {i}/{len(chunks)} crc={zlib.crc32(c.encode()):08x}::{c}")
5674
PY
5775
5876
- name: Annotate recording-tap
5977
run: |
60-
f=encoded/recording-tap.b64; [ -e "$f" ] || exit 0
61-
python3 - "$f" <<'PY'
78+
python3 - encoded/recording-tap.b64 <<'PY'
6279
import sys, zlib, pathlib
63-
p = pathlib.Path(sys.argv[1]); s = p.read_text(); n = 3800
80+
p = pathlib.Path(sys.argv[1])
81+
if not p.exists(): sys.exit(0)
82+
s = p.read_text(); n = 8000
6483
chunks = [s[i:i+n] for i in range(0, len(s), n)]
6584
for i, c in enumerate(chunks, 1):
6685
print(f"::notice title=img {p.stem} {i}/{len(chunks)} crc={zlib.crc32(c.encode()):08x}::{c}")
6786
PY
6887
6988
- name: Annotate recording-release
7089
run: |
71-
f=encoded/recording-release.b64; [ -e "$f" ] || exit 0
72-
python3 - "$f" <<'PY'
90+
python3 - encoded/recording-release.b64 <<'PY'
7391
import sys, zlib, pathlib
74-
p = pathlib.Path(sys.argv[1]); s = p.read_text(); n = 3800
92+
p = pathlib.Path(sys.argv[1])
93+
if not p.exists(): sys.exit(0)
94+
s = p.read_text(); n = 8000
7595
chunks = [s[i:i+n] for i in range(0, len(s), n)]
7696
for i, c in enumerate(chunks, 1):
7797
print(f"::notice title=img {p.stem} {i}/{len(chunks)} crc={zlib.crc32(c.encode()):08x}::{c}")

‎.github/workflows/tmp_watch_assist_screenshots.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- watch-assist-push-to-talk-screenshots
7+
paths:
8+
- "Sources/**"
79
workflow_dispatch:
810

911
permissions:

0 commit comments

Comments
 (0)