-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (135 loc) · 5.6 KB
/
deploy.yml
File metadata and controls
156 lines (135 loc) · 5.6 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# ============================================================
# Explorateur de Fractales — Déploiement GitHub Pages
#
# Pipeline :
# 1. Installer Python 3.12
# 2. pip install multilingualprogramming[wasm]
# 3. python scripts/compile_wasm.py
# → public/mandelbrot.wasm (binaire WebAssembly)
# → public/benchmark.json (résultats de benchmark)
# → public/mandelbrot_transpiled.py (Python généré)
# → public/mandelbrot.ml (copie du source français)
# 4. Déployer public/ vers GitHub Pages
# ============================================================
name: Compiler WASM et déployer sur GitHub Pages
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
workflow_dispatch:
# Permissions pour le déploiement Pages
permissions:
contents: read
pages: write
id-token: write
# Un seul déploiement à la fois
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# ──────────────────────────────────────────────────────────
# Job 1 : Compilation WASM + génération des artefacts
# ──────────────────────────────────────────────────────────
build:
name: Compiler le source français → WebAssembly
runs-on: ubuntu-latest
steps:
- name: Cloner le dépôt
uses: actions/checkout@v4
- name: Configurer Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Configurer Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Installer multilingualprogramming[wasm]
run: |
pip install --upgrade pip
pip install -r requirements-build.txt
- name: Vérifier l'installation WASM
run: |
python -c "
from multilingualprogramming.runtime.backend_selector import BackendSelector
s = BackendSelector()
backend = getattr(s, 'backend', getattr(s, '_backend', 'inconnu'))
print(f'WASM disponible : {s.is_wasm_available()}')
print(f'Backend actif : {backend}')
"
- name: Compiler le source français vers WebAssembly
run: python scripts/compile_wasm.py
- name: Exécuter les tests d'intégration
run: python scripts/integration_checks.py
- name: Exécuter les smoke tests UI
run: python scripts/ui_smoke_checks.py
- name: Vérifier la syntaxe JavaScript (Node)
run: node --check public/js/renderer.js
- name: Vérifier l'instanciation WASM (Node)
run: |
node -e "
const fs = require('fs');
const bytes = fs.readFileSync('public/mandelbrot.wasm');
WebAssembly.instantiate(bytes, {
env: {
memory: new WebAssembly.Memory({ initial: 16, maximum: 1024 }),
print_str() {},
print_f64() {},
print_bool() {},
print_sep() {},
print_newline() {},
pow_f64(base, exponent) { return Math.pow(base, exponent); },
},
wasi_snapshot_preview1: {
fd_write(fd, iovs, iovs_len, nwritten) { return 0; },
fd_read(fd, iovs, iovs_len, nread) { return 0; },
args_sizes_get(argc, argv_buf_size) { return 0; },
args_get(argv, argv_buf) { return 0; },
proc_exit(code) {},
},
}).then(({ instance }) => {
const required = ['mandelbrot','julia','burning_ship','tricorn','multibrot','celtic','buffalo','perpendicular_burning_ship','newton','phoenix','barnsley','sierpinski','koch','magnet1','magnet2','lambda_fractale'];
const exports = instance.exports;
const missing = required.filter((name) => typeof exports[name] !== 'function');
if (missing.length) {
console.error('Exports manquants:', missing.join(', '));
process.exit(1);
}
console.log('WASM smoke test OK');
}).catch((err) => {
console.error(err);
process.exit(1);
});
"
- name: Vérifier les artefacts générés
run: |
echo "=== Fichiers générés dans public/ ==="
ls -lh public/
echo ""
echo "=== Contenu de benchmark.json ==="
cat public/benchmark.json
echo ""
echo "=== Taille du binaire WASM ==="
wc -c public/mandelbrot.wasm 2>/dev/null || echo "WASM non généré"
- name: Configurer GitHub Pages
uses: actions/configure-pages@v5
- name: Préparer l'artefact Pages
uses: actions/upload-pages-artifact@v3
with:
path: "public"
# ──────────────────────────────────────────────────────────
# Job 2 : Déploiement GitHub Pages
# ──────────────────────────────────────────────────────────
deploy:
name: Déployer sur GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Déployer sur GitHub Pages
id: deployment
uses: actions/deploy-pages@v4