Repository navigation
Run the unit tests on every build - #577
Merged
Merged
Conversation
Move the unit test target out from behind the secret-gated screenshot block, so that it also covers fork pull requests and pushes to master. The screenshot pipeline needs the signing certificate, the pinned repo snapshot and the comparison credentials, so gating it on the presence of a secret is right. The unit tests were swept into that gate by sitting inside the same block, and they need none of it: no signing, no screenshot repo, no network, no repository on disk. - Add a "Run unit tests" step limited to GitXTests, ad-hoc signed and gated on nothing but the arm64 runner - Place it ahead of the screenshot pipeline so that a unit failure stops the job before the expensive steps run - Leave the existing screenshot block untouched
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unit tests merged in #576 do not run in CI. Neither do the ones merged before them.
This adds a step so that they do.
Why they never run
.github/workflows/BuildPR.ymlrunsGitXTestsfrom a step gated on:with
variableSet: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}.That condition is correct for the block it belongs to.
The screenshot pipeline genuinely needs the signing certificate, the pinned repo snapshot at
52ff1051, andCLASSIC_TOKEN/SCREENSHOT_USER/SCREENSHOT_PASSWORDto compare, and 1960c6c applied the same guard to all seven of those steps at once.The unit tests were swept along with them by sitting in the same block, and they need none of it.
The consequence is that the suite is skipped exactly where it would be most useful:
GitHub withholds secrets from them, so
variableSetis empty.Add tests for the index refresh and staging wiring #576 was raised from a fork,
so the tests it added have never executed in CI even once.
Not
pull_requestevents, so the second condition fails as well.What is left is a suite that runs only for branches pushed inside
gitx/gitx.The change
One step, thirteen lines, nothing removed and nothing else touched:
-only-testing:GitXTestskeeps it to the unit target, so the UI tests and the screenshots stay entirely within the existing gated block.CODE_SIGN_IDENTITY="-"signs ad-hoc, which is why no certificate is needed.It sits just before the screenshot pipeline so that a unit failure stops the job before the expensive steps run.
What it costs
Only the arm64 job runs it, matching the existing "only on arm64 to avoid tripling CI time" policy.
Test plan
xcodebuild test -workspace GitX.xcworkspace -scheme GitX -only-testing:GitXTests -destination "platform=macOS,arch=arm64" ARCHS="arm64" CODE_SIGN_IDENTITY="-"- the exact command the step runs.23 tests, 0 failures, 2.0s of testing.
Two things I could not verify, and one option
I ran the command on macOS 15.7.9 locally, not on
macos-26with Xcode 26.3, so the runner is the one thing I cannot reproduce. If it needs a-destinationtweak there I am happy to follow up.I also left the existing
Run testsstep alone rather than narrowing it to-only-testing:GitXUITests. That would stop the unit tests running twice on internal PRs, but the UI and screenshot path does not start on my machine ("Timed out while enabling automation mode"), and I would rather not reshape a pipeline I cannot exercise. Happy to add it if you would prefer that in the same PR.