Skip to content

Commit 6099e49

Browse files
Update multilingual programming language monitoring
1 parent 53a6776 commit 6099e49

4 files changed

Lines changed: 117 additions & 2 deletions

File tree

.github/workflows/example-executability.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
- name: Install baseline package
2626
run: |
2727
python -m pip install --upgrade pip
28-
BASELINE_VERSION=$(python -c 'import pathlib, re; text = pathlib.Path("README.md").read_text(encoding="utf-8"); print(re.search(r"This repo is aligned with `multilingualprogramming` `([^`]+)`\.", text).group(1))')
29-
python -m pip install "multilingualprogramming==${BASELINE_VERSION}"
28+
python -m pip install -r requirements-build.txt
3029
3130
- name: Validate release metadata
3231
run: python tools/check_release.py
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Monitor multilingual compatibility
2+
3+
on:
4+
schedule:
5+
- cron: "45 5 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
jobs:
13+
compat:
14+
name: Compatibility (${{ matrix.channel.name }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
channel:
20+
- name: pinned
21+
install_command: python -m pip install -r requirements-build.txt
22+
- name: latest
23+
install_command: python -m pip install multilingualprogramming
24+
- name: upstream-main
25+
install_command: python -m pip install "multilingualprogramming @ git+https://github.com/johnsamuelwrites/multilingual.git@main"
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.12"
34+
35+
- name: Install monitored package
36+
run: |
37+
python -m pip install --upgrade pip
38+
${{ matrix.channel.install_command }}
39+
40+
- name: Capture dependency metadata
41+
env:
42+
CHANNEL_NAME: ${{ matrix.channel.name }}
43+
run: |
44+
python - <<'PY'
45+
import json
46+
import os
47+
import pathlib
48+
import subprocess
49+
50+
data = {
51+
"channel": os.environ["CHANNEL_NAME"],
52+
"pip_freeze": subprocess.check_output(["python", "-m", "pip", "freeze"], text=True).splitlines(),
53+
}
54+
try:
55+
from multilingualprogramming.version import __version__
56+
data["multilingual_version"] = __version__
57+
except Exception as exc:
58+
data["multilingual_version_error"] = str(exc)
59+
60+
out = pathlib.Path("build")
61+
out.mkdir(exist_ok=True)
62+
path = out / f"multilingual-metadata-{os.environ['CHANNEL_NAME']}.json"
63+
path.write_text(json.dumps(data, indent=2), encoding="utf-8")
64+
print(path.read_text(encoding="utf-8"))
65+
PY
66+
67+
- name: Validate release metadata
68+
run: python tools/check_release.py
69+
70+
- name: Check local links
71+
run: python tools/check_links.py
72+
73+
- name: Execute all example programs
74+
run: python tools/check_examples.py
75+
76+
- name: Upload metadata artifact
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: playground-multilingual-${{ matrix.channel.name }}
81+
path: build/multilingual-metadata-${{ matrix.channel.name }}.json
82+
83+
notifier:
84+
name: Open issue on scheduled failure
85+
if: failure() && github.event_name == 'schedule'
86+
runs-on: ubuntu-latest
87+
needs: compat
88+
89+
steps:
90+
- name: Create or update compatibility issue
91+
uses: actions/github-script@v7
92+
with:
93+
script: |
94+
const title = 'Compatibility alert: multilingual monitor failed';
95+
const { owner, repo } = context.repo;
96+
const existing = await github.rest.issues.listForRepo({ owner, repo, state: 'open', per_page: 100 });
97+
const match = existing.data.find((issue) => issue.title === title);
98+
const body = [
99+
'The scheduled multilingual compatibility monitor failed.',
100+
'',
101+
`Workflow: ${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`,
102+
`Date: ${new Date().toISOString()}`,
103+
'',
104+
'Check the `latest` and `upstream-main` jobs first to find the regression source.',
105+
].join('\n');
106+
107+
if (match) {
108+
await github.rest.issues.createComment({ owner, repo, issue_number: match.number, body });
109+
return;
110+
}
111+
112+
await github.rest.issues.create({ owner, repo, title, body, labels: ['bug'] });

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ The main document is a thin shell. Playground styles live in `assets/playground.
3636

3737
## Release validation
3838

39+
The pinned CI baseline lives in `requirements-build.txt`.
40+
3941
This release line is checked in two ways:
4042

4143
- `python tools/check_examples.py` executes all bundled example programs in each supported source language.
4244
- GitHub Actions runs `.github/workflows/example-executability.yml` on pushes and pull requests.
45+
- A scheduled compatibility workflow also checks the pinned baseline, the latest published package, and upstream `main`.
4346

4447
## Content maintenance
4548

requirements-build.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
multilingualprogramming==0.6.0

0 commit comments

Comments
 (0)