There are always problems building static executables on MacOS where you rely on Apple-private frameworks(modules) like Darwin, Combine, Foundation. On MacOS, these are only provided as dynamic libraries since their use is ubiquitous throughout the operating system, applications, service programs, and much code-sharing is used to keep total system code memory down. In the case of Darwin and Combine, they are Swift-only (although the Darwin module is derived from a lot of C/Objective-C system calls and libraries). Foundation(not the Foundation in Linux/Windows distributions) is used in Swift, C, C++, Objective-C/C++, and all the other languages supported by the O/S. This is not a problem with SPM, it's an architectural decision used in NextOS/MacOS since the '80s.
If you are trying to build a statically linked executable ala Linux, you have to stay away from Apple-private frameworks, which, looking at the modules imported in the source code, is going to require a big re-write.
Is your CI-machine running MacOS? If so, shouldn't be a problem to use an executable using the Apple system frameworks since they are installed in known places as part of the system installation.