Skip to content

CI improvements#293

Merged
rwb27 merged 5 commits intomainfrom
ci-improvements
Mar 25, 2026
Merged

CI improvements#293
rwb27 merged 5 commits intomainfrom
ci-improvements

Conversation

@rwb27
Copy link
Collaborator

@rwb27 rwb27 commented Mar 23, 2026

This tidies up a couple of things in CI:

  • The test-against-ofm job is duplicated:
    • test-against-ofm-v3 always runs and will test every PR against openflexure-microscope-server/v3 to ensure compatibility.
    • test-against-ofm-feature-branch will run only if there's a line in the PR body starting with OFM Feature Branch: specifying a branch to test against. This allows optional features to be tested, by creating an OFM branch that enables them.
  • I've tidied the publish workflow - this should now run only on tags, and no longer says "TestPyPI" in the title.

I think this gets us the best of both worlds. Assuming the new feature logic I've outlined in #294 is reasonable, this PR makes all the CI changes that are required.

This PR also reduces the need to merge PRs when jobs have failed. test-against-ofm-v3 is still allowed to fail, but if we stick to #294 then merging when that job fails should very much be the exception.

OFM Feature Branch: choose_int_downsample

rwb27 added 2 commits March 23, 2026 23:31
This will look for a branch called `v3-labthings-branch` and fall back to `v3-labthings-main` then `v3` if it doesn't exist.

I've added a line to print the branch that's actually checked out.
This should tidy up the "checks" tab in merge requests.
@barecheck
Copy link

barecheck bot commented Mar 23, 2026

Barecheck - Code coverage report

Total: 96.34%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@rwb27 rwb27 changed the title Ci improvements CI improvements Mar 23, 2026
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 23, 2026

The publish workflow ran correctly when I made a testpypi tag:

https://github.com/labthings/labthings-fastapi/actions/runs/23465657129

@rwb27 rwb27 requested a review from bprobert97 March 23, 2026 23:44
@rwb27 rwb27 marked this pull request as draft March 24, 2026 09:08
@rwb27 rwb27 marked this pull request as draft March 24, 2026 09:08
@rwb27 rwb27 force-pushed the ci-improvements branch 11 times, most recently from 36e053e to bf80af4 Compare March 24, 2026 10:52
@rwb27 rwb27 marked this pull request as ready for review March 24, 2026 11:00
It's now possible to add a line to the PR description that starts with "OFM Feature Branch:". This specifies a feature branch to test against.

There's some CI logic to:
* Run the job only if a matching line is present
* Extract the matching line from the PR description
* Check out the relevant branch.
@rwb27 rwb27 force-pushed the ci-improvements branch from bf80af4 to 20399cb Compare March 24, 2026 11:02
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 24, 2026

I have checked manually that

  • the CI pulls the correct branch when OFM Feature Branch: labthings-changes was present
  • the job is skipped when it's not present in the PR description.

I have force-pushed over these commits to keep things tidy, and because the PR description isn't actually part of the commit so it would all look a bit ambiguous anyway.

I would welcome feedback on my CI syntax and my bash script. There was quite some trial and error to handle the multiline string of the PR body properly, but I think the solution I've arrived at is reasonable.

Co-authored-by: Beth <167304066+bprobert97@users.noreply.github.com>
@rwb27 rwb27 force-pushed the ci-improvements branch 4 times, most recently from 256d946 to ade0858 Compare March 25, 2026 09:33
@rwb27 rwb27 force-pushed the ci-improvements branch 4 times, most recently from 18bbb3b to e7d6ab7 Compare March 25, 2026 10:08
This uses YAML anchors to reduce duplication, and switches to relative paths for the working directories.
GitHub Workflows don't offer a way to merge YAML arrays, so I've needed to split the feature branch
job so that it determines the name of the feature branch in a separate job.

I spent a while playing with a custom action to deduplicate the steps, but it doesn't work as nicely.

I also removed some unnecessary curly braces.
@rwb27 rwb27 force-pushed the ci-improvements branch from e7d6ab7 to 7457105 Compare March 25, 2026 10:10
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 25, 2026

@bprobert97 I think this is ready for rereview. I've made a few improvements:

  • Paths are now all relative. I am still assuming that the default working directory is where the repo gets cloned, and I'm assuming it's OK to write to the parent directory when I check out the OFM. I think both of those assumptions are good.
  • I've reused the steps between the two OFM jobs, using YAML anchors. This required me to split out the logic that extracted the branch name from the PR description, because I couldn't merge in an extra step.
  • I've not changed the line that looks for a \r\n line ending, because I don't think it's Windows specific (I replied to your comment).

@rwb27 rwb27 requested a review from bprobert97 March 25, 2026 10:17
Copy link
Contributor

@bprobert97 bprobert97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with the YAML updates. Just want to check if this has been tested before I click approve

@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 25, 2026

Happy with the YAML updates. Just want to check if this has been tested before I click approve

yes, I've tested it both with and without a linked branch. If you look in "checks" you should see the final commit here has been tested against both branches v3 and choose_int_downsample. If you expand the "check out OFM" step, it shows the right branch was used.

I've also tested that it doesn't run if no branch is specified, with the relevant jobs showing as "skipped" rather than failed.

@rwb27 rwb27 merged commit 75e6e30 into main Mar 25, 2026
14 checks passed
@rwb27 rwb27 deleted the ci-improvements branch March 25, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants