diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..7280bd89 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +concurrency = multiprocessing, thread +parallel = true +sigterm = true +omit = tests/**/*.py, docs/**/*.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 019b532a..00f96e92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,7 @@ on: jobs: base_coverage: + continue-on-error: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -17,7 +18,7 @@ jobs: python-version: 3.12 - name: Install Dependencies - run: pip install -e .[dev,server] + run: pip install -e . -r dev-requirements.txt - name: Test with pytest run: | @@ -111,11 +112,16 @@ jobs: name: coverage-3.12 - name: Download code coverage report for base branch + id: download-base-coverage + continue-on-error: true uses: actions/download-artifact@v4 with: name: base-coverage.lcov - name: Generate Code Coverage report + # Note, due to continue on error (to make job pass) we need to check the + # Status of the step directly not just use success() or failure() + if: steps.download-base-coverage.outcome == 'success' id: code-coverage uses: barecheck/code-coverage-action@v1 with: @@ -124,4 +130,15 @@ jobs: base-lcov-file: "./base-coverage.lcov" minimum-ratio: 0 send-summary-comment: true - show-annotations: "warning" \ No newline at end of file + show-annotations: "warning" + + - name: Generate Code Coverage report if base job fails + if: steps.download-base-coverage.outcome == 'failure' + id: code-coverage-without-base + uses: barecheck/code-coverage-action@v1 + with: + barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} + lcov-file: "./coverage.lcov" + minimum-ratio: 0 + send-summary-comment: true + show-annotations: "warning" diff --git a/pyproject.toml b/pyproject.toml index b154a054..c4cc5131 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "labthings-fastapi" -version = "0.0.7" +version = "0.0.8" authors = [ { name="Richard Bowman", email="richard.bowman@cantab.net" }, ] @@ -13,7 +13,7 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ - "pydantic>=2.0.0", + "pydantic ~= 2.10.6", "numpy>=1.20", "jsonschema", "typing_extensions", diff --git a/src/labthings_fastapi/server/fallback.py b/src/labthings_fastapi/server/fallback.py index db224407..f9cf9109 100644 --- a/src/labthings_fastapi/server/fallback.py +++ b/src/labthings_fastapi/server/fallback.py @@ -1,4 +1,5 @@ import json +from traceback import format_exception from fastapi import FastAPI from fastapi.responses import HTMLResponse from starlette.responses import RedirectResponse @@ -10,6 +11,7 @@ def __init__(self, *args, **kwargs): self.labthings_config = None self.labthings_server = None self.labthings_error = None + self.log_history = None app = FallbackApp() @@ -32,6 +34,9 @@ def __init__(self, *args, **kwargs):
Your configuration:
{{config}}
+ Traceback
+{{traceback}}
+ {{logginginfo}}