@@ -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,64 @@ 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+ - name : determine feature branch
222+ working-directory : /home/runner/work/
223+ env :
224+ PULL_REQUEST_BODY : ${{ github.event.pull_request.body }}
225+ run : |
226+ matching_line=$(echo "${PULL_REQUEST_BODY}" | grep "^OFM Feature Branch:")
227+ echo "Matching line: '${matching_line}'"
228+ feature_branch=${matching_line##"OFM Feature Branch: "}
229+ echo "Using feature branch ${feature_branch}"
230+ - uses : actions/checkout@v3
231+
232+ - name : Set up Python
233+ uses : actions/setup-python@v4
234+ with :
235+ python-version : 3.11
236+
237+ - name : Install OpenFlexure Microscope Server
238+ working-directory : /home/runner/work/
239+ run : |
240+ git clone https://gitlab.com/openflexure/openflexure-microscope-server.git
241+ cd openflexure-microscope-server
242+ git checkout v3-labthings-${{ github.head_ref }}
243+ pip install -e .[dev]
244+
245+ - name : Install LabThings-FastAPI
246+ run : pip install -e ../labthings-fastapi/labthings-fastapi/
247+
248+ - name : Print installed packages
249+ run : pip freeze
250+
251+ - name : Configure Git identity
252+ run : |
253+ git config --global user.name "Sir Unit of Test"
254+ git config --global user.email "bogus@email.com"
255+
256+ - name : Pull OFM web app
257+ run : python ./pull_webapp.py
258+
259+ - name : Run OFM unit tests
260+ run : pytest
261+
262+ - name : Run OFM integration tests
263+ run : pytest tests/integration_tests
264+
265+ - name : Run OFM lifecycle test
266+ run : tests/lifecycle_test/testfile.py
267+
268+ - name : Type check with `mypy`
269+ run : mypy src
0 commit comments