Continuous Integration

RSS for tag

Continuous integration is the process of automating and streamlining the building, analyzing, testing, and archiving of your apps, in order to ensure that they are always in a releasable state.

Posts under Continuous Integration tag

132 Posts

Post

Replies

Boosts

Views

Activity

Xcode builds create cruft in /private/var/folders/
I've got a Mac Mini running as a CI/CD server; it's a game project, and every time we push a change to the repo, the server creates a build & uploads it to TestFlight. I've noticed that after running the server for around a week or so, the main drive is getting filled to the point of the machine becoming unresponsive (and our builds failing). After some investigation, I've determined that /private/var/folders/ is getting filled up with... something, related to the Xcode build/archive. It seems like we absolutely do not need this information, so I've periodically run rm -rf /private/var/folders/* to clean it out – some folders are permission-protected, but regardless, I'm able to recover >100GB with this method. Although this workaround does suffice, I'm just wondering what kinds of files Xcode is creating here, and whether there's a cleaner/best-practice method to remove them.
0
1
1.2k
Sep ’23
Xcode cloud access source code after test execution
Hello, I'm trying to upload my code coverage to an external service. I've created a workflow on Xcode Cloud that build and run my test + a ci_post_xcodebuild script that uploads my Project.xcresult to an external service My problem here is that I need the repository source code the moment I upload my coverage file. I have two steps in my workflow: Build tests (Which contain the sources but not the coverage results) Run tests (Which contain the coverage result but not the sources) I found this in the Apple documentation: Lastly, it should be noted that in a test action, multiple environments are used to build and run your tests. Only the environment that is used for building your tests will have your source code cloned into it by default. The environments that run your tests won't have source code cloned into them. They'll only have the ci_scripts folder made available on them. As a result, the post-clone script won't run in these environments and your custom scripts and any of their dependencies, such as other shell scripts and small tools, must be entirely contained within the ci_scripts folder. Source: https://developer.apple.com/videos/play/wwdc2021/10269/ I feel a bit stuck here maybe Xcode cloud is not the way to go for this but I was wondering if by any way I could still check out my project sources after the test execution.
3
1
2.4k
Aug ’23
xcode cloud build performance
Hi, My name is Bin, software engineer at VBreathe in Sydney. We have a mobile app developed in Ionic Angular framework and managed to use xcode cloud to build and deploy the app to TestFlight. It worked well, but the speed is a bit slow, takes around 1 hour to finish the build. After checking the logs, the ci_post_clone.sh script took over 20 minutes to finish, because it installs bunch of tools and node packages, which are necessary to build the app. My question is that is there a way to cache these tools and node packages on xcode cloud, so no need to download & install them in every build? Cheers, Bin
2
0
3.0k
Aug ’23
Cannot connect App Store Connect to Slack for Xcode Cloud Notifications
I'm trying to connect my Developer Account in App Store Connect with Slack for CI notifications from Xcode Cloud. Apple docs for reference: https://developer.apple.com/documentation/xcode/connecting-xcode-cloud-to-slack#Install-the-Slack-app-for-Xcode- Cloud-using-App-Store-Connect I've tried connecting to the Slack workplace from the App Store Connect User settings and from Xcode Cloud in Xcode and on App Store Connect but no luck so far. The process always goes through and the Xcode Cloud Slack app gets installed on the Slack workspace. However it does not show up on the App Store Connect. I’ve attached a screenshot of the App Store Connect Notification Settings page after I went through the “Slack | Connect” flow successfully. It states “Your Slack account for has been connected”. However The Slack account still does not show as connected on the same page under "Send To”. Any help appreciated! Was anyone able to connect successfully?
2
0
1.3k
Jul ’23
Xcode Cloude + SonarQube analysis + Code Coverage is working... but...
Hello guys, I was able to get code coverage and sonar-scanner working with Xcode Cloud. First in, in post-clone script I install sonar-scanner tool like this brew install sonar-scanner Then, in post-xcodebuild script, I do three things: (a) get current app version, (b) get app version, (c) run xcodebuild again with forced code coverage reporting, (d) find coverage data and convert it to the format that Sonarqube understands, and finally (e) run sonar-scanner, which uploads results to Sonarqube dashboard. cd $CI_WORKSPACE # declare variables SCHEME=[REMOVED] PRODUCT_NAME=[REMOVED] WORKSPACE_NAME=${PRODUCT_NAME}.xcworkspace APP_VERSION=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' ./${PRODUCT_NAME}.xcodeproj/project.pbxproj) # clean, build and test project xcodebuild \ -workspace ${WORKSPACE_NAME} \ -destination 'platform=iOS Simulator,name=iPad (10th generation),OS=latest' \ -scheme ${SCHEME} \ -derivedDataPath DerivedData/ \ -enableCodeCoverage YES \ -resultBundlePath DerivedData/Logs/Test/ResultBundle.xcresult \ clean build test # find profdata and binary PROFDATA=$(find . -name "Coverage.profdata") BINARY=$(find . -path "*${PRODUCT_NAME}.app/${PRODUCT_NAME}") # check if we have profdata file if [[ -z $PROFDATA ]]; then echo "ERROR: Unable to find Coverage.profdata. Be sure to execute tests before running this script." exit 1 fi # extract coverage data from project using xcode native tool xcrun --run llvm-cov show -instr-profile=${PROFDATA} ${BINARY} > sonarqube-coverage.report # run sonar scanner and upload coverage data with the current app version sonar-scanner \ -Dsonar.projectVersion=${APP_VERSION} It all works fine but my team and I think that this is a workaround that shouldn't work like this, because technically xcodebuild command is executed two times, first by Xcode Cloud, then by my script, which takes a lot of time and feels hacky. Ideally, Xcode Cloud's Build and Test actions should generate code coverage (the option is already enabled in our project) and give us access to profile data in DerivedData folder which I can access with environment variable CI_DERIVED_DATA_PATH. However, there is none. My question is, do I do everything correctly? Is there a way to improve this flow? Do I miss on how to correctly get code coverage data from Xcode Cloud?
3
2
3.4k
Jul ’23
develop 1 project on 2 macs?
I have two macs at home. One in my bedroom which is my development mac and one in my living room which is an old mac i put to good use. i would like to occasionally sit in my living room and continue my work from there to avoid fatigue sitting at my desk all day. i have enabled source control using local git repo. how can i continue with my xcode project on my second mac which runs the same os x?
19
0
15k
Jul ’23
Xcode Cloud: How to trigger testing for packages?
Hello! I have a Swift package (SPM) with a number of tests associated with it. These all work well locally, and I have created a GitHub repository for the package that can be used by any app. I would like to set it up where my package's tests are triggered automatically whenever I push a change to a branch in the repository. Unfortunately, per the documentation, Xcode Cloud is currently unable to build and test standalone Swift packages. I hope that this will be rectified some point soon as automated testing for them seems like it'd be a pretty common and understandable use case. My question: Is there a way to set an Xcode Cloud workflow up wherein a package's tests are triggered? Xcode Cloud clearly does support Swift packages that are used when building full apps, and there is plenty of documentation to that end. But it's not clear how to trigger those package's tests even through the use of a "dummy" app without moving a bunch of tests to the app itself. Is this possible? I'd really not like to duplicate all my tests in a dummy app if at all possible. Thanks!
2
1
5.5k
Jun ’23
How to handle TCC permissions on machines for UI test automation?
Hello, we have a bunch of macs which we use for running automated UI test and we need to allow services kTCCServiceScreenCapture and kTCCServiceAccessibility to our application bundles (it's a kind of a screen sharing application). We tried to do a direct change in: User's ~/Library/Application Support/com.apple.TCC/TCC.db but it doesn't take effect as it looks like these permissions need to be granted in system TCC database The system database at /Library/Application Support/com.apple.TCC/TCC.db is write-only due to rootless. Is there any other way than completely disable SIP to grant these TCC permissions to our bundles? Also we would be just fine to grant permissions manually when we're setting up the machine, but it seems these get reset from time to time. And that's my other question: How the TCC validation works? We're testing ad-hoc signed bundles as well as DeveloperID signed ones with the same Application ID and it seems that TCC gets confused over time and simply treats the permissions as not granted. Would modifying csreq in TCC.db record to contain only requirement identifier=my.bundle.app.id prevent this behavior or there is some other heuristics TCC uses for permission validation? Thank you, o/
4
0
3k
Jun ’23
Xcode Server "Authentication failed because the credentials were missing"
I am struggling to get my Xcode Server working using Xcode 14.2 It used to work, but since the 14.3 upgrade left the Xcode builder constantly crashing (FB12090800) i'm trying to get it set back up in Xcode 14.2 I've completely reset everything by deleting all Keychain entries regarding Xcode and using the command sudo xcrun xcscontrol --reset Now when I run my new integrations, I get the error: Authentication failed because the credentials were missing I've created a new RSA certificate as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent Added it to my Github account as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account When I click Edit Bot... in Xcode and select the Repositories tab it successfully loads my repo. Yet when I click to Integrate the bot, it fails with the auth error. Xcode server is running on my main mac under the same root user I log in as. The failed integration offers up a Fix it button, but that crashes Xcode (FB11875463) and has done for all of Xcode 14.x I can load up Xcode 13 and hit the Fix it button, but all it does is open the same Repositories tab that successfully loads my repo. I've tried adding this to my GitHub config but it makes no difference: [url "ssh://git@github.com/"] insteadOf = https://github.com/ What else can I try?
1
1
2.4k
Apr ’23
launchctl LaunchDaemons and keychain access
Hi everyone, I'm struggling to access a certificate stored in keychain when using LaunchDaemons and would appreciate any advise to improve over my current workaround with an agent. I'm maintaining an M1-based Mac Mini with macOS Big Sur 11.4 as a build client for Gitlab CI. The machine makes itself known to the orchestrating Gitlab server through the so-called gitlab-runner process which regularly polls the Giltab server for build job requests. It would then eventually call xcodebuild to generate artifacts and upload them to Gitlab. In order to have this process startup automatically, I've loaded it through a /Library/LaunchDaemons/gitlab-runner.plist file in launchctl. This setup has been working greatly for months, making the build client immediately available after a reboot without the need to log into it. I've now started to deploy codesign tasks to the build client and encountered issues with keychain access to the certificate. I installed the certificate and performed security find-identity -v -p codesigning in the Terminal to validate correct installation. I have ensured that the codesign tasks succeed when performed through Terminal manually. A popup was shown on first try about codesign wanting to access to the local keychain, which I always allowed. Codesign then reported success: signed Mach-O universal. The behavior is different for my LaunchDaemons-based codesign tasks (spawned under the same user). I've tried multiple permutations for sudo launchctl load -w /Library/LaunchDaemons/gitlab-runner.plist: SessionCreate=true, local keychain: FAIL (errSecInternalComponent) SessionCreate=true, System keychain: FAIL (errSecInternalComponent) SessionCreate=false, local keychain: FAIL (error: The specified item could not be found in the keychain.) SessionCreate=false, System keychain: FAIL (errSecInternalComponent) I've then tried a user agent launchctl load -w ~/Library/LaunchAgents/gitlab-runner.plist: SessionCreate=true, local keychain: FAIL (errSecInternalComponent) SessionCreate=false, local keychain: OK (Popup -> Always allow, signed Mach-O universal) So apparently, the last variant works reliably. However, it has the severe downside that I now need to log in the user after a reboot in order to kick off the agent. Is there a way to make this work with /Library/LaunchDaemons, possibly through some plist property? As a test I've tried to "Allow all applications" to access the private key associated with the Certificate but that didn't change anything. Best regards Maik
7
0
5.9k
Apr ’23
Xcode Cloud not sending notification emails
I have some Test actions setup in Xcode cloud. Under Post-Actions I have selected Notify - Success and Failures. At the bottom it says: You automatically receive email or Slack notifications for your builds Yet I don't receive any emails... If I add an email address to the Notify section, I now receive 2x emails. 1 to the email I added and 1 to the email on my account. If I change the added email to be the same as the one on my account, I get 2x emails to that address. This is as expected. However if I remove the added email, I get no emails at all, whereas i'd expect to receive an email to my account address.
0
0
1.3k
Apr ’23
Where is Swift Package Manager cache located (Xcode 12.5)?
There is a question on stackoverflow for that too: https://stackoverflow.com/questions/66143815/xcode-12-5-spm-dependency-cache-location Xcode 12.5 release notes mention the "per-user-basis" cache for SPM dependencies: https://developer.apple.com/documentation/xcode-release-notes/xcode-12_5-beta-release-notes Is the location outside of DerivedData folder so cache still persists somewhere in ~/Library/Caches and can be reused even for clean build? It's very important to know for CI performance! Any guidance/help is appreciated.
2
0
17k
Mar ’23
xCode "discard all changes" removed files - need help
Hello,I had *.png files (as binary data) in my xCode project. I don't need those files anymore so I removed them locally.In the meantime I created new files (*.cpp, *.h and other *.png). And after all I tried to commit project. But there was old files marked with "!".So I went to Github repository through website and removed those files by my own.Then when I tried to commit project from xCode, the removed files was still marked with "!". But I decide to uncheck them and commit.But then I get error that my repository locally is out of date, but mark "M" from all files (M - means files to commit) disappeared. But on github website there was still old files.So I tried various things, and suddenly I clicked in xCode "discard all changes" (but please notice there was no "M" mark, just "?" mark on new files), and all those new files disappeared from my project, from finder, from anywhere.I lost whole day work. Is there any way to recovery those files? I didn't make any backups during day. But did those files really disappear permanently? Isn't there any "trash" or "temp" folder for such files?I tried to checkout repository from commit history, but it doesn't help. The file is still in red colour in the browser, and doesn't exist anywhere on the drive.
2
0
2.9k
Mar ’23
CoreData in SPM Package
I've developed an SPM module in which I have a CoreData model defined as a xcdatamodeld file and I'm having trouble executing tests from the command line, which I want for a CI integration. In the package I load the model by constructing a URL using Bundle.module.url(forResource: "ModelName", withExtension: "momd"). This works when building and testing in Xcode. When executing commands such as swift test from the terminal however, it doesn't, as Bundle.module.url(forResource:withExtension) fails to find the file. Comparing the build artifacts between Xcode's DerivedData and SPM's .build I see that both produce a PackageName_PackageName.bundle but while the Xcode version contains a momd file the SPM version contains an unprocessed xcdatamodeld file. I've tried adding the xcdatamodeld as an explicit resource in the Package.swift file such that the package target now includes resources: [.process("Resources/ModelName.xcdatamodeld")] as an argument. This does not impact the Bundle output. Any ideas how I can address this to be able to execute unit tests via the command line? Historically I suppose the solution would be to use generate-xcodeproj but my understanding is that that has been deprecated and executing it via Xcode 14.2 fails due to a missing toolchain tool.
1
1
2.1k
Mar ’23
Building apps with EndpointSecurity entitlements in Amazon EC2 Mac instances
I'm thinking of transitioning the build infrastructure from locally managed build machines to the cloud. Unfortunately Xcode Cloud is not an option as I'm building an EndpointSecurity app, and then run build scripts to package it into a pkg. So I'm looking into using Amazon EC2 instances for it. Apps with EnpointSecurity entitlements require special provisioning profiles during codesigning, which can be easily setup in Xcode project and then fetched during xcodebuild when -allowProvisioningUpdates is passed. But this requires signing in with developer account in Xcode and also automatically adds the device to the Apple development program. In case of building with random EC2 instances it can be a new machine each time, and using a flag -allowProvisioningDeviceRegistration will quickly reach a quota of 100 device. How can this be solved? Will adding a logged in Xcode to an AMI image just once help?
0
0
870
Jan ’23
Swift Package xcodebuild "error: Build input file cannot be found"
Hi! I'm currently developing a swift package for the first time. I was trying to setup CI to run my tests but ran into an error locally. I can run my tests just fine in Xcode, but when using the xcodebuild command line tool I get this error: "error: Build input file cannot be found:" Here's some additional info that may be useful. Command xcodebuild test -scheme Project -destination 'platform=macOS,arch=arm64' | xcpretty -s Full output --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, id:00006000-001658C63C23801E } { platform:macOS, arch:arm64, variant:Mac Catalyst, id:00006000-001658C63C23801E } { platform:macOS, arch:arm64, variant:DriverKit, id:00006000-001658C63C23801E } ❌ error: Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project') ❌ error: Build input file cannot be found: '/path/to/Project/Sources/PRoject/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project') Testing failed: Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? Testing cancelled because the build failed. ** TEST FAILED ** The following build commands failed: SwiftDriver\ Compilation\ Requirements Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project') SwiftDriver\ Compilation Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project') (2 failures) Package.swift // swift-tools-version: 5.7 import PackageDescription let package = Package(   name: "Project",   platforms: [     .macOS(.v12)   ],   dependencies: [     .package(url: "https://github.com/apple/swift-syntax.git", exact: "0.50700.1"),     .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.1")   ],   targets: [     .executableTarget(       name: "Project",       dependencies: [         .product(name: "SwiftSyntax", package: "swift-syntax"),         .product(name: "ArgumentParser", package: "swift-argument-parser")       ]     ),     .testTarget(       name: "ProjectTests",       dependencies: ["Project"]),   ] )
0
0
2.1k
Jan ’23
"DVTPortal: Error: Your session has expired" with xcodebuild
Hi,I'm attempting to use xcodebuild to automate our release process. Because our build has an associated provisioning profile, I have added the `-allowProvisioningUpdates` flag to the xcodebuild command.If I run my xcodebuild command while logged in locally to the build machine, Xcode's automatic process of downloading the correct prov profile appears to work - the archive completes succesfully.However. If I ssh into the build machine and run the exact same xcodebuild command, I get the following error.2019-10-08 00:04:50.828 xcodebuild[53165:1665565] DVTPortal: Service '' encountered an unexpected result code from the portal ('1100') 2019-10-08 00:04:50.828 xcodebuild[53165:1665565] DVTPortal: Error: Error Domain=DVTPortalServiceErrorDomain Code=1100 "Your session has expired. Please log in." UserInfo={payload={type = mutable dict, count = 9, entries => 0 : responseId = {contents = "78442697-9dda-449d-90b7-cfc0d646fde4"} 2 : {contents = "protocolVersion"} = QH65B2 3 : {contents = "requestUrl"} = {contents = "https://developerservices2.apple.com/services/QH65B2/viewDeveloper.action"} 6 : {contents = "userLocale"} = en_US 8 : resultCode = {value = +1100, type = kCFNumberSInt64Type} 9 : userString = {contents = "Your session has expired. Please log in."} 10 : {contents = "resultString"} = {contents = "Your session has expired. Please log in."} 11 : httpCode = {value = +200, type = kCFNumberSInt64Type} 12 : {contents = "creationTimestamp"} = {contents = "2019-10-07T22:04:50Z"} } , NSLocalizedDescription=Your session has expired. Please log in.}In my attempts to fix this issue I made sure the login keychain was unlocked using the `security` command, but it made no difference.Is there any way of fixing this? Is it possible to log into the service via the command line?The user I ssh in as is present in the Accounts pane of Xcode, but I guess this login is somehow "lost" over ssh.Thanks in advance!Heather.
6
1
22k
Jan ’23
ld: library not found for -lBoringSSL-GRPC Xcodebuild React Native
I have been trying to solve this issue for a week, and I know that there are a lot of similar questions like this already solved, but none of them works for me, I would appreciate any help. I am building a CI/CD pipeline for my React Native application, and this is the IOS part. I am trying to build from the Bitbucket Pipelines over an SSH connection on a remote Mac. I am trying to build an Xcode achieve, it works when I do it manually on the remote Mac, from Xcode, but when I run this command I get an error. xcodebuild archive -scheme dst -configuration Release -archivePath ../builds/dst.xcarchive -workspace dst.xcworkspace PROVISIONING_PROFILE_SPECIFIER="test-dst-provisioning-release" -UseModernBuildSystem=NO CODE_SIGN_STYLE="Manual" CODE_SIGN_IDENTITY="Apple Distribution: $(Team code)" This is the error I get: Ld /Users/user931603/Library/Developer/Xcode/DerivedData/dst-gisgtbcaheaxrqbgvvzueprfinbl/Build/Intermediates.noindex/ArchiveIntermediates/dst/InstallationBuildProductsLocation/Applications/dst.app/dst normal arm64 cd /Users/user931603/build/dst-mobile-prototype/ios export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/user931603/.nvm/versions/node/v14.17.6/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/munki:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin" ld: warning: directory not found for option '-L-L/Users/user931603/Library/Developer/Xcode/DerivedData/dst-gisgtbcaheaxrqbgvvzueprfinbl/Build/Intermediates.noindex/ArchiveIntermediates/dst/BuildProductsPath/Release-iphoneos/BoringSSL-GRPC' ld: library not found for -lBoringSSL-GRPC clang: error: linker command failed with exit code 1 (use -v to see invocation) For a while I thought that I have a problem with the Library Search Paths These are my Target - Build settings - Library Search Paths These are my Project - Build settings - Library Search Paths But then it turned out that the achieve works from Xcode, but it doesn't work when I do it remotely on the terminal, so I think there must be an issue with the environment variables or something like this. I use Cocoapods, there can be a problem with that, the settings are the ones generated automatically by React Native. I have no clue about this issue, I would appreciate greatly if you could help!
1
0
4.3k
Dec ’22
Xcode 12 Beta 2 causes Xcode Server to be unmanageable
FB7864358 Upon replacing Xcode 12.0 Beta 1 with 12.0 Beta 2, the Xcode Server settings configuration is no longer accessible. One the 'Server & Bots' preference pane the message presented is: Xcode Server Is Already Running Your computer is already configured to run Xcode Server and this version of Xcode is not compatible. If you manually switch the service off and back on, an alert is presented with the following: This version of Xcode is not supported (version is too old) I have managed to revert back to Xcode 12.0 Beta one, and continue managing my server. Has anyone had the same experience or any suggestions on getting Xcode 12.0 Beta 2 to work with Xcode Server?
2
0
1.6k
Dec ’22
Xcode builds create cruft in /private/var/folders/
I've got a Mac Mini running as a CI/CD server; it's a game project, and every time we push a change to the repo, the server creates a build & uploads it to TestFlight. I've noticed that after running the server for around a week or so, the main drive is getting filled to the point of the machine becoming unresponsive (and our builds failing). After some investigation, I've determined that /private/var/folders/ is getting filled up with... something, related to the Xcode build/archive. It seems like we absolutely do not need this information, so I've periodically run rm -rf /private/var/folders/* to clean it out – some folders are permission-protected, but regardless, I'm able to recover >100GB with this method. Although this workaround does suffice, I'm just wondering what kinds of files Xcode is creating here, and whether there's a cleaner/best-practice method to remove them.
Replies
0
Boosts
1
Views
1.2k
Activity
Sep ’23
Xcode cloud access source code after test execution
Hello, I'm trying to upload my code coverage to an external service. I've created a workflow on Xcode Cloud that build and run my test + a ci_post_xcodebuild script that uploads my Project.xcresult to an external service My problem here is that I need the repository source code the moment I upload my coverage file. I have two steps in my workflow: Build tests (Which contain the sources but not the coverage results) Run tests (Which contain the coverage result but not the sources) I found this in the Apple documentation: Lastly, it should be noted that in a test action, multiple environments are used to build and run your tests. Only the environment that is used for building your tests will have your source code cloned into it by default. The environments that run your tests won't have source code cloned into them. They'll only have the ci_scripts folder made available on them. As a result, the post-clone script won't run in these environments and your custom scripts and any of their dependencies, such as other shell scripts and small tools, must be entirely contained within the ci_scripts folder. Source: https://developer.apple.com/videos/play/wwdc2021/10269/ I feel a bit stuck here maybe Xcode cloud is not the way to go for this but I was wondering if by any way I could still check out my project sources after the test execution.
Replies
3
Boosts
1
Views
2.4k
Activity
Aug ’23
xcode cloud build performance
Hi, My name is Bin, software engineer at VBreathe in Sydney. We have a mobile app developed in Ionic Angular framework and managed to use xcode cloud to build and deploy the app to TestFlight. It worked well, but the speed is a bit slow, takes around 1 hour to finish the build. After checking the logs, the ci_post_clone.sh script took over 20 minutes to finish, because it installs bunch of tools and node packages, which are necessary to build the app. My question is that is there a way to cache these tools and node packages on xcode cloud, so no need to download & install them in every build? Cheers, Bin
Replies
2
Boosts
0
Views
3.0k
Activity
Aug ’23
Cannot connect App Store Connect to Slack for Xcode Cloud Notifications
I'm trying to connect my Developer Account in App Store Connect with Slack for CI notifications from Xcode Cloud. Apple docs for reference: https://developer.apple.com/documentation/xcode/connecting-xcode-cloud-to-slack#Install-the-Slack-app-for-Xcode- Cloud-using-App-Store-Connect I've tried connecting to the Slack workplace from the App Store Connect User settings and from Xcode Cloud in Xcode and on App Store Connect but no luck so far. The process always goes through and the Xcode Cloud Slack app gets installed on the Slack workspace. However it does not show up on the App Store Connect. I’ve attached a screenshot of the App Store Connect Notification Settings page after I went through the “Slack | Connect” flow successfully. It states “Your Slack account for has been connected”. However The Slack account still does not show as connected on the same page under "Send To”. Any help appreciated! Was anyone able to connect successfully?
Replies
2
Boosts
0
Views
1.3k
Activity
Jul ’23
Xcode Cloude + SonarQube analysis + Code Coverage is working... but...
Hello guys, I was able to get code coverage and sonar-scanner working with Xcode Cloud. First in, in post-clone script I install sonar-scanner tool like this brew install sonar-scanner Then, in post-xcodebuild script, I do three things: (a) get current app version, (b) get app version, (c) run xcodebuild again with forced code coverage reporting, (d) find coverage data and convert it to the format that Sonarqube understands, and finally (e) run sonar-scanner, which uploads results to Sonarqube dashboard. cd $CI_WORKSPACE # declare variables SCHEME=[REMOVED] PRODUCT_NAME=[REMOVED] WORKSPACE_NAME=${PRODUCT_NAME}.xcworkspace APP_VERSION=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' ./${PRODUCT_NAME}.xcodeproj/project.pbxproj) # clean, build and test project xcodebuild \ -workspace ${WORKSPACE_NAME} \ -destination 'platform=iOS Simulator,name=iPad (10th generation),OS=latest' \ -scheme ${SCHEME} \ -derivedDataPath DerivedData/ \ -enableCodeCoverage YES \ -resultBundlePath DerivedData/Logs/Test/ResultBundle.xcresult \ clean build test # find profdata and binary PROFDATA=$(find . -name "Coverage.profdata") BINARY=$(find . -path "*${PRODUCT_NAME}.app/${PRODUCT_NAME}") # check if we have profdata file if [[ -z $PROFDATA ]]; then echo "ERROR: Unable to find Coverage.profdata. Be sure to execute tests before running this script." exit 1 fi # extract coverage data from project using xcode native tool xcrun --run llvm-cov show -instr-profile=${PROFDATA} ${BINARY} > sonarqube-coverage.report # run sonar scanner and upload coverage data with the current app version sonar-scanner \ -Dsonar.projectVersion=${APP_VERSION} It all works fine but my team and I think that this is a workaround that shouldn't work like this, because technically xcodebuild command is executed two times, first by Xcode Cloud, then by my script, which takes a lot of time and feels hacky. Ideally, Xcode Cloud's Build and Test actions should generate code coverage (the option is already enabled in our project) and give us access to profile data in DerivedData folder which I can access with environment variable CI_DERIVED_DATA_PATH. However, there is none. My question is, do I do everything correctly? Is there a way to improve this flow? Do I miss on how to correctly get code coverage data from Xcode Cloud?
Replies
3
Boosts
2
Views
3.4k
Activity
Jul ’23
develop 1 project on 2 macs?
I have two macs at home. One in my bedroom which is my development mac and one in my living room which is an old mac i put to good use. i would like to occasionally sit in my living room and continue my work from there to avoid fatigue sitting at my desk all day. i have enabled source control using local git repo. how can i continue with my xcode project on my second mac which runs the same os x?
Replies
19
Boosts
0
Views
15k
Activity
Jul ’23
Xcode Cloud: How to trigger testing for packages?
Hello! I have a Swift package (SPM) with a number of tests associated with it. These all work well locally, and I have created a GitHub repository for the package that can be used by any app. I would like to set it up where my package's tests are triggered automatically whenever I push a change to a branch in the repository. Unfortunately, per the documentation, Xcode Cloud is currently unable to build and test standalone Swift packages. I hope that this will be rectified some point soon as automated testing for them seems like it'd be a pretty common and understandable use case. My question: Is there a way to set an Xcode Cloud workflow up wherein a package's tests are triggered? Xcode Cloud clearly does support Swift packages that are used when building full apps, and there is plenty of documentation to that end. But it's not clear how to trigger those package's tests even through the use of a "dummy" app without moving a bunch of tests to the app itself. Is this possible? I'd really not like to duplicate all my tests in a dummy app if at all possible. Thanks!
Replies
2
Boosts
1
Views
5.5k
Activity
Jun ’23
How to handle TCC permissions on machines for UI test automation?
Hello, we have a bunch of macs which we use for running automated UI test and we need to allow services kTCCServiceScreenCapture and kTCCServiceAccessibility to our application bundles (it's a kind of a screen sharing application). We tried to do a direct change in: User's ~/Library/Application Support/com.apple.TCC/TCC.db but it doesn't take effect as it looks like these permissions need to be granted in system TCC database The system database at /Library/Application Support/com.apple.TCC/TCC.db is write-only due to rootless. Is there any other way than completely disable SIP to grant these TCC permissions to our bundles? Also we would be just fine to grant permissions manually when we're setting up the machine, but it seems these get reset from time to time. And that's my other question: How the TCC validation works? We're testing ad-hoc signed bundles as well as DeveloperID signed ones with the same Application ID and it seems that TCC gets confused over time and simply treats the permissions as not granted. Would modifying csreq in TCC.db record to contain only requirement identifier=my.bundle.app.id prevent this behavior or there is some other heuristics TCC uses for permission validation? Thank you, o/
Replies
4
Boosts
0
Views
3k
Activity
Jun ’23
What do we need to Integrate our software with GSX?
I want to integrate my software with Apple's Global Service Exchange (GSX). Can anyone guide me through the process?
Replies
1
Boosts
0
Views
1.3k
Activity
May ’23
Xcode Server "Authentication failed because the credentials were missing"
I am struggling to get my Xcode Server working using Xcode 14.2 It used to work, but since the 14.3 upgrade left the Xcode builder constantly crashing (FB12090800) i'm trying to get it set back up in Xcode 14.2 I've completely reset everything by deleting all Keychain entries regarding Xcode and using the command sudo xcrun xcscontrol --reset Now when I run my new integrations, I get the error: Authentication failed because the credentials were missing I've created a new RSA certificate as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent Added it to my Github account as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account When I click Edit Bot... in Xcode and select the Repositories tab it successfully loads my repo. Yet when I click to Integrate the bot, it fails with the auth error. Xcode server is running on my main mac under the same root user I log in as. The failed integration offers up a Fix it button, but that crashes Xcode (FB11875463) and has done for all of Xcode 14.x I can load up Xcode 13 and hit the Fix it button, but all it does is open the same Repositories tab that successfully loads my repo. I've tried adding this to my GitHub config but it makes no difference: [url "ssh://git@github.com/"] insteadOf = https://github.com/ What else can I try?
Replies
1
Boosts
1
Views
2.4k
Activity
Apr ’23
launchctl LaunchDaemons and keychain access
Hi everyone, I'm struggling to access a certificate stored in keychain when using LaunchDaemons and would appreciate any advise to improve over my current workaround with an agent. I'm maintaining an M1-based Mac Mini with macOS Big Sur 11.4 as a build client for Gitlab CI. The machine makes itself known to the orchestrating Gitlab server through the so-called gitlab-runner process which regularly polls the Giltab server for build job requests. It would then eventually call xcodebuild to generate artifacts and upload them to Gitlab. In order to have this process startup automatically, I've loaded it through a /Library/LaunchDaemons/gitlab-runner.plist file in launchctl. This setup has been working greatly for months, making the build client immediately available after a reboot without the need to log into it. I've now started to deploy codesign tasks to the build client and encountered issues with keychain access to the certificate. I installed the certificate and performed security find-identity -v -p codesigning in the Terminal to validate correct installation. I have ensured that the codesign tasks succeed when performed through Terminal manually. A popup was shown on first try about codesign wanting to access to the local keychain, which I always allowed. Codesign then reported success: signed Mach-O universal. The behavior is different for my LaunchDaemons-based codesign tasks (spawned under the same user). I've tried multiple permutations for sudo launchctl load -w /Library/LaunchDaemons/gitlab-runner.plist: SessionCreate=true, local keychain: FAIL (errSecInternalComponent) SessionCreate=true, System keychain: FAIL (errSecInternalComponent) SessionCreate=false, local keychain: FAIL (error: The specified item could not be found in the keychain.) SessionCreate=false, System keychain: FAIL (errSecInternalComponent) I've then tried a user agent launchctl load -w ~/Library/LaunchAgents/gitlab-runner.plist: SessionCreate=true, local keychain: FAIL (errSecInternalComponent) SessionCreate=false, local keychain: OK (Popup -> Always allow, signed Mach-O universal) So apparently, the last variant works reliably. However, it has the severe downside that I now need to log in the user after a reboot in order to kick off the agent. Is there a way to make this work with /Library/LaunchDaemons, possibly through some plist property? As a test I've tried to "Allow all applications" to access the private key associated with the Certificate but that didn't change anything. Best regards Maik
Replies
7
Boosts
0
Views
5.9k
Activity
Apr ’23
Xcode Cloud not sending notification emails
I have some Test actions setup in Xcode cloud. Under Post-Actions I have selected Notify - Success and Failures. At the bottom it says: You automatically receive email or Slack notifications for your builds Yet I don't receive any emails... If I add an email address to the Notify section, I now receive 2x emails. 1 to the email I added and 1 to the email on my account. If I change the added email to be the same as the one on my account, I get 2x emails to that address. This is as expected. However if I remove the added email, I get no emails at all, whereas i'd expect to receive an email to my account address.
Replies
0
Boosts
0
Views
1.3k
Activity
Apr ’23
Where is Swift Package Manager cache located (Xcode 12.5)?
There is a question on stackoverflow for that too: https://stackoverflow.com/questions/66143815/xcode-12-5-spm-dependency-cache-location Xcode 12.5 release notes mention the "per-user-basis" cache for SPM dependencies: https://developer.apple.com/documentation/xcode-release-notes/xcode-12_5-beta-release-notes Is the location outside of DerivedData folder so cache still persists somewhere in ~/Library/Caches and can be reused even for clean build? It's very important to know for CI performance! Any guidance/help is appreciated.
Replies
2
Boosts
0
Views
17k
Activity
Mar ’23
xCode "discard all changes" removed files - need help
Hello,I had *.png files (as binary data) in my xCode project. I don't need those files anymore so I removed them locally.In the meantime I created new files (*.cpp, *.h and other *.png). And after all I tried to commit project. But there was old files marked with "!".So I went to Github repository through website and removed those files by my own.Then when I tried to commit project from xCode, the removed files was still marked with "!". But I decide to uncheck them and commit.But then I get error that my repository locally is out of date, but mark "M" from all files (M - means files to commit) disappeared. But on github website there was still old files.So I tried various things, and suddenly I clicked in xCode "discard all changes" (but please notice there was no "M" mark, just "?" mark on new files), and all those new files disappeared from my project, from finder, from anywhere.I lost whole day work. Is there any way to recovery those files? I didn't make any backups during day. But did those files really disappear permanently? Isn't there any "trash" or "temp" folder for such files?I tried to checkout repository from commit history, but it doesn't help. The file is still in red colour in the browser, and doesn't exist anywhere on the drive.
Replies
2
Boosts
0
Views
2.9k
Activity
Mar ’23
CoreData in SPM Package
I've developed an SPM module in which I have a CoreData model defined as a xcdatamodeld file and I'm having trouble executing tests from the command line, which I want for a CI integration. In the package I load the model by constructing a URL using Bundle.module.url(forResource: "ModelName", withExtension: "momd"). This works when building and testing in Xcode. When executing commands such as swift test from the terminal however, it doesn't, as Bundle.module.url(forResource:withExtension) fails to find the file. Comparing the build artifacts between Xcode's DerivedData and SPM's .build I see that both produce a PackageName_PackageName.bundle but while the Xcode version contains a momd file the SPM version contains an unprocessed xcdatamodeld file. I've tried adding the xcdatamodeld as an explicit resource in the Package.swift file such that the package target now includes resources: [.process("Resources/ModelName.xcdatamodeld")] as an argument. This does not impact the Bundle output. Any ideas how I can address this to be able to execute unit tests via the command line? Historically I suppose the solution would be to use generate-xcodeproj but my understanding is that that has been deprecated and executing it via Xcode 14.2 fails due to a missing toolchain tool.
Replies
1
Boosts
1
Views
2.1k
Activity
Mar ’23
Building apps with EndpointSecurity entitlements in Amazon EC2 Mac instances
I'm thinking of transitioning the build infrastructure from locally managed build machines to the cloud. Unfortunately Xcode Cloud is not an option as I'm building an EndpointSecurity app, and then run build scripts to package it into a pkg. So I'm looking into using Amazon EC2 instances for it. Apps with EnpointSecurity entitlements require special provisioning profiles during codesigning, which can be easily setup in Xcode project and then fetched during xcodebuild when -allowProvisioningUpdates is passed. But this requires signing in with developer account in Xcode and also automatically adds the device to the Apple development program. In case of building with random EC2 instances it can be a new machine each time, and using a flag -allowProvisioningDeviceRegistration will quickly reach a quota of 100 device. How can this be solved? Will adding a logged in Xcode to an AMI image just once help?
Replies
0
Boosts
0
Views
870
Activity
Jan ’23
Swift Package xcodebuild "error: Build input file cannot be found"
Hi! I'm currently developing a swift package for the first time. I was trying to setup CI to run my tests but ran into an error locally. I can run my tests just fine in Xcode, but when using the xcodebuild command line tool I get this error: "error: Build input file cannot be found:" Here's some additional info that may be useful. Command xcodebuild test -scheme Project -destination 'platform=macOS,arch=arm64' | xcpretty -s Full output --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, id:00006000-001658C63C23801E } { platform:macOS, arch:arm64, variant:Mac Catalyst, id:00006000-001658C63C23801E } { platform:macOS, arch:arm64, variant:DriverKit, id:00006000-001658C63C23801E } ❌ error: Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project') ❌ error: Build input file cannot be found: '/path/to/Project/Sources/PRoject/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Project from project 'Project') Testing failed: Build input file cannot be found: '/path/to/Project/Sources/Project/main.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? Testing cancelled because the build failed. ** TEST FAILED ** The following build commands failed: SwiftDriver\ Compilation\ Requirements Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project') SwiftDriver\ Compilation Project normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Project' from project 'Project') (2 failures) Package.swift // swift-tools-version: 5.7 import PackageDescription let package = Package(   name: "Project",   platforms: [     .macOS(.v12)   ],   dependencies: [     .package(url: "https://github.com/apple/swift-syntax.git", exact: "0.50700.1"),     .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.1")   ],   targets: [     .executableTarget(       name: "Project",       dependencies: [         .product(name: "SwiftSyntax", package: "swift-syntax"),         .product(name: "ArgumentParser", package: "swift-argument-parser")       ]     ),     .testTarget(       name: "ProjectTests",       dependencies: ["Project"]),   ] )
Replies
0
Boosts
0
Views
2.1k
Activity
Jan ’23
"DVTPortal: Error: Your session has expired" with xcodebuild
Hi,I'm attempting to use xcodebuild to automate our release process. Because our build has an associated provisioning profile, I have added the `-allowProvisioningUpdates` flag to the xcodebuild command.If I run my xcodebuild command while logged in locally to the build machine, Xcode's automatic process of downloading the correct prov profile appears to work - the archive completes succesfully.However. If I ssh into the build machine and run the exact same xcodebuild command, I get the following error.2019-10-08 00:04:50.828 xcodebuild[53165:1665565] DVTPortal: Service '' encountered an unexpected result code from the portal ('1100') 2019-10-08 00:04:50.828 xcodebuild[53165:1665565] DVTPortal: Error: Error Domain=DVTPortalServiceErrorDomain Code=1100 "Your session has expired. Please log in." UserInfo={payload={type = mutable dict, count = 9, entries => 0 : responseId = {contents = "78442697-9dda-449d-90b7-cfc0d646fde4"} 2 : {contents = "protocolVersion"} = QH65B2 3 : {contents = "requestUrl"} = {contents = "https://developerservices2.apple.com/services/QH65B2/viewDeveloper.action"} 6 : {contents = "userLocale"} = en_US 8 : resultCode = {value = +1100, type = kCFNumberSInt64Type} 9 : userString = {contents = "Your session has expired. Please log in."} 10 : {contents = "resultString"} = {contents = "Your session has expired. Please log in."} 11 : httpCode = {value = +200, type = kCFNumberSInt64Type} 12 : {contents = "creationTimestamp"} = {contents = "2019-10-07T22:04:50Z"} } , NSLocalizedDescription=Your session has expired. Please log in.}In my attempts to fix this issue I made sure the login keychain was unlocked using the `security` command, but it made no difference.Is there any way of fixing this? Is it possible to log into the service via the command line?The user I ssh in as is present in the Accounts pane of Xcode, but I guess this login is somehow "lost" over ssh.Thanks in advance!Heather.
Replies
6
Boosts
1
Views
22k
Activity
Jan ’23
ld: library not found for -lBoringSSL-GRPC Xcodebuild React Native
I have been trying to solve this issue for a week, and I know that there are a lot of similar questions like this already solved, but none of them works for me, I would appreciate any help. I am building a CI/CD pipeline for my React Native application, and this is the IOS part. I am trying to build from the Bitbucket Pipelines over an SSH connection on a remote Mac. I am trying to build an Xcode achieve, it works when I do it manually on the remote Mac, from Xcode, but when I run this command I get an error. xcodebuild archive -scheme dst -configuration Release -archivePath ../builds/dst.xcarchive -workspace dst.xcworkspace PROVISIONING_PROFILE_SPECIFIER="test-dst-provisioning-release" -UseModernBuildSystem=NO CODE_SIGN_STYLE="Manual" CODE_SIGN_IDENTITY="Apple Distribution: $(Team code)" This is the error I get: Ld /Users/user931603/Library/Developer/Xcode/DerivedData/dst-gisgtbcaheaxrqbgvvzueprfinbl/Build/Intermediates.noindex/ArchiveIntermediates/dst/InstallationBuildProductsLocation/Applications/dst.app/dst normal arm64 cd /Users/user931603/build/dst-mobile-prototype/ios export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/user931603/.nvm/versions/node/v14.17.6/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/munki:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin" ld: warning: directory not found for option '-L-L/Users/user931603/Library/Developer/Xcode/DerivedData/dst-gisgtbcaheaxrqbgvvzueprfinbl/Build/Intermediates.noindex/ArchiveIntermediates/dst/BuildProductsPath/Release-iphoneos/BoringSSL-GRPC' ld: library not found for -lBoringSSL-GRPC clang: error: linker command failed with exit code 1 (use -v to see invocation) For a while I thought that I have a problem with the Library Search Paths These are my Target - Build settings - Library Search Paths These are my Project - Build settings - Library Search Paths But then it turned out that the achieve works from Xcode, but it doesn't work when I do it remotely on the terminal, so I think there must be an issue with the environment variables or something like this. I use Cocoapods, there can be a problem with that, the settings are the ones generated automatically by React Native. I have no clue about this issue, I would appreciate greatly if you could help!
Replies
1
Boosts
0
Views
4.3k
Activity
Dec ’22
Xcode 12 Beta 2 causes Xcode Server to be unmanageable
FB7864358 Upon replacing Xcode 12.0 Beta 1 with 12.0 Beta 2, the Xcode Server settings configuration is no longer accessible. One the 'Server & Bots' preference pane the message presented is: Xcode Server Is Already Running Your computer is already configured to run Xcode Server and this version of Xcode is not compatible. If you manually switch the service off and back on, an alert is presented with the following: This version of Xcode is not supported (version is too old) I have managed to revert back to Xcode 12.0 Beta one, and continue managing my server. Has anyone had the same experience or any suggestions on getting Xcode 12.0 Beta 2 to work with Xcode Server?
Replies
2
Boosts
0
Views
1.6k
Activity
Dec ’22