@@ -37,13 +37,23 @@ def append_to_github_output(key, value):
37
37
print (f"GITHUB_OUTPUT not set" )
38
38
print (pair )
39
39
40
+ def get_manifest_dict ():
41
+ with open ("Manifest.toml" , "rb" ) as f :
42
+ manifest_data = tomllib .load (f )
43
+ package_versions = {k : v [0 ].get ("version" , None ) for k , v in manifest_data ["deps" ].items ()}
44
+ return package_versions
45
+
40
46
def setup (_args ):
47
+ # Model keys
41
48
models = run_and_capture ([* JULIA_COMMAND , "--list-model-keys" ]).splitlines ()
42
- adtypes = run_and_capture ([* JULIA_COMMAND , "--list-adtype-keys" ]).splitlines ()
43
49
append_to_github_output ("model_keys" , models )
50
+ # Adtype keys
51
+ adtypes = run_and_capture ([* JULIA_COMMAND , "--list-adtype-keys" ]).splitlines ()
44
52
append_to_github_output ("adtype_keys" , adtypes )
45
- # TODO: Save the Manifest.toml file or at least a mapping of packages ->
46
- # versions, see #9
53
+ # Manifest
54
+ package_versions = get_manifest_dict ()
55
+ append_to_github_output ("manifest" , package_versions )
56
+
47
57
48
58
def run_ad (args ):
49
59
model_key = args .model
@@ -91,12 +101,9 @@ def html(_args):
91
101
("assume_wishart" , "EnzymeForward" ): ENZYME_FWD_BLAS ,
92
102
}
93
103
94
- results = os .environ .get ("RESULTS_JSON" , None )
95
104
96
- if results is None :
97
- print ("RESULTS_JSON not set" )
98
- exit (1 )
99
- else :
105
+ try :
106
+ results = os .environ ["RESULTS_JSON" ]
100
107
print ("-------- $RESULTS_JSON --------" )
101
108
print (results )
102
109
print ("------------- END -------------" )
@@ -118,6 +125,15 @@ def html(_args):
118
125
# We do some processing to turn it into a dict of dicts
119
126
results = json .loads (results )
120
127
results = {entry ["model_name" ]: entry ["results" ] for entry in results }
128
+ except KeyError as e :
129
+ print ("RESULTS_JSON environment variable not set" )
130
+ exit (1 )
131
+
132
+ try :
133
+ manifest = json .loads (os .environ ["MANIFEST" ])
134
+ except KeyError as e :
135
+ print ("MANIFEST environment variable not set, reading from Manifest.toml" )
136
+ manifest = get_manifest_dict ()
121
137
122
138
# You can also process this with pandas. I don't do that here because
123
139
# (1) extra dependency
@@ -175,9 +191,9 @@ def html(_args):
175
191
# Table header
176
192
f .write ('<table id="results"><thead>' )
177
193
f .write ("<tr>" )
178
- f .write (" <th>Model name \\ AD type</th>" )
194
+ f .write (' <th class="right" >Model name \\ AD type</th>' )
179
195
for adtype in adtypes :
180
- f .write (f" <th>{ adtype } </th>" )
196
+ f .write (f' <th class="right" >{ adtype } </th>' )
181
197
f .write ("</tr></thead><tbody>" )
182
198
# Table body
183
199
for model_name in models :
@@ -197,7 +213,14 @@ def html(_args):
197
213
span = f'<a class="issue" href="{ error_url } " target="_blank">(?)</a> { span } '
198
214
f .write (f'<td>{ span } </td>' )
199
215
f .write ("</tr>" )
200
- f .write ("\n </tbody></table></main></body></html>" )
216
+ f .write ("\n </tbody></table>" )
217
+ f .write ("<h2>Manifest</h2><p>The tests above were run with the following package versions:</p>" )
218
+ f .write ("<table id='manifest'><thead><tr><th>Package</th><th>Version</th>" )
219
+ for package , version in manifest .items ():
220
+ version_string = "" if version is None else f"v{ version } "
221
+ f .write (f"<tr><td>{ package } </td><td>{ version_string } </td></tr>" )
222
+ f .write ("</table>" )
223
+ f .write ("</main></body></html>" )
201
224
202
225
with open ("html/main.css" , "w" ) as f :
203
226
f .write (
@@ -225,19 +248,26 @@ def html(_args):
225
248
max-width: 1250px;
226
249
}
227
250
228
- table#results {
229
- text-align: right;
251
+ table {
230
252
border: 1px solid black;
231
253
border-collapse: collapse;
232
254
}
233
255
256
+ table#results {
257
+ text-align: right;
258
+ }
259
+
234
260
td, th {
235
261
border: 1px solid black;
236
262
padding: 0px 10px;
237
263
}
238
264
239
265
th {
240
266
background-color: #ececec;
267
+ text-align: left;
268
+ }
269
+
270
+ th.right {
241
271
text-align: right;
242
272
}
243
273
0 commit comments