Skip to content

Commit 3b6e40f

Browse files
Update multilingual programming language monitoring
1 parent 255e323 commit 3b6e40f

File tree

5 files changed

+131
-3
lines changed

5 files changed

+131
-3
lines changed

.github/workflows/docs-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install Python dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
python -m pip install pytest PyYAML multilingualprogramming
28+
python -m pip install pytest PyYAML -r requirements-build.txt
2929
3030
- name: Validate multilingual docs metadata
3131
run: python scripts/validate_multilingual_docs.py --strict-freshness

.github/workflows/docs-deploy-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: Install Python dependencies
4141
run: |
4242
python -m pip install --upgrade pip
43-
python -m pip install PyYAML multilingualprogramming
43+
python -m pip install PyYAML -r requirements-build.txt
4444
4545
- name: Validate multilingual docs metadata
4646
run: python scripts/validate_multilingual_docs.py --strict-freshness
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Docs multilingual compatibility monitor
2+
3+
on:
4+
schedule:
5+
- cron: "40 5 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
jobs:
13+
compat:
14+
name: Docs 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 Python dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
python -m pip install pytest PyYAML
39+
${{ matrix.channel.install_command }}
40+
41+
- name: Capture dependency metadata
42+
env:
43+
CHANNEL_NAME: ${{ matrix.channel.name }}
44+
run: |
45+
python - <<'PY'
46+
import json
47+
import os
48+
import pathlib
49+
import subprocess
50+
51+
data = {
52+
"channel": os.environ["CHANNEL_NAME"],
53+
"pip_freeze": subprocess.check_output(["python", "-m", "pip", "freeze"], text=True).splitlines(),
54+
}
55+
try:
56+
from multilingualprogramming.version import __version__
57+
data["multilingual_version"] = __version__
58+
except Exception as exc:
59+
data["multilingual_version_error"] = str(exc)
60+
61+
out = pathlib.Path("build")
62+
out.mkdir(exist_ok=True)
63+
path = out / f"multilingual-metadata-{os.environ['CHANNEL_NAME']}.json"
64+
path.write_text(json.dumps(data, indent=2), encoding="utf-8")
65+
print(path.read_text(encoding="utf-8"))
66+
PY
67+
68+
- name: Validate multilingual docs metadata
69+
run: python scripts/validate_multilingual_docs.py --strict-freshness
70+
71+
- name: Run docs tests
72+
run: python -m pytest _tests -q
73+
74+
- name: Set up Ruby
75+
uses: ruby/setup-ruby@v1
76+
with:
77+
ruby-version: "3.3"
78+
bundler-cache: true
79+
80+
- name: Build Jekyll site
81+
run: bundle exec jekyll build --baseurl "/docs"
82+
83+
- name: Check internal links
84+
run: python scripts/check_internal_links.py --site-dir _site --base-path /docs
85+
86+
- name: Check Pages artifact
87+
run: python scripts/check_pages_artifact.py --site-dir _site --base-path /docs
88+
89+
- name: Upload metadata artifact
90+
if: always()
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: docs-multilingual-${{ matrix.channel.name }}
94+
path: build/multilingual-metadata-${{ matrix.channel.name }}.json
95+
96+
notifier:
97+
name: Open issue on scheduled failure
98+
if: failure() && github.event_name == 'schedule'
99+
runs-on: ubuntu-latest
100+
needs: compat
101+
102+
steps:
103+
- name: Create or update compatibility issue
104+
uses: actions/github-script@v7
105+
with:
106+
script: |
107+
const title = 'Compatibility alert: docs monitor failed against multilingual';
108+
const { owner, repo } = context.repo;
109+
const existing = await github.rest.issues.listForRepo({ owner, repo, state: 'open', per_page: 100 });
110+
const match = existing.data.find((issue) => issue.title === title);
111+
const body = [
112+
'The scheduled multilingual compatibility monitor for the docs site failed.',
113+
'',
114+
`Workflow: ${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`,
115+
`Date: ${new Date().toISOString()}`,
116+
'',
117+
'Check the `latest` and `upstream-main` jobs first to see whether the regression is upstream or in the docs assumptions.',
118+
].join('\n');
119+
120+
if (match) {
121+
await github.rest.issues.createComment({ owner, repo, issue_number: match.number, body });
122+
return;
123+
}
124+
125+
await github.rest.issues.create({ owner, repo, title, body, labels: ['bug'] });

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Prerequisites:
3939
Install the Python package used by the docs tests:
4040

4141
```bash
42-
pip install multilingualprogramming
42+
pip install -r requirements-build.txt
4343
```
4444

4545
Install dependencies:
@@ -77,6 +77,8 @@ bundle exec jekyll build
7777
3. Run `bundle exec jekyll serve` and verify pages render correctly.
7878
4. Submit a pull request.
7979

80+
The stable docs-test baseline for `multilingualprogramming` is pinned in `requirements-build.txt`, and a scheduled compatibility workflow also checks the latest published package and upstream `main`.
81+
8082
For multilingual EN/FR documentation operations (metadata model, localized routing, snippets, CI checks, and Pages-safe deploy), see [contributing/multilingual-docs.md](contributing/multilingual-docs.md).
8183

8284
For language/runtime contribution workflow, see `contributing/` and the [main repository](https://github.com/johnsamuelwrites/multilingual).

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)