Repository navigation
92 lines (87 loc) · 3.09 KB
/
Copy pathcheck_api_updates.yml
File metadata and controls
92 lines (87 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Check MTProto API Schema Updates
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
push:
paths:
- 'compiler/**'
- 'dev_tools/check_api_schema_updates.py'
- 'tests/test_*schema*.py'
- 'tests/test_layer_compatibility.py'
- '.github/workflows/check_api_updates.yml'
pull_request:
paths:
- 'compiler/**'
- 'dev_tools/check_api_schema_updates.py'
- 'tests/test_*schema*.py'
- 'tests/test_layer_compatibility.py'
- '.github/workflows/check_api_updates.yml'
permissions:
contents: read
concurrency:
group: mtproto-schema-${{ github.ref }}
cancel-in-progress: true
jobs:
check-schema-updates:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: '0.13.6'
python-version: '3.11'
enable-cache: true
- name: Install dependencies
run: uv sync --locked --all-extras --dev
- name: Validate checked-in generation and compatibility offline
run: uv run --locked python dev_tools/check_api_schema_updates.py --validate
- name: Detect upstream drift
id: drift
run: |
status=0
uv run --locked python dev_tools/check_api_schema_updates.py \
--report schema-update.md --json-report schema-update.json || status=$?
echo "status=$status" >> "$GITHUB_OUTPUT"
case "$status" in
0|2) ;;
*) exit "$status" ;;
esac
- name: Validate the pinned candidate before producing a patch
if: steps.drift.outputs.status == '2'
run: |
uv run --locked python - <<'PY'
import json
import subprocess
from pathlib import Path
source = json.loads(Path('schema-update.json').read_text())['provenance']
subprocess.run([
'uv', 'run', '--locked', 'python', 'dev_tools/check_api_schema_updates.py',
'--apply', '--revision', source['desktop']['revision'],
'--tdlib-revision', source['tdlib']['revision'],
'--report', 'schema-update.md', '--json-report', 'schema-update.json',
], check=True)
PY
git diff --binary -- compiler/api/source > schema-update.patch
- name: Publish adoption report and validation results
if: always()
run: |
if [ -f schema-update.md ]; then
cat schema-update.md >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload report and validated candidate patch
if: always()
uses: actions/upload-artifact@v4
with:
name: mtproto-schema-report
path: |
schema-update.md
schema-update.json
schema-update.patch
if-no-files-found: ignore
- name: Signal protocol drift for maintainer review
if: steps.drift.outputs.status == '2'
run: |
echo '::error::MTProto schema drift detected. Review the report, compatibility tests, RPC errors, and candidate patch in the workflow artifacts.'
exit 1