Skip to content

Commit e3c1b72

Browse files
Update monitoring language
1 parent 2e4d90b commit e3c1b72

7 files changed

Lines changed: 223 additions & 20 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
name: Compiler WASM et déployer sur GitHub Pages
1616

1717
on:
18+
pull_request:
19+
branches: ["main"]
1820
push:
1921
branches: ["main"]
2022
workflow_dispatch:
@@ -56,7 +58,7 @@ jobs:
5658
- name: Installer multilingualprogramming[wasm]
5759
run: |
5860
pip install --upgrade pip
59-
pip install "multilingualprogramming[wasm]"
61+
pip install -r requirements-build.txt
6062
6163
- name: Vérifier l'installation WASM
6264
run: |
@@ -134,6 +136,7 @@ jobs:
134136
# ──────────────────────────────────────────────────────────
135137
deploy:
136138
name: Déployer sur GitHub Pages
139+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
137140
environment:
138141
name: github-pages
139142
url: ${{ steps.deployment.outputs.page_url }}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Surveiller la compatibilite multilingual
2+
3+
on:
4+
schedule:
5+
- cron: "30 5 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
jobs:
13+
compat:
14+
name: Compatibilite multilingual (${{ matrix.channel.name }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
channel:
20+
- name: pinned
21+
install_command: pip install -r requirements-build.txt
22+
- name: latest
23+
install_command: pip install "multilingualprogramming[wasm]"
24+
- name: upstream-main
25+
install_command: pip install "multilingualprogramming[wasm] @ git+https://github.com/johnsamuelwrites/multilingual.git@main"
26+
27+
steps:
28+
- name: Cloner le depot
29+
uses: actions/checkout@v4
30+
31+
- name: Configurer Python 3.12
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.12"
35+
36+
- name: Configurer Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: "20"
40+
41+
- name: Installer les dependances de build
42+
run: |
43+
pip install --upgrade pip
44+
${{ matrix.channel.install_command }}
45+
46+
- name: Capturer la version multilingual
47+
env:
48+
CHANNEL_NAME: ${{ matrix.channel.name }}
49+
run: |
50+
python - <<'PY'
51+
import json
52+
import os
53+
import pathlib
54+
import subprocess
55+
56+
metadata = {
57+
"channel": os.environ["CHANNEL_NAME"],
58+
"pip_freeze": subprocess.check_output(["python", "-m", "pip", "freeze"], text=True).splitlines(),
59+
}
60+
try:
61+
from multilingualprogramming.version import __version__
62+
metadata["multilingual_version"] = __version__
63+
except Exception as exc:
64+
metadata["multilingual_version_error"] = str(exc)
65+
66+
out = pathlib.Path("build")
67+
out.mkdir(exist_ok=True)
68+
path = out / f"multilingual-metadata-{os.environ['CHANNEL_NAME']}.json"
69+
path.write_text(json.dumps(metadata, indent=2), encoding="utf-8")
70+
print(path.read_text(encoding="utf-8"))
71+
PY
72+
73+
- name: Compiler le bundle WASM
74+
run: python scripts/compile_wasm.py
75+
76+
- name: Verifier les checks d'integration
77+
run: python scripts/integration_checks.py
78+
79+
- name: Verifier les smoke tests UI
80+
run: python scripts/ui_smoke_checks.py
81+
82+
- name: Verifier la syntaxe JavaScript
83+
run: |
84+
node --check public/js/renderer.js
85+
node --check public/js/renderer-source-panel.js
86+
node --check public/js/renderer-bookmarks.js
87+
node --check public/js/renderer-export.js
88+
89+
- name: Verifier l'instanciation WASM
90+
run: |
91+
node - <<'NODE'
92+
const fs = require('fs');
93+
const bytes = fs.readFileSync('public/mandelbrot.wasm');
94+
WebAssembly.instantiate(bytes, {
95+
env: {
96+
memory: new WebAssembly.Memory({ initial: 16, maximum: 1024 }),
97+
print_str() {},
98+
print_f64() {},
99+
print_bool() {},
100+
print_sep() {},
101+
print_newline() {},
102+
pow_f64(base, exponent) { return Math.pow(base, exponent); },
103+
},
104+
}).then(({ instance }) => {
105+
const required = ['mandelbrot','julia','burning_ship','tricorn','multibrot','celtic','buffalo','perpendicular_burning_ship','newton','phoenix','barnsley','sierpinski','koch','magnet1','magnet2','lambda_fractale'];
106+
const exports = instance.exports;
107+
const missing = required.filter((name) => typeof exports[name] !== 'function');
108+
if (missing.length) {
109+
console.error('Exports manquants:', missing.join(', '));
110+
process.exit(1);
111+
}
112+
console.log('WASM smoke test OK');
113+
}).catch((err) => {
114+
console.error(err);
115+
process.exit(1);
116+
});
117+
NODE
118+
119+
- name: Archiver les metadonnees
120+
if: always()
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: multilingual-metadata-${{ matrix.channel.name }}
124+
path: build/multilingual-metadata-${{ matrix.channel.name }}.json
125+
126+
notifier:
127+
name: Ouvrir une alerte si la surveillance echoue
128+
if: failure() && github.event_name == 'schedule'
129+
runs-on: ubuntu-latest
130+
needs: compat
131+
132+
steps:
133+
- name: Creer ou reutiliser une issue de compatibilite
134+
uses: actions/github-script@v7
135+
with:
136+
script: |
137+
const title = 'Alerte compatibilite: multilingual a casse la surveillance nocturne';
138+
const { owner, repo } = context.repo;
139+
const existing = await github.rest.issues.listForRepo({
140+
owner,
141+
repo,
142+
state: 'open',
143+
per_page: 100,
144+
});
145+
const match = existing.data.find((issue) => issue.title === title);
146+
const body = [
147+
'La surveillance planifiee de compatibilite avec `multilingual` a echoue.',
148+
'',
149+
`Workflow: ${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`,
150+
`Date: ${new Date().toISOString()}`,
151+
'',
152+
'Verifier en priorite les jobs `latest` et `upstream-main` pour identifier la regression.',
153+
].join('\n');
154+
155+
if (match) {
156+
await github.rest.issues.createComment({
157+
owner,
158+
repo,
159+
issue_number: match.number,
160+
body,
161+
});
162+
return;
163+
}
164+
165+
await github.rest.issues.create({
166+
owner,
167+
repo,
168+
title,
169+
body,
170+
labels: ['bug'],
171+
});

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Prérequis recommandés :
88

99
- Python 3.12+
1010
- Node.js 20+
11-
- La dépendance Python `multilingualprogramming[wasm]`
11+
- La dépendance Python épinglée dans `requirements-build.txt`
1212

1313
Installation minimale :
1414

1515
```bash
16-
pip install "multilingualprogramming[wasm]"
16+
pip install -r requirements-build.txt
1717
```
1818

1919
Lancer l'application localement :
@@ -78,6 +78,9 @@ python scripts\integration_checks.py
7878
python scripts\ui_smoke_checks.py
7979
```
8080

81+
Pour tester volontairement une copie locale de `multilingual`, définissez
82+
`MULTILINGUAL_DEV_PATH` avant de lancer `compile_wasm.py`.
83+
8184
Ordre important : `compile_wasm.py` régénère des artefacts dans `public/`. Relancez ensuite les checks sur les fichiers générés.
8285

8386
## Attentes pour les pull requests

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ index.html
278278
### Prérequis
279279

280280
```bash
281-
pip install "multilingualprogramming[wasm]"
281+
pip install -r requirements-build.txt
282282
```
283283

284284
Outils recommandés pour le développement local :
@@ -299,6 +299,14 @@ node --check public/js/renderer-bookmarks.js
299299
node --check public/js/renderer-export.js
300300
```
301301

302+
Pour tester explicitement une copie locale du depot `multilingual` au lieu de la
303+
version epinglee :
304+
305+
```powershell
306+
$env:MULTILINGUAL_DEV_PATH="..\\multilingual"
307+
python scripts/compile_wasm.py
308+
```
309+
302310
### Serveur local
303311

304312
```bash
@@ -444,10 +452,15 @@ La séparation des rôles reste volontaire :
444452
git push origin main
445453
```
446454

447-
Le workflow Actions installe Python 3.12, `multilingualprogramming[wasm]`,
455+
Le workflow Actions installe Python 3.12 et la version epinglee dans
456+
`requirements-build.txt`,
448457
exécute `python scripts/compile_wasm.py`, les tests d'intégration, et déploie
449458
`public/` sur GitHub Pages.
450459

460+
Un workflow planifie surveille aussi la compatibilite avec la version epinglee,
461+
la derniere version publiee et la branche `main` du depot amont
462+
`johnsamuelwrites/multilingual`.
463+
451464
Configurez Pages via : **Settings → Pages → Source : GitHub Actions**.
452465

453466
---

requirements-build.txt

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

scripts/compile_wasm.ml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importer io
22
importer json
3+
importer os
34
importer shutil
45
importer sys
56
importer importlib
@@ -24,12 +25,17 @@ soit SEPARATEUR = "=" * 62
2425
soit MODULES_WASM = ["fractales_escape", "fractales_dynamique", "fractales_variantes", "fractales_ifs", "fractales_lsystem", "fractales_magnetiques", "fractales_export", "fractales_classes_compat", "fractales_lisse", "fractales_orbitrap"]
2526

2627
déf ajouter_depot_multilingual_au_chemin():
27-
soit candidats = [RACINE.parent / "multilingual", Path.home() / "Documents" / "Research" / "Workspace" / "multilingual"]
28-
pour candidat dans candidats:
29-
si (candidat / "multilingualprogramming" / "__init__.py").exists():
30-
si non (str(candidat) dans sys.path):
31-
sys.path.insert(0, str(candidat))
32-
retour
28+
soit chemin_dev = os.environ.get("MULTILINGUAL_DEV_PATH", "").strip()
29+
si non chemin_dev:
30+
retour
31+
32+
soit candidat = Path(chemin_dev).expanduser()
33+
si non candidat.is_absolute():
34+
candidat = (RACINE / candidat).resolve()
35+
si non (candidat / "multilingualprogramming" / "__init__.py").exists():
36+
lever RuntimeError(f"MULTILINGUAL_DEV_PATH ne pointe pas vers un depot multilingual valide: {candidat}")
37+
si non (str(candidat) dans sys.path):
38+
sys.path.insert(0, str(candidat))
3339

3440
déf transpiler_strict(source):
3541
ajouter_depot_multilingual_au_chemin()

scripts/compile_wasm.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@
22
"""Strict launcher: transpile scripts/compile_wasm.ml and execute main()."""
33

44
import io
5+
import os
56
import sys
67
from pathlib import Path
78

89

910
def ajouter_depot_multilingual_au_chemin(racine: Path) -> None:
10-
candidats = [
11-
racine.parent / "multilingual",
12-
Path.home() / "Documents" / "Research" / "Workspace" / "multilingual",
13-
]
14-
for candidat in candidats:
15-
if (candidat / "multilingualprogramming" / "__init__.py").exists():
16-
if str(candidat) not in sys.path:
17-
sys.path.insert(0, str(candidat))
18-
return
11+
chemin_dev = os.environ.get("MULTILINGUAL_DEV_PATH", "").strip()
12+
if not chemin_dev:
13+
return
14+
15+
candidat = Path(chemin_dev).expanduser()
16+
if not candidat.is_absolute():
17+
candidat = (racine / candidat).resolve()
18+
if not (candidat / "multilingualprogramming" / "__init__.py").exists():
19+
raise RuntimeError(
20+
"MULTILINGUAL_DEV_PATH ne pointe pas vers un depot multilingual valide: "
21+
f"{candidat}"
22+
)
23+
if str(candidat) not in sys.path:
24+
sys.path.insert(0, str(candidat))
1925

2026

2127
def main() -> None:

0 commit comments

Comments
 (0)