From 7603763668ac659ac3c664b9b0338be536cd349d Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 3 Mar 2026 21:47:38 +0000 Subject: [PATCH 1/6] Add a CI job to test against the OFM test suite This should help catch issues earlier - it means if modifications to OFM are needed, this will be flagged early. It would be nice to keep an OFM branch that's updated with necessary changes for LabThings to work nicely, but this is unlikely to be an automatic thing. For now, I think just being able to check whether the current OFM codebase will work (unmodified) with changes being proposed to LabThings is already helpful. --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a174a04..61119c0f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -152,3 +152,35 @@ jobs: minimum-ratio: 0 send-summary-comment: true show-annotations: "warning" + + test-against-ofm: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Clone OpenFlexure Microscope Server + working-directory: /home/runner/work/ + run: | + git clone https://gitlab.com/openflexure/openflexure-microscope-server.git + cd openflexure-microscope-server + pip install -e .[dev] + + - name: Install LabThings-FastAPI + run: pip install -e . + + - name: Run OFM unit tests + working-directory: /home/runner/work/openflexure-microscope-server/ + run: pytest + + - name: Run OFM integration tests + working-directory: /home/runner/work/openflexure-microscope-server/ + run: pytest tests/integration_tests + + - name: Run OFM lifecycle test + working-directory: /home/runner/work/openflexure-microscope-server/ + run: tests/lifecycle_test/testfile.py + From 6afe322327a3957bc003b76b3bcdc65fe76c8031 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 14:56:24 +0000 Subject: [PATCH 2/6] Fix working directory for installing labthings --- .github/workflows/test.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61119c0f..d7f423b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -156,31 +156,30 @@ jobs: test-against-ofm: runs-on: ubuntu-latest continue-on-error: true + defaults: + run: + working-directory: /home/runner/work/openflexure-microscope-server/ steps: - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 - - name: Clone OpenFlexure Microscope Server working-directory: /home/runner/work/ - run: | - git clone https://gitlab.com/openflexure/openflexure-microscope-server.git - cd openflexure-microscope-server - pip install -e .[dev] + run: git clone https://gitlab.com/openflexure/openflexure-microscope-server.git + + - name: Install OFM Server + run: pip install -e .[dev] - name: Install LabThings-FastAPI - run: pip install -e . + run: pip install -e ../labthings-fastapi/ - name: Run OFM unit tests - working-directory: /home/runner/work/openflexure-microscope-server/ run: pytest - name: Run OFM integration tests - working-directory: /home/runner/work/openflexure-microscope-server/ run: pytest tests/integration_tests - name: Run OFM lifecycle test - working-directory: /home/runner/work/openflexure-microscope-server/ run: tests/lifecycle_test/testfile.py From e77337aa41fb44f1612b5226789ffe56e02eeb47 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 14:59:34 +0000 Subject: [PATCH 3/6] Check out the repo --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7f423b6..565a9136 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -160,6 +160,7 @@ jobs: run: working-directory: /home/runner/work/openflexure-microscope-server/ steps: + - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: @@ -172,7 +173,7 @@ jobs: run: pip install -e .[dev] - name: Install LabThings-FastAPI - run: pip install -e ../labthings-fastapi/ + run: pip install -e ../labthings-fastapi/labthings-fastapi/ - name: Run OFM unit tests run: pytest From 71dfd89ae4fba1da52507854fdf58ecbf9441daa Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 15:27:45 +0000 Subject: [PATCH 4/6] Configure git credentials. This is needed for OFM unit tests. --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 565a9136..2c61fd28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -161,10 +161,12 @@ jobs: working-directory: /home/runner/work/openflexure-microscope-server/ steps: - uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 + - name: Clone OpenFlexure Microscope Server working-directory: /home/runner/work/ run: git clone https://gitlab.com/openflexure/openflexure-microscope-server.git @@ -175,6 +177,11 @@ jobs: - name: Install LabThings-FastAPI run: pip install -e ../labthings-fastapi/labthings-fastapi/ + - name: Configure Git identity + run: | + git config --global user.name "Sir Unit of Test" + git config --global user.email "bogus@email.com" + - name: Run OFM unit tests run: pytest From b586570c932f30e519aea94d357ebcda9b14daa4 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 16:36:42 +0000 Subject: [PATCH 5/6] Pull the webapp before testing This is required for the lifecycle test to complete. --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c61fd28..14fd4ad0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -182,6 +182,9 @@ jobs: git config --global user.name "Sir Unit of Test" git config --global user.email "bogus@email.com" + - name: Pull OFM web app + run: python ./pull_webapp.py + - name: Run OFM unit tests run: pytest From 2a10623ad1bba0a46437fd1b8e55dacfcffab88a Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 20:55:50 +0000 Subject: [PATCH 6/6] Add an explicit checkout and run mypy Thanks to @julianstirling for code review. --- .github/workflows/test.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14fd4ad0..9c7f6027 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -167,12 +167,13 @@ jobs: with: python-version: 3.11 - - name: Clone OpenFlexure Microscope Server + - name: Install OpenFlexure Microscope Server working-directory: /home/runner/work/ - run: git clone https://gitlab.com/openflexure/openflexure-microscope-server.git - - - name: Install OFM Server - run: pip install -e .[dev] + run: | + git clone https://gitlab.com/openflexure/openflexure-microscope-server.git + cd openflexure-microscope-server + git checkout v3 + pip install -e .[dev] - name: Install LabThings-FastAPI run: pip install -e ../labthings-fastapi/labthings-fastapi/ @@ -193,4 +194,6 @@ jobs: - name: Run OFM lifecycle test run: tests/lifecycle_test/testfile.py - + + - name: Type check with `mypy` + run: mypy src