diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8bd2059d..aee8bab5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,6 +52,12 @@ jobs: - name: Run pytest (not unit, including running notebooks) run: | pytest --verbose -m 'not unit' tests/ + - name: Save build log + uses: actions/upload-artifact@v2 + if: always() + with: + name: ${{ matrix.os }}-${{ matrix.python-version }}-build-log + path: build-log.jsonl - name: Save build error logs uses: actions/upload-artifact@v2 if: failure() diff --git a/build.py b/build.py index 770a13b4..453060d6 100755 --- a/build.py +++ b/build.py @@ -66,6 +66,7 @@ from collections import namedtuple from datetime import datetime import glob +import json from io import StringIO import logging import os @@ -113,6 +114,18 @@ _log.setLevel(logging.INFO) +def _log_json(path='build-log.jsonl', **kwargs): + import platform + data = dict( + kwargs, + platform=platform.platform(), + python_version=platform.python_version(), + ) + json_str = json.dumps(data, default=str) + with Path(path).open('a') as f: + print(json_str, file=f, sep='\n') + + # This is a workaround for a bug in some versions of Tornado on Windows for Python 3.8 # this is the recommended fix for this according to e.g. https://github.com/tornadoweb/tornado#2608 # it should be revisited with python>=3.9 or if a fix is implemented by e.g. Jupyter @@ -738,6 +751,12 @@ def convert(self, id_, job, log_q) -> ConversionResult: self.log_info( f"Convert notebook name={job.nb}: end, ok={ok} duration={duration:.1f}s" ) + _log_json( + id=id_, + notebook=job.nb, + ok=ok, + duration=duration, + ) return self.ConversionResult(id_, ok, converted, why, job.nb, duration)