swift-cross-ui icon indicating copy to clipboard operation
swift-cross-ui copied to clipboard

Figure out how to run tests without SwiftPM trying to build all targets

Open stackotter opened this issue 1 year ago • 2 comments
trafficstars

If you run swift test now, SwiftPM first tries to build all targets (even though the only tests target has a single dependency on the SwiftCrossUI target). This has the outcome of meaning that you need to have all backend system dependencies present (e.g. gtk4, qt@5) on your computer to run swift test (very annoying). Due to this, I've disabled the swift test step in macOS and Linux CI until a solution is found.

stackotter avatar Apr 07 '24 23:04 stackotter

I ran into a similar issue with one of my repos, never found a solution, so curious if you find one.

lhoward avatar Apr 07 '24 23:04 lhoward

My only idea so far is to make Package.swift remove all non-tested targets when a TEST environment variable is present so that you can run TEST=1 swift test, but that's pretty hacky.

stackotter avatar Apr 08 '24 00:04 stackotter