Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running on CI #21

Open
winsmith opened this issue Mar 13, 2024 · 5 comments
Open

Errors when running on CI #21

winsmith opened this issue Mar 13, 2024 · 5 comments

Comments

@winsmith
Copy link

winsmith commented Mar 13, 2024

I'm trying to compile and test a Swift Project that includes XCTestParametrizedMacro. While it compiles and runs correctly on my Mac, it fails to compile inside various CI environments I'm trying this out on.

I'm always getting an error message compiling the Test target that ends in "compiler plugin not loaded".

Any ideas how to make this work?

Here's the full part of the log for building the tests just in case. This is run on an M1 Mac mini.

[2383/2404] Emitting module Run
[2384/2404] Compiling Run main.swift
[2384/2404] Linking Run
error: emit-module command failed with exit code 1 (use -v to see invocation)
[2386/2404] Emitting module AppTests
rosetta error: Failed to open libRosettaRuntime
 <unknown>:0: warning: compiler plugin not loaded: '/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/x86_64-apple-macosx/debug/XCTestParametrizedMacroMacros; failed to initialize
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/Tests/AppTests/APITests/v3/V3AppsControllerPermissionTests.swift:239:10: error: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'
    func testPermission(input permissionPermutation: PermissionPermutation, output expectedStatus: ExpectedStatuses) async throws {
         ^
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacro/XCTestParametrizedMacro.swift:8:14: note: 'Parametrize(input:output:)' declared here
public macro Parametrize<I, O>(input: [I], output: [O]) = #externalMacro(module: "XCTestParametrizedMacroMacros", type: "ParametrizeMacro")
             ^
[2387/2406] Compiling AppTests AppAccessLevelTests.swift
[2388/2406] Compiling AppTests QueryFromInsightTests.swift
[2389/2406] Compiling AppTests V3UsersPasswordControllerTest.swift
[2390/2406] Compiling AppTests V3UsersRegistrationControllerTests.swift
[2391/2406] Compiling AppTests ContextsControllerTests.swift
[2392/2406] Compiling AppTests OrganizationControllerTests.swift
[2393/2406] Compiling AppTests StatusControllerTests.swift
[2394/2406] Compiling AppTests V3OrganizationJoinRequestsControllerTests.swift
[2395/2406] Compiling AppTests V3OrganizationRolesControllerTests.swift
[2396/2406] Compiling AppTests V3UsersControllerTests.swift
[2397/2406] Compiling AppTests V3UsersInfoControllerTests.swift
[2398/2406] Compiling AppTests V3OrganizationUserRolesControllerTests.swift
[2399/2406] Compiling AppTests V3OrganizationsControllerTests.swift
[2400/2406] Compiling AppTests V3AppsControllerPermissionTests.swift
rosetta error: Failed to open libRosettaRuntime
 <unknown>:0: warning: compiler plugin not loaded: '/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/x86_64-apple-macosx/debug/XCTestParametrizedMacroMacros; failed to initialize
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/Tests/AppTests/APITests/v3/V3AppsControllerPermissionTests.swift:239:10: error: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'
    func testPermission(input permissionPermutation: PermissionPermutation, output expectedStatus: ExpectedStatuses) async throws {
         ^
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacro/XCTestParametrizedMacro.swift:8:14: note: 'Parametrize(input:output:)' declared here
public macro Parametrize<I, O>(input: [I], output: [O]) = #externalMacro(module: "XCTestParametrizedMacroMacros", type: "ParametrizeMacro")
             ^
[2401/2406] Compiling AppTests V3AppsControllerTests.swift
rosetta error: Failed to open libRosettaRuntime
 <unknown>:0: warning: compiler plugin not loaded: '/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/x86_64-apple-macosx/debug/XCTestParametrizedMacroMacros; failed to initialize
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/Tests/AppTests/APITests/v3/V3AppsControllerPermissionTests.swift:239:10: error: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'
    func testPermission(input permissionPermutation: PermissionPermutation, output expectedStatus: ExpectedStatuses) async throws {
         ^
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacro/XCTestParametrizedMacro.swift:8:14: note: 'Parametrize(input:output:)' declared here
public macro Parametrize<I, O>(input: [I], output: [O]) = #externalMacro(module: "XCTestParametrizedMacroMacros", type: "ParametrizeMacro")
             ^
[2402/2406] Compiling AppTests V3GroupsControllerTests.swift
rosetta error: Failed to open libRosettaRuntime
 <unknown>:0: warning: compiler plugin not loaded: '/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/x86_64-apple-macosx/debug/XCTestParametrizedMacroMacros; failed to initialize
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/Tests/AppTests/APITests/v3/V3AppsControllerPermissionTests.swift:239:10: error: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'
    func testPermission(input permissionPermutation: PermissionPermutation, output expectedStatus: ExpectedStatuses) async throws {
         ^
/Users/buildserver/actions-runner/_work/telemetry/telemetry/telemetry/.build/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacro/XCTestParametrizedMacro.swift:8:14: note: 'Parametrize(input:output:)' declared here
public macro Parametrize<I, O>(input: [I], output: [O]) = #externalMacro(module: "XCTestParametrizedMacroMacros", type: "ParametrizeMacro")
             ^
[2403/2406] Compiling AppTests V3InsightControllerTests.swift
[2404/2406] Compiling AppTests V3QueryControllerTests.swift
[2405/2406] Compiling AppTests V3TasksControllerTests.swift
error: fatalError
error: fatalError
Error: Process completed with exit code 1.
@mmysliwiec
Copy link
Member

Hi @winsmith. It's not the problem with macro but Xcode. On CIs Xcode is validating macro fingerprint but we didn't find a way to add such a fingerprint. So what we did is turn off checking of macro fingerprints like (as a initial step for a pipeline):
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES

@winsmith
Copy link
Author

Thanks a lot but -- I'm not building with the xcodebuild command on a Mac, but with swift build / swift test on linux (this is a Vapor app). Any idea how I can pass the skipPackagePluginValidation or something similar ? Googling has not brought up anything helpful so far

@mmysliwiec
Copy link
Member

Oh, I'm sorry. I was too quick with my reasoning. We have never tested swift macros on Linux build. What is fishy for me is that in your output there is an error about Rosetta. Why would your Linux build require Rosseta? Maybe that's the issue, not swift macro itself.

@mmysliwiec
Copy link
Member

@winsmith Do you still have problems with building our macro on CI or we can close the issue?

@giovegaq
Copy link

giovegaq commented Apr 5, 2024

Hello, I'm getting a similar error from Github actions but locally works well, in my case I'm using Fastlane

`[19:51:32]: ▸ Linking XCTestParametrizedMacro

[19:51:36]: ▸ ❌ /Users/automation/actions-runner2/_work/vri-ios/vri-ios/build/SourcePackages/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacroClient/main.swift:21:10: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'
[19:51:36]: ▸ func testPow2(input n: Int, output result: Int) {

[19:51:36]: ▸ ^

[19:51:36]: ▸ ❌ /Users/automation/actions-runner2/_work/vri-ios/vri-ios/build/SourcePackages/checkouts/XCTestParametrizedMacro/Sources/XCTestParametrizedMacroClient/main.swift:26:10: external macro implementation type 'XCTestParametrizedMacroMacros.ParametrizeMacro' could not be found for macro 'Parametrize(input:output:)'

[19:51:36]: ▸ func testWordLength(input word: String, output length: Int) {

[19:51:36]: ▸ ^

[19:51:36]: Running Tests: ▸ Touching XCTestParametrizedMacro.framework (in target 'XCTestParametrizedMacro' from project 'XCTestParametrizedMacro')

[19:51:36]: ▸ ** BUILD FAILED **

[19:51:36]: ▸ The following build commands failed:

[19:51:36]: ▸ SwiftEmitModule normal arm64 Emitting\ module\ for\ XCTestParametrizedMacroClient (in target 'XCTestParametrizedMacroClient' from project 'XCTestParametrizedMacro')`

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

No branches or pull requests

3 participants