My Swift project build legitimately fails in CI. I know how to fix the error I meet. But I cannot reproduce the error locally and it bugs me.
Here is the error:
error: 'Transport' is only available in macOS 12.0 or newer
Transport is indeed a protocol marked with the following attribute: @available(macOS 12.0, *).
So the build failure sounds legitimate since I declared in my Package.swift that my project should work on macOS 10.15, and looks like so:
let package = Package(
name: "my-package",
platforms: [
.macOS(.v10_15),
.iOS(.v15)
],
… // further down I declare the dependency that includes `Transport`
So I know how to fix the issue (update my Package.swift to support macOS platform from macOS 12; or check for macOS 12 availability before using Transport in my code) but I cannot reproduce the error on my laptop, and I am not sure why. Is there an option I am missing or a cache I fail to clean up?
I tried:
rm -rf .build/
rm -rf .swiftpm/
swift build // with and without --disable-dependency-cache
But it builds without an error. 
It is not usual to ask a forum for help to make your project fail, but here it is. 
My setup:
- Swift 5.9.2
- Xcode 15.1
- macOS 14.1.2
The CI runs as a GitHub action in a monorepo on this image:
my-package:
runs-on: macos-latest
defaults:
run:
working-directory: subdir/package-root
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build
- name: Run tests
run: swift test
Thanks.