Skip to content

Add release-mode test runs for macOS and Linux - #134

Open
natecook1000 wants to merge 1 commit into
swiftlang:mainfrom
natecook1000:swift-test-c-release
Open

Add release-mode test runs for macOS and Linux#134
natecook1000 wants to merge 1 commit into
swiftlang:mainfrom
natecook1000:swift-test-c-release

Conversation

@natecook1000

@natecook1000natecook1000 commented Jun 16, 2025

Copy link
Copy Markdown
Member

This adds a Build / Test [release] step to the tests for macOS and Linux, so that tests can be run in both modes. It includes new inputs for:

  • macos_release_build_command (default: xcrun swift test -c release)
  • linux_release_build_command (default: swift test -c release)
  • enable_release_tests (default: false)

@natecook1000
natecook1000 requested a review from a team as a code ownerJune 16, 2025 01:35
@natecook1000
natecook1000force-pushed the swift-test-c-release branch 3 times, most recently from 6fcd646 to 2cc0791CompareJune 16, 2025 01:44
@rauhul

Copy link
Copy Markdown
Member

Why not just run in release always?

@FranzBusch

Copy link
Copy Markdown
Member

Why not just run in release always?

Most packages don't support building tests in release mode due to @testable imports AFAIK

@rauhul

Copy link
Copy Markdown
Member

@testable supports release mode. It just makes internal api visible outside the module unit.

@natecook1000

Copy link
Copy Markdown
MemberAuthor

Huh, that isn't my experience! I thought it would just be easier to not block on this for packages that couldn't support it fully.

@ahoppen

Copy link
Copy Markdown
Member

I think you need to pass --enable-testable-imports to test a package with @testable imports in release mode.

@jrflat

Copy link
Copy Markdown
Contributor

FWIW even with --enable-testable-imports, System was still failing to build tests in release mode (due to some #if DEBUG conditionals, fixed by PR above). We would probably need to keep enable_release_tests defaulting to false or otherwise track down/help fix potential failures in projects using this workflow.

@MahdiBM

MahdiBM commented Aug 13, 2025

Copy link
Copy Markdown

The way to enable @testable imports even in release builds is to use -Xswiftc -enable-testing like I've added a few months ago to Vapor's reusable CI for release-mode testing of packages when possible.
I'm not quite sure why --enable-testable-imports doesn't cut it. Could be a bug.

Sign up for freeto 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.

6 participants

@natecook1000@rauhul@FranzBusch@ahoppen@jrflat@MahdiBM