@@ -159,7 +159,7 @@ jobs:
159159 send-summary-comment : true
160160 show-annotations : " warning"
161161
162- test-against-ofm :
162+ test-against-ofm-v3 :
163163 runs-on : ubuntu-latest
164164 continue-on-error : true
165165 defaults :
@@ -178,9 +178,7 @@ jobs:
178178 run : |
179179 git clone https://gitlab.com/openflexure/openflexure-microscope-server.git
180180 cd openflexure-microscope-server
181- git checkout v3-labthings-${{ github.head_ref }} || git checkout v3-labthings-main || git checkout v3
182- git rev-parse --abbrev-ref HEAD
183- git rev-parse HEAD
181+ git checkout v3
184182 pip install -e .[dev]
185183
186184 - name : Install LabThings-FastAPI
@@ -208,3 +206,66 @@ jobs:
208206
209207 - name : Type check with `mypy`
210208 run : mypy src
209+
210+ test-against-ofm-feature-branch :
211+ # This job runs only if a feature branch is specified in the merge request description.
212+ # The line below looks for a line starting with `OFM Feature Branch:`. This should
213+ # match the `grep` command in the relevant step.
214+ if : contains(toJson(github.event.pull_request.body), '\r\nOFM Feature Branch:')
215+ runs-on : ubuntu-latest
216+ continue-on-error : true
217+ defaults :
218+ run :
219+ working-directory : /home/runner/work/openflexure-microscope-server/
220+ steps :
221+ - uses : actions/checkout@v3
222+
223+ - name : Set up Python
224+ uses : actions/setup-python@v4
225+ with :
226+ python-version : 3.11
227+
228+ - name : Clone OpenFlexure Microscope Server
229+ working-directory : /home/runner/work/
230+ run : git clone https://gitlab.com/openflexure/openflexure-microscope-server.git
231+
232+ - name : Checkout feature branch
233+ env :
234+ PULL_REQUEST_BODY : ${{ github.event.pull_request.body }}
235+ # The `if:` block for this job has already checked we will have a matching line.
236+ # The logic below will first extract the matching line from the PR description,
237+ # then remove the prefix so we're left with only the branch name, which we check
238+ # out.
239+ run : |
240+ matching_line=$(echo "${PULL_REQUEST_BODY}" | grep "^OFM Feature Branch:")
241+ feature_branch="${matching_line##"OFM Feature Branch: "}"
242+ git checkout "${feature_branch}"
243+
244+ - name : Install OpenFlexure Microscope Server
245+ run : pip install -e .[dev]
246+
247+ - name : Install LabThings-FastAPI
248+ run : pip install -e ../labthings-fastapi/labthings-fastapi/
249+
250+ - name : Print installed packages
251+ run : pip freeze
252+
253+ - name : Configure Git identity
254+ run : |
255+ git config --global user.name "Sir Unit of Test"
256+ git config --global user.email "bogus@email.com"
257+
258+ - name : Pull OFM web app
259+ run : python ./pull_webapp.py
260+
261+ - name : Run OFM unit tests
262+ run : pytest
263+
264+ - name : Run OFM integration tests
265+ run : pytest tests/integration_tests
266+
267+ - name : Run OFM lifecycle test
268+ run : tests/lifecycle_test/testfile.py
269+
270+ - name : Type check with `mypy`
271+ run : mypy src
0 commit comments