actions / runner-images

GitHub Actions runner images
MIT License
10.19k stars 3.06k forks source link

fastlane build is successful on local macOS but fail on github actions macOS runner #9448

Closed LayMui closed 7 months ago

LayMui commented 8 months ago

Description

I used fastlane for my CI to build ios ipa file however the build fail log an issue at fastlane https://github.com/fastlane/fastlane/issues/21872

but it looks like a github actions env issue

can anyone help?

Platforms affected

Runner images affected

Image version and build link

it's internal repo

Is it regression?

Not sure

Expected behavior

Actual behavior

Repro steps

refer to ios.yml steps

mikhailkoliada commented 8 months ago

Hello! from your report it is unclear what is the actual error and how to reproduce this, please provide a minimal repro project so we could reproduce the issue

LayMui commented 8 months ago

Hello! from your report it is unclear what is the actual error and how to reproduce this, please provide a minimal repro project so we could reproduce the issue

sure will do

LayMui commented 8 months ago

@erik-bershel please refer to https://github.com/LayMui/AwesomeProject

sergei-pyshnoi commented 8 months ago

@erik-bershel please refer to https://github.com/LayMui/AwesomeProject

Hello @LayMui . Thank you for repro steps but unfortunately its still its unclear where problem is. Looking on provided repo I see that the latest runs was successful. Also you repro is still complicated for detecting where is possible problem could be. For example for now we are not able to run your code on our environment because of using secrets. on your workflow. Is it possible to make it more simplify and share more details about what are we looking?

LayMui commented 8 months ago

yes the repo is able to build with the same podfile however in my internal repo I saw this

$ set -o pipefail && xcodebuild -workspace ./nativeIntegration.xcworkspace -scheme nativeIntegration -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-07/nativeIntegration\ 2024-03-07\ 07.18.10.xcarchive archive | tee /Users/runner/Library/Logs/gym/nativeIntegration-nativeIntegration.log | xcbeautify [07:18:17]: ▸ ::warning file=/Users/runner/work/sh-usermanagement-native-app/sh-usermanagement-native-app/ios/Pods/Pods.xcodeproj::The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'FirebaseInstallations-FirebaseInstallations_Privacy' from project 'Pods') I am still scratching my head ...

LayMui commented 8 months ago

after I change podfile to

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.2.99'
      end
     end

    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
  end

I got this error again

[10:10:31]: $ set -o pipefail && xcodebuild -workspace ./nativeIntegration.xcworkspace -scheme nativeIntegration -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-07/nativeIntegration\ 2024-03-07\ 10.10.31.xcarchive archive | tee /Users/runner/Library/Logs/gym/nativeIntegration-nativeIntegration.log | xcbeautify [10:10:39]: ▸ ARCHIVE FAILED [10:10:39]: ▸ The following build commands failed: [10:10:39]: ▸ PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/runner/Library/Developer/Xcode/DerivedData/nativeIntegration-alcotxzqppddyafffyjrvyvguhfw/Build/Intermediates.noindex/ArchiveIntermediates/nativeIntegration/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-rncore.build/Script-46EB2E00021300.sh (in target 'React-rncore' from project 'Pods')

LayMui commented 8 months ago

@sergei-pyshnoi could u refer to this repo https://github.com/LayMui/nativeIntegration/

I am able to reproduce it at https://github.com/LayMui/nativeIntegration/actions/runs/8228924047

LayMui commented 8 months ago

@sergei-pyshnoi
the latest actions run show a different error

refer to https://github.com/LayMui/nativeIntegration/actions/runs/8244764713/job/22547533744

which I have already set in the xcode IDE

I was also able to run fastlane testandbuild locally

To reproduce this setup you need the Apple Developer account create a identifier, in my case: I give it testapp.AwesomeProject

here is the secrets variables I add to the github actions setting FASTLANE_USER="myapple@email.com" APPLE_ID="myapple@email.com" APP_ID=testapp.AwesomeProject KEYCHAIN_PASSWORD="12345678" MATCH_PASSWORD="12345678" MATCH_USERNAME="myapple@email.com" MATCH_KEYCHAIN_PASSWORD="12345678"

