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

Add SwiftPM GitHub CI support #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Kyle-Ye
Copy link
Contributor

@Kyle-Ye Kyle-Ye commented Mar 13, 2024

I have tested this on my fork. You can check it here

image

@Kyle-Ye Kyle-Ye requested a review from rauhul as a code owner March 13, 2024 08:04
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 13, 2024

I'm also considering adding Xcode CI in this PR. But I encounter some strange issue when using xcodebuild to build the example target.

xcodebuild build \
            -scheme Life \
            -configuration Release \
            -skipMacroValidation -skipPackagePluginValidation \
            -destination "platform=macos"

The error message is as following

xcodebuild: error: Could not resolve package dependencies:
  Invalid manifest (compiled with: ["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-03-07-a.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/hs/g5q9gn6d5tx6_3bxmq1pj0rw0000gp/T/TemporaryDirectory.pY2hLP/vfs.yaml", "-L", "/Applications/Xcode-15.3.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Applications/Xcode-15.3.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-target", "arm64-apple-macos13.0", "-sdk", "/Applications/Xcode-15.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk", "-swift-version", "5", "-I", "/Applications/Xcode-15.3.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-sdk", "/Applications/Xcode-15.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk", "-package-description-version", "5.9.0", "-Xfrontend", "-serialize-diagnostics-path", "-Xfrontend", "/Users/kyle/Library/Caches/org.swift.swiftpm/manifests/ManifestLoading/life.dia", "/Users/kyle/Developer/Playdate/swift-playdate-examples/Examples/Life/Package.swift", "-disallow-use-new-driver", "-o", "/var/folders/hs/g5q9gn6d5tx6_3bxmq1pj0rw0000gp/T/TemporaryDirectory.gc8PVm/life-manifest"])
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'
<unknown>:0: error: unable to execute command: <unknown>

I can't solve it in a short time. So I guess we can add the SwiftPM CI first which at least provides a layer of promise that new PR will not break SwiftPM build.

fail-fast: false
matrix:
os: [macos-13, macos-14]
xcode-version: ["15.2"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xcode version does not matter here on SwiftPM CI as we are using nightly Swift toolchain here.

Xcode 15.3 is not used because the upstream runner does not support it yet.

actions/runner-images#9459

- uses: SwiftyLab/setup-swift@latest
with:
development: true
swift-version: latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you prefer to use the latest nightly toolchain or use a fixed nightly version here?

id: playdate
uses: pd-rs/[email protected]
with:
version: 2.4.1
Copy link
Contributor Author

@Kyle-Ye Kyle-Ye Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Fixed version: "2.4.1" (The current latest version)
  2. Fixed version: "2.1.1" (Aligned with the current documentation description and screenshot)
  3. Dynamic version: "latest" (Update automatically when there is a new version)

- name: Build with SwiftPM for ${{ matrix.TARGET }}
working-directory: Examples/${{ matrix.TARGET }}
run: |
swift build -c release
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TOOLCHAIN=xx is injected into env automatically in SwiftyLab/setup-swift@latest step

@rauhul
Copy link
Collaborator

rauhul commented Mar 13, 2024

@DougGregor I'm not sure about the Swift project's policy regarding CI with Github Actions currently, could you chime in?

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 13, 2024

@DougGregor I'm not sure about the Swift project's policy regarding CI with Github Actions currently, could you chime in?

IIRC, we should ask @shahmishal for Swift CI related thing

Related Post: https://forums.swift.org/t/dropping-support-for-swift-ci-test-and-merge-in-favor-of-auto-merge-feature-on-github/68297

@Kyle-Ye Kyle-Ye changed the title Add SwiftPM Github CI support Add SwiftPM GitHub CI support Mar 14, 2024
@shahmishal
Copy link
Member

Apple has GitHub actions disabled at the organization level, so running for PRs won't have any effect - individuals can enable GitHub actions on their own forks if they are so inclined. ci.swift.org is used for testing most other swift-family projects.

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Mar 15, 2024

Apple has GitHub actions disabled at the organization level, so running for PRs won't have any effect - individuals can enable GitHub actions on their own forks if they are so inclined. ci.swift.org is used for testing most other swift-family projects.

Is there any existing CI workflow on ci.swift.org for this repo.
Looks like we did not run swift test before a merge currently.

Do we need to add such CI to ci.swift.org for this repo or enable GitHub action for this repo? @rauhul

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

Successfully merging this pull request may close these issues.

3 participants