|
| 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 | + }); |
0 commit comments