Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish to TestPyPI
name: Publish to PyPI

on: push

#on:
# release:
# types: [published]
on:
push:
# Only try to publish if it's tagged
tags:
- 'v*'
- 'testpypi-v*'

jobs:
build:
Expand Down
68 changes: 55 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,33 +159,37 @@ jobs:
send-summary-comment: true
show-annotations: "warning"

test-against-ofm:
test-against-ofm-v3:
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
working-directory: /home/runner/work/openflexure-microscope-server/
steps:
working-directory: ../openflexure-microscope-server/
env:
REF: v3
steps: &test-against-ofm-steps
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: '3.11'

- name: Install OpenFlexure Microscope Server
working-directory: /home/runner/work/
- name: Clone OpenFlexure Microscope Server
working-directory: .. # This step creates the default working directory
run: |
git clone https://gitlab.com/openflexure/openflexure-microscope-server.git
cd openflexure-microscope-server
git checkout v3
pip install -e .[dev]

- name: Check out OpenFlexure Microscope Server
run: "git checkout $REF"

- name: Install OpenFlexure Microscope Server
run: "pip install -e ../openflexure-microscope-server/[dev]"

- name: Install LabThings-FastAPI
run: pip install -e ../labthings-fastapi/labthings-fastapi/
run: "pip install -e ../labthings-fastapi"

- name: Print installed packages
run: pip freeze
run: "pip freeze"

- name: Configure Git identity
run: |
Expand All @@ -206,3 +210,41 @@ jobs:

- name: Type check with `mypy`
run: mypy src

check-for-ofm-feature-branch:
# This job runs only if a feature branch is specified in the merge request description.
# The line below looks for a line starting with `OFM Feature Branch:`. This should
# match the `grep` command in the step script.
if: contains(toJson(github.event.pull_request.body), '\r\nOFM Feature Branch:')
runs-on: ubuntu-latest
outputs:
feature-branch: ${{ steps.determine-feature-branch.outputs.feature-branch}}
steps:
- name: Determine feature branch
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
# The `if:` block for this job has already checked we will have a matching line.
# The logic below will first extract the matching line from the PR description,
# then remove the prefix so we're left with only the branch name, which we check
# out.
run: |
matching_line=$(echo "$PULL_REQUEST_BODY" | grep "^OFM Feature Branch:")
feature_branch="${matching_line##"OFM Feature Branch: "}"
echo "Using feature branch '$feature_branch'"
echo "feature-branch=$feature_branch" >> "$GITHUB_OUTPUT"
id: determine-feature-branch

test-against-ofm-feature-branch:
# This job uses the feature branch found by the previous job.
# It is split from that job in order to allow re-use of the steps from
# test-against-ofm-v3
needs: check-for-ofm-feature-branch
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
working-directory: ../openflexure-microscope-server/
env:
REF: ${{ needs.check-for-ofm-feature-branch.outputs.feature-branch }}
steps: *test-against-ofm-steps

Loading