CI for Swift
Build, lint, and test a Swift project using SwiftLint and XCTest.
Use template →1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
env: SWIFT_CACHE_PATH: .cache steps: - label: ":swift: Build" key: "build" command: "swift build --cache-path $SWIFT_CACHE_PATH" plugins: - docker#v5.9.0: image: "swift:5.10" - artifacts#v1.9.3: upload: "$SWIFT_CACHE_PATH" compressed: cache.tgz - label: ":swift: Lint" command: "swiftlint" plugins: - docker#v5.9.0: image: "ghcr.io/realm/swiftlint:latest" platform: "linux/amd64" - label: ":swift: Test" command: "swift test --cache-path $SWIFT_CACHE_PATH" depends_on: ["build"] plugins: - docker#v5.9.0: image: "swift:5.10" - artifacts#v1.9.3: download: "$SWIFT_CACHE_PATH" compressed: cache.tgz
CI for Swift
This template gives you a continuous integration (CI) pipeline that builds, lints, and tests a Swift project.
At a glance:
- For Swift projects
- Requires Docker
- Uses the Swift Package Manager
- Lints code with SwiftLint
- Tests code using XCTest
How it works
This template:
- Builds your Swift project, caching dependencies for subsequent steps.
- Lints the code with SwiftLint.
- Runs tests with XCTest.
The runtime environment uses the official Swift Docker image with the latest version.
Next steps
After you select Use template, you’ll:
- Connect the Git repository with your Swift project.
- Modify the commands if necessary.
- Configure the compute—run locally, on-premises, or in the cloud.
- Run the pipeline.
You can then play around with the pipeline settings. For example, run the pipeline locally while you iterate on the definition or set a schedule to trigger a nightly build.
If you need help, please check our documentation, raise an issue , or reach out to support.