Skip to content

Run unit tests serially in CI - #38

Merged
colemancda merged 1 commit into
masterfrom
feature/serial-tests
Aug 16, 2026
Merged

Run unit tests serially in CI#38
colemancda merged 1 commit into
masterfrom
feature/serial-tests

Conversation

@colemancda

Copy link
Copy Markdown
Member

Runs the unit tests serially in CI, on every platform that runs them.

Why

macOS jobs have been failing intermittently with signal code 11, and occasionally with real assertion failures rather than just a crash — e.g. on 04ecd57:

✘ contextModelStorageInsert() recorded an issue at CoreDataModelTests.swift:117:9:
  Expectation failed: try context.count(FetchRequest(entity: Person.entityName)) == 2

That is cross-test interference, not a runner problem: concurrent CoreData stacks in the same process tread on each other, so a test counting Person rows sees rows another test inserted.

Swift Testing parallelizes in-process by default, independently of SwiftPM's own --no-parallel default (which the swift test --help text refers to). .serialized suite traits only serialize within a suite; separate suites still run concurrently, which is why the earlier per-suite traits reduced but did not eliminate the failures.

Evidence

Reproduced and verified locally, 12 runs each:

mode failures
default (parallel) 2 / 12signal code 11
--no-parallel 0 / 12

Changes

  • .github/workflows/swift.yml--no-parallel on the macOS and Linux test steps. Windows, ARM and WebAssembly cross-compile only and run no tests, so they are unaffected.
  • Scripts/coverage.sh — same flag for the coverage run, which is a third place tests execute.

Full suite passes serially in debug and release (253 tests), and coverage is 96.37% against the CI threshold of 90.

The existing .serialized suite traits are left in place: they still help anyone running swift test locally without the flag.

@colemancda
colemancda merged commit 52a1b99 into master Aug 16, 2026
32 checks passed
@colemancda
colemancda deleted the feature/serial-tests branch August 16, 2026 18:48
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.

1 participant