Code Signing issue when Archiving using Fastlane in Github actions - ios

Recently we have migrated all of our iOS projects from GitLab to GitHub. However when we are trying to build the code using GitHub
Actions(Fastlane) In our self-hosted runners it keeps falling with error mentioned below.
When building(gym) the project it signs with correct certificates and profiles but when archiving it somehow uses the development certificate to sign the pods.
Command Executed:
set -o pipefail && xcodebuild -workspace ./{ProjectName}.xcworkspace -scheme UAT -destination 'generic/platform=iOS' -archivePath /Users/{user}/Library/Developer/Xcode/Archives/2022-05-03/{ProjectName}\ 2022-05-03\ 16.13.00.xcarchive -allowProvisioningUpdates clean archive | tee /Users/{user}/Library/Logs/gym/{ProjectName}-UAT.log | xcpretty
Note: It used to archive fine with Gitlab pipelines. Also, it builds fine when the commands are run manually on the hosted runner.
iOS: macOS Big Sur 11.6
XCode: 13.0 and 13.2.1
What we've tried:
Locking and Unlocking keychain.
Re-creation and re-installing certificates
Upgrading Ruby
Running on different machines(We have 2 runners)
Restarting and Cleaning the runners
Deintegrated and Integrated pods.

Did you try to pod install? The error indicates a problem with ur build phases script added by Cocoapods. maybe deintegrate and integrate Cocoapods again.

Related

Archive iOS application using caches from DerivedData

I'm using Fastlane for my CI builds on Github Actions.
CI runs Fastlane's build_app function. The build_app internally uses xcodebuild archive to archive the project and then uses xcodebuild -exportArchive to extract IPA.
The problem is xcodebuild archive always ignores caches and builds all the modules from the source (even if DerivedData from previous builds are available). Is there a way to force either fastlane or xcodebuild archive to use caches from DerivedData. Or maybe there is some other way to achieve this.
Thanks

Build Xcode project from command line that use OneSignalNotificationServiceExtension

I am trying to build an Ios app with Objective-C xcode project
The project is using OneSignalNotificationServiceExtension that is why I am specifying the architecture.
the command:
xcodebuild ARCHS=armv6,armv7 ONLY_ACTIVE_ARCH=NO build
but the compilation fails and It throws an error:
Exiting because upload-symbols was run in validation mode
The reason I am doing this is because I need to use the sonarqube wrapper and it takes the build command as argument:
sonar-wrapper --out-dir=bw-output <<build command>>
but I am only able to build the xcode project using xcode
If there is a better way to integrate sonarqube to this kind of projects let me know please.
Maybe try using Fastlane instead of using the xcodebuild CLI directly, I find Fastlane is much more user friendly. I use it for my CI/CD deployments.
It looks like there is some Sonarqube integration as well:
https://docs.fastlane.tools/actions/sonar/
Website: https://fastlane.tools
I successfully built the project specifying the debug mode, workspace and scheme like this:
xcodebuild -configuration Debug -workspace <<workspace>> -scheme <<scheme>> clean build

Can't debug react-native project from Xcode, but It's running from console

Operating system macOS Mojave (version 10.14.5)
React Native Project 0.59.10
I'm working on one big react-native project. When I'm running react-native run-iso it runs emulator, and everything is perfect.
However, if I'll go into ios directory and try to build a project from Xcode, I'm getting the error. Library not found for -lBase64
I've tried:
Install different versions of Xcode
Remove some system files of xCode in the system. Reinstall Xcode
Tried run on Emulator and Physical device (Both failed)
Deleted build and pod directories out of ios directory
Meanwhile, this project is building from Xcode without a problem to my Colleague computer.
When I'm running through console I see:
info Building using
xcodebuild -workspace [name-of-the-app].xcworkspace -configuration Debug -scheme [name-of-the-app] -destination id=[some-long-id] -derivedDataPath build/[name-of-the-app
Maybe I have to define this parameter somewhere? Any solutions, any ideas?

Xcode 8 Build with Jenkins CI

I'm having issues with automated jenkins build on a mac pro using Xcode 8.1 with xcodebuild.
I would like my setup to:
Pull down code for git (working)
Archive (Archive fails)
Create .ipa
Deploy to TestFairy
My archive script is failing but still creating ProjectName-Daily.xcarchive file:
xcodebuild -workspace ProjectName.xcworkspace -scheme ProjectName-Daily -configuration Release clean archive -archivePath ~/ProjectName-Daily.xcarchive DEVELOPMENT_TEAM=1234567890
Fails with the following on the terminal with no description on error. I also tried -verbose and no luck
I then tried to build it manually and get a build succeeds with the following errors:
I then went to archive the build on Xcode and it worked just fine. Not sure why the script isn't working on the CI machine. Also tried the script on my personal macbook pro and it worked just fine.
Any thoughts?

Xcodebuild stops with cordova ios project

I'm trying to build and archive (in Release and Debug mode) an ios project generated with apache cordova 4.0.0, via command line tool xcodebuild
These commands work ok:
cordova platform add ios
cordova prepare ios
cordova build ios
The ios project generated by cordova has a scheme called iHogar. After that, when I try to launch this command on the console:
xcodebuild -scheme iHogar -sdk iphoneos -configuration Debug
CODE_SIGN_IDENTITY="iPhone Distribution: S-N-A L-C-A, S- CO-P-Ñ-A DE
SE-U-O- Y R--A-E-U-OS (xxxxxxx)"
It stops at the beginning of the execution, and does not continue. The value of param CODE_SIGN_IDENTITY is modified due to privacy reasons.
Here is the output of the command, through console:
Build settings from command line:
CODE_SIGN_IDENTITY = iPhone Distribution: S-N-A L-C-A, S- CO-P-Ñ-A DE SE-U-O- Y R--A-E-U-OS (xxxxxxx)
SDKROOT = iphoneos8.1
And stops there without finishing the command (it hangs) , only stops with crtl+C
The certificate is ok, and also the provisioning profile. If I open the project with Xcode (version 6.1) everything goes ok, I can build and archive it without problems, with the same certificate and provisioning profile.
Has anyone experienced this behavior?
Thanks in advance
I have resolved this issue. The problem was that the cordova generated ios project hasn't got schemas. Those are created the first time you open the project with XCode. When the app has been created by cordova, is only created with targets.
In this scenario, that the generated app cannot be opened with XCode with human interaction, is better to build the app with the target option, like this:
xcodebuild -xcconfig "cordova/build.xcconfig" -project "iHogar.xcodeproj" ARCHS="armv7 armv7" -target "iHogar" -configuration Debug -sdk iphoneos build VALID_ARCHS="armv7 armv7s" CONFIGURATION_BUILD_DIR="build/device"
It's important to have the certificate to sign the app installed in the keychain, and the related provisioning profile downloaded.
I know you got around your issue, but as this is quite recent, have you considered upgrading to Cordova 5.1.1. This will build and code sign the app without the need to go into XCode.

Resources