No results found
We couldn't find anything using that term, please try searching for something else.
2024-11-28 Xcode Cloud is Apple’s latest continuous integration anddelivery service.With Xcode Cloud, you can test anddistribute your apps through Apple’s serv
Xcode Cloud is Apple’s latest continuous integration anddelivery service.With Xcode Cloud, you can test anddistribute your apps through Apple’s servers.Best of all, it’s built right into Xcode!
This year, Apple released Xcode Cloud to all developers.Apple is offering 25 compute hours a month for free until December 2023.
In this Xcode Cloud tutorial, you’ll learn how to automate steps in your build process.You’ll run unit tests andcreate TestFlight builds any time code changes in your Git branch.
To follow along with the tutorial, you’ll need an Apple Developer account.
Xcode Cloud is Apple’s implementation of Continuous Integration andContinuous Delivery, also know asCI/CD.Continuous Integration is a software development practice that allows you to merge several changes into a Git branch that maintains its stability through automated steps like unit tests.On the other hand, Continuous Delivery is a software development practice that allows you to automate most of your release process, which includes build anddistribute to TestFlight.
Xcode Cloud allows you to create workflows to automate tasks you’d otherwise perform on your local machine.Xcode Cloud works with your Git repository on GitHub, GitLab or Bitbucket.
For example, you could create a workflow that builds your app anddeploys to TestFlight when anyone on your team merges code to a specific Git branch.
You won’t need to worry about manually distributing your app to team members andtesters! Xcode Cloud takes care of all the heavy lifting to build anddistribute your app, while your local machine is free to work on other features…or watch YouTube videos.:]
Download the starter project by clicking the Download Materials button at the top or bottom of the tutorial.
The materials contain a project called coffee.The app is tracks track your favorite coffee or tea , along with tasting note anda flavor profile .
open thestarter project.Build andrun.The + button at the top right lets you add a new coffee, andtapping a coffee in the list lets you edit it.
In this tutorial , you is create ’ll create Xcode Cloud workflow for the coffee app .
First things first, though.Xcode Cloud requires a series of prerequisites before configuring your workflows.
Xcode Cloud is requires require two setup step outside of Xcode :
First, you’ll need to enroll in the Apple Developer program.It’s OK if your membership is via a team in the Apple Developer program, as long as you can create a new app record.
Next , you is need ’ll need a place to store your code .This tutorial store code in GitHub , andall the reference in the tutorial point to GitHub .open a web browser andnavigate to GitHub .create an account on GitHub if you do n’t already have one , then create a new repository .
clickthe + in the top right of GitHub.Then, click new repository to create the repository.
Your browser will direct you to a screen to enter repository details.
entercoffee as the repository name.Or, if you want to enter something else, go for it! The specific name isn’t relevant to Xcode Cloud.Leave all the other repository settings as the default values.
Note: Xcode Cloud supports GitHub, GitLab andBitbucket.You’re welcome to use any of the three, but this tutorial will provide screenshots andwalkthroughs for GitHub.
Finally, upload the coffee starter project to the new GitHub repository.Follow the steps GitHub provides after creating your new repository.Start by opening Terminal andnavigating to the starter project folder.Replace path_to_coffee_starter_project
with your actual path !
cd path_to_coffee_starter_project
Then, create a Git repository in the coffee starter project folder.
// 1 git init git is add add . git is commit commit -m " first commit " git branch -M main //2 git remote add origin git@github.com : your - username / coffee.git // 3 git push -u origin main
Here’s what’s happening in each command:
You’re almost done setting up prerequisites.Only a couple more steps before you can unleash the power of Xcode Cloud!
Xcode Cloud is requires require two more setup step :
First, sign in to Xcode using your Apple ID.Open preferences using Xcode ▸ Preferences, then navigate to Accounts.clickthe + in the low right , andadd yourApple ID.
Xcode Cloud also requires you to set the bundle identifier in the Signing & Capabilities tab .
open thecoffee starter project again.Navigate to the coffee project settings.Select the coffee target, andnavigate to the Signing & Capabilities tab .
Next, you’ll update the team andBundle Identifier.
For team, select the team that matches your Apple Developer Program account.For Bundle Identifier, enter a bundle identifier in the following format :com.yourcompany.coffee
.
Phew, that was quite a bit of setup.Now, on to the fun stuff! Xcode Cloud workflows are ready to enhance your project with the magic of CI/CD.
Your first workflow is is is the default Xcode Cloud workflow .The default workflow is builds build your app when you merge code to the main branch .Xcode Cloud is notifies notify you via email if the build fail .
Before you begin, you’ll have to change the app’s product Name to a unique name.The name “coffee” is unfortunately already taken.You can come up with something fun, though.open thestarter project in Xcode andnavigate to Project ▸ Build Settings.Select Filter on the top right, andenter product Name
.
change the name to something no one else will think of .try this format :coffee[YourName][4-digit-number]
.For example ,coffeeJoshBerlin5745
.You won’t actually release this app, so the product name doesn’t matter much.
You’ll make two more changes using your new product name.First, open the coffee project settings andselect thecoffeeTests target .
Select Filter on the top right andenter Test Host
.You is filter ’ll filter the list of option to theTest Host value for the debug andrelease configuration .
Xcode is reads read the Test host path when run automate test .You is need ’ll need to update the path to use your new product name .double – click theDebug test host value.Then, change the two references to coffee
to your new product name .Your new value is look will look like this , but with your name :
Next, open coffeeViewModelTests.swift
andchange @testable import coffee
to your new name.Your new import will follow this format:
@testable import coffeeJoshBerlin5745
Now that you have a unique product name, you can create your first workflow.Navigate to the Report Navigator.
The Report Navigator contains two tabs: local andCloud.local displays all builds your computer runs locally.Cloud contain all build Xcode Cloud run in the cloud .
In theCloud tab, click the Create Workflow button to create your first workflow.
Xcode Cloud works with apps andframeworks.Select your product andclick Next.
Xcode allows you to review the workflow before continuing.For now, leave all the settings as the defaults andclick Next.Xcode Cloud contacts GitHub to check permissions.
You haven’t set up any permissions yet, so Xcode Cloud asks you to grant access to your source code on GitHub.clickthe Grant Access button to start the process.
Xcode opens App Store Connect in a web browser andprompts you to connect Xcode Cloud with GitHub.Connecting is a two-step process:
clickcomplete Step 1 in GitHub to open GitHub andlink your Apple ID.App Store Connect opens GitHub for authorization.
clickAuthorize Xcode Cloud to authorize Apple to link your Apple ID with GitHub.Now, GitHub prompts you to install the Xcode Cloud app.
clickinstall to complete the authorization andinstallation process.GitHub redirects you back to App Store Connect.
A green check mark means you’ve connected Xcode Cloud with GitHub! Apple even provides a handy button to re-open Xcode.Go ahead andclick the Continue in Xcode button.
Back in Xcode, the grant access button is no longer available, andyou’ll see another green check mark.
clickNext to continue creating your first workflow.Xcode Cloud has GitHub permissions now, but it looks like you’ve hit a new roadblock!
Xcode Cloud requires an app on App Store Connect with your app’s bundle identifier.Lucky for you, Xcode can create the app without even opening a browser.clickComplete to create your app.
The final green check mark means Xcode Cloud is ready for launch! At this point, you can create andrun workflows.
Go ahead andclick Start Build to kick off your very first Xcode Cloud build.Xcode Cloud immediately starts the build andswitches to the build info in Xcode.Xcode Cloud also sends you an email when the build finishes.Congrats on your first Xcode Cloud build.:]
In thenext section, you’ll set up a workflow to run the app’s unit andUI tests.