I also have the above in the file nativeIntegration/ios/fastlane/.env.default

I also have a git repo that store the certificate at https://github.com/LayMui/AwesomeProject-certificate

To setup the fastlane cd nativeIntegration/ios refer to https://docs.fastlane.tools/getting-started/ios/setup/ fastlane init it will create the AppFile, Fastfile

use the match to re-create the certificates and provisioning profiles file run fastlane match nuke development fastlane match nuke distribution

this will remove all the cert and provisioning profiles at https://github.com/LayMui/AwesomeProject-certificate

fastlane match development fastlane match adhoc

this would generate the certificates and provisioning profiles files

cd nativeIntegration/ios open nativeIntegration.xcworkspace it will launch the project in the xcode IDE in the targets Go to signing and capabilities enter the bundler identifier: testapp.AwesomeProject and select the Team etc

LayMui commented 8 months ago

this is my local build fastlane testandbuild:

[15:34:14]: ▸ Archive Succeeded
[15:34:14]: Generated plist file with the following values:
[15:34:14]: ▸ -----------------------------------------
[15:34:14]: ▸ {
[15:34:14]: ▸   "provisioningProfiles": {
[15:34:14]: ▸     "testapp.AwesomeProject": "match AdHoc testapp.AwesomeProject"
[15:34:14]: ▸   },
[15:34:14]: ▸   "method": "ad-hoc",
[15:34:14]: ▸   "signingStyle": "manual"
[15:34:14]: ▸ }
[15:34:14]: ▸ -----------------------------------------
[15:34:14]: $ /usr/bin/xcrun /usr/local/Cellar/fastlane/2.219.0_2/libexec/gems/fastlane-2.219.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/gb/n35zw0vs1lv5w9vjh5my7yp40000gp/T/gym_config20240312-10886-yy3clb.plist' -archivePath /Users/tohlaymui/Library/Developer/Xcode/Archives/2024-03-12/nativeIntegration\ 2024-03-12\ 15.08.55.xcarchive -exportPath '/var/folders/gb/n35zw0vs1lv5w9vjh5my7yp40000gp/T/gym_output20240312-10886-c8x6ju' 
[15:34:29]: Compressing 1 dSYM(s)
[15:34:29]: $ cd '/Users/tohlaymui/Library/Developer/Xcode/Archives/2024-03-12/nativeIntegration 2024-03-12 15.08.55.xcarchive/dSYMs' && zip -r '/Users/tohlaymui/dev/nativeIntegration/ios/nativeIntegration.app.dSYM.zip' *.dSYM
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/DWARF/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/DWARF/nativeIntegration (deflated 73%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Info.plist (deflated 52%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/Relocations/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/Relocations/aarch64/ (stored 0%)
[15:34:33]: ▸ updating: nativeIntegration.app.dSYM/Contents/Resources/Relocations/aarch64/nativeIntegration.yml (deflated 89%)

[15:34:33]: Successfully exported and compressed dSYM file
[15:34:33]: Successfully exported and signed the ipa file:
[15:34:33]: /Users/tohlaymui/dev/nativeIntegration/ios/nativeIntegration.ipa

+---------------------------------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | xcversion        | 0           |
| 2    | default_platform | 0           |
| 3    | setup_ci         | 0           |
| 4    | is_ci            | 0           |
| 5    | match            | 13          |
| 6    | gym              | 1631        |
+------+------------------+-------------+

[15:34:33]: fastlane.tools just saved you 27 minutes! 🎉
LayMui commented 8 months ago

@sergei-pyshnoi any update on this issue?

LayMui commented 8 months ago

the build error seen in the github actions CI

[11:21:04]: $ set -o pipefail && xcodebuild -workspace ./nativeIntegration.xcworkspace -scheme nativeIntegration -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2024-03-14/nativeIntegration\ 2024-03-14\ 11.21.04.xcarchive archive | tee /Users/runner/Library/Logs/gym/nativeIntegration-nativeIntegration.log | xcbeautify
[11:21:12]: ▸ ** ARCHIVE FAILED **
[11:21:12]: ▸ The following build commands failed:
[11:21:12]: ▸   PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/runner/Library/Developer/Xcode/DerivedData/nativeIntegration-alcotxzqppddyafffyjrvyvguhfw/Build/Intermediates.noindex/ArchiveIntermediates/nativeIntegration/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-rncore.build/Script-46EB2E00021340.sh (in target 'React-rncore' from project 'Pods')

please refer to https://github.com/LayMui/nativeIntegration which I was able to reproduce the above issue

thanks

LayMui commented 8 months ago

@sergei-pyshnoi i suspect some OS system configuration it got to do with the pod install when the react-rncore is not installed

refer to this https://github.com/facebook/react-native/issues/42070

i notice this when I did in my local machine Analyzing dependencies [Codegen] Found FBReactNativeSpec [Codegen] Found rncore Downloading dependencies Generating Pods project

could you help to check the OS of the github runner has the correct version for pod, ruby, etc

sergei-pyshnoi commented 8 months ago

@sergei-pyshnoi i suspect some OS system configuration it got to do with the pod install when the react-rncore is not installed

refer to this facebook/react-native#42070

i notice this when I did in my local machine Analyzing dependencies [Codegen] Found FBReactNativeSpec [Codegen] Found rncore Downloading dependencies Generating Pods project

could you help to check the OS of the github runner has the correct version for pod, ruby, etc

Hello @LayMui . Full list of installed software for MacOS 14 you can find in macos-14-arm64-Readme.md file.

sergei-pyshnoi commented 8 months ago

Hello @LayMui . Looks like your error comes form signing misconfiguration in your fastlane project. I found similar issue in fastlane repo. Did you try suggested solution from it?

LayMui commented 7 months ago

@sergei-pyshnoi there is a similar issue at https://github.com/fastlane/fastlane/issues/21373

LayMui commented 7 months ago

Hello @LayMui . Looks like your error comes form signing misconfiguration in your fastlane project. I found similar issue in fastlane repo. Did you try suggested solution from it?

actually all these should be handled by the match, which install the certificates and provisioning profile from the git storage it's still a puzzle as it was working fine last Nov 2023, and it suddenly break

LayMui commented 7 months ago

I do not quite understand what cause that error seen in the github actions 01:14:42]: There are no local code signing identities found.

You can run security find-identity -v -p codesigning fastlane_tmp_keychain to get this output.

This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.

LayMui commented 7 months ago

even there is no more error on There is no local code signing after I add the github.token GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

but the build still fail

----------------------------------------+----------------------------------------------------------------------+

[07:12:08]: Cloning remote git repo... [07:12:08]: If cloning the repo takes too long, you can use the clone_branch_directly option in match. [07:12:09]: Checking out branch master... [07:12:09]: 🔓 Successfully decrypted certificates repo [07:12:09]: Installing certificate...

+-----------------------------------------------------------------+ | Installed Certificate | +-------------------+---------------------------------------------+

07:12:23: ▸ [React-rncore] Running script [CP-User] Generate Specs 07:12:23: ▸ ARCHIVE FAILED 07:12:23: ▸ The following build commands failed: 07:12:23: ▸ PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/runner/Library/Developer/Xcode/DerivedData/nativeIntegration-alcotxzqppddyafffyjrvyvguhfw/Build/Intermediates.noindex/ArchiveIntermediates/nativeIntegration/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/React-rncore.build/Script-46EB2E000213F0.sh (in target 'React-rncore' from project 'Pods')

[07:12

LayMui commented 7 months ago

i think there is some RN dependencies that is unable to build on the GH macOS runner it's not due to code signing issue

lasha-dave commented 7 months ago

@LayMui This seems unrelated to the GH macOS runner

sergei-pyshnoi commented 7 months ago

Hello @LayMui . Sorry for the long delay. Unfortunately, after investigating this error, we were unable to determine its exact cause. The main problem is that your project is quite complex in terms of configuration, which prevents us from properly reproducing the error provided. Also, the fact that other common cases using fastlane do not experience similar errors may indicate that the way fastlane is installed and configured on runner-images is not the cause. At the moment I am closing this thread as stale and not runner-images related, but we will continue track similar errors in case of repeating based on our capabilities.