Compiling iOS Project in GitHub Actions
While setting up YAML
with GitHub Actions, it seems the build failed.
These are the steps I took to integrate GitHub Actions in our iOS project. It seems for CI/CD to work we have to create a Package.swift
file in our project. Currently, we do it manually through Xcode’s Swift Package Manager.
To create this Package.swift
file, we need to run swift package init
in the command line and it will create the following files.
swift package init
Creating library package: iOS
Creating Package.swift
Creating .gitignore
Creating Sources/
Creating Sources/iOS/iOS.swift
Creating Tests/
Creating Tests/iOSTests/
Creating Tests/iOSTests/iOSTests.swift
After, I opened Package.swift
file and added the libraries inside the dependencies
bracket.
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/scinfu/SwiftSoup", branch: "master"),
.package(url: "https://github.com/onevcat/Kingfisher", branch: "master"),
.package(url: "https://github.com/realm/realm-cocoa", branch: "master"),
.package(url: "https://github.com/optonaut/ActiveLabel.swift", branch: "master"),
.package(url: "https://github.com/mixpanel/mixpanel-swift", branch: "master"),
.package(url: "https://github.com/BastiaanJansen/toast-swift", branch: "main")
],
After saving, run swift package resolve
in the command line. Swift will then fetch the libraries and compile them. Swift will also create a file called Package.resolved
.
Also, as of September 15 using macos-latest
as the runner in GitHub Actions won’t work. So I have to use macos-12
instead. I got this answer from here.
Push to git repo. xcodebuild
is now working and seems to be fetching the libraries now but threw another error about my “provisioning profiles not found”. I don’t need those profiles setup for now, I just want GA to compile our iOS project successfully.
So, I updated the run command in our YAML
file.
- name: Build
run: xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -scheme OnlineJobsPH
working-directory: ./iOS
Build successful. Yay!