Skip to content

Commit 66a1dfb

Browse files
committed
[CI Test] extract feature branch from PR body
1 parent ea065df commit 66a1dfb

File tree

1 file changed

+60
-4
lines changed

1 file changed

+60
-4
lines changed

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)