Skip to content

ci+test: run swift test in CI, add pure-helper test coverage (depends on #548)#551

Merged
cohoe merged 16 commits into
jocosocial:masterfrom
penguinboi:feat/ci-test-job
May 3, 2026
Merged

ci+test: run swift test in CI, add pure-helper test coverage (depends on #548)#551
cohoe merged 16 commits into
jocosocial:masterfrom
penguinboi:feat/ci-test-job

Conversation

@penguinboi

@penguinboi penguinboi commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Draft — depends on #548 (libvips migration). Do not merge before #548.

Closes #550 (partially — see scope notes).

Summary

  • Adds a Test sibling job to build_branch.yml that runs pure-helper tests in CI inside swift:6.2-noble. Caches .build/ keyed on Package.resolved.
  • Adds three pure-helper test classes covering previously-untested production code:
    • GeometryTestsColor.init(hex:), 11 cases including invalid input.
    • ValidatingJSONDecoderTestsValidatingJSONDecoder.validate(_:from:), 8 cases including validateStrLen, predicate validation, and decode-vs-validation-error distinction.
    • CruiseDateTests — pure Settings.shared.getDateInCruiseWeek tests (5 cases) that don't require app/DB spinup. setUp/tearDown mutate Settings.shared.cruiseStartDateComponents, cruiseLengthInDays, and cruiseStartDayOfWeek so the fixture cruise is self-contained and stable regardless of source-default drift.

24 new tests total. All pass locally on macOS without DB and in CI.

Scope note: pure-helper-only filter

The CI Test job runs swift test --filter "GeometryTests|ValidatingJSONDecoderTests|CruiseDateTests|ThemeCookieTests" rather than the full suite. Bringing the existing SettingsTests and ClientControllerTests into CI is real infrastructure work that's out of scope for this PR:

  • Application+Testable.swift:13 calls Settings.shared.readTimeZoneChanges(app) before withApp { ... } runs app.autoMigrate(). On a maintainer's local machine the time_zone_change table already exists from a prior swift run swiftarr migrate -y, so this works. On a pristine CI postgres it fails with relation "time_zone_change" does not exist.
  • SettingsTests.testPastDstDate (the lone case without withApp) is hardcoded to assert against the 2024-03-09 cruise date, but the in-source default drifted to 2025-03-02 in Improvements to PersonalEvents #495. Running it in CI exposes the rot.

Suggested follow-up: (1) move autoMigrate() ahead of readTimeZoneChanges in Application.testable(), (2) optionally rotate the SettingsTests fixtures to match the current source default OR convert them to the same self-contained setUp pattern this PR introduces in CruiseDateTests, (3) add postgres + redis service containers back to the workflow.

Depends on #548

This branches from current master (pre-libvips). Once #548 lands, I'll rebase. Expected conflicts: one tiny error-type swap in GeometryTests.swift (GDError.invalidColorImageError.invalidColor).

Test plan

slisteraley added 16 commits May 2, 2026 02:40
Test mode hardcodes the database name to 'swiftarr-test' (configure.swift:300),
not honoring DATABASE_DB env var. Match the service container to that name.
Existing SettingsTests / ClientControllerTests need a migrated+seeded DB.
That's separate infrastructure work outside this PR's scope. File a
follow-up to wire DB-dependent tests into CI.
@penguinboi penguinboi marked this pull request as ready for review May 2, 2026 19:18
@cohoe cohoe merged commit b37cb1c into jocosocial:master May 3, 2026
4 checks passed
@penguinboi penguinboi deleted the feat/ci-test-job branch May 6, 2026 04:47
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.

Add CI test job to GitHub Actions + baseline pure-helper unit tests

3 participants