expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
821 stars 84 forks source link

GitHub Action build iOS local failing #1682

Closed LBeghini closed 1 year ago

LBeghini commented 1 year ago

Build/Submit details page URL

No response

Summary

I am trying to build an iOS app using the GitHub Actions. For that, I am trying to build locally to use the resources of GitHub and ease the process of releasing the apps on GitHub itself, since those are just for testing purposes.

I generated the provisioningProfilePath and the distributionCertificate following the tutorial:

Yes I have an Apple Store Developer Account

In my pipeline I am setting up:

As I am using the MacOS system, I am relying on the provided XCode.

To build, I am using the following command:

eas build --platform ios --profile release --local --non-interactive

Managed or bare?

Bare

Environment

As it runs on the pipeline I do not have this information

Error output

[RUN_EXPO_DOCTOR] Command "expo doctor" failed.
Error: bash exited with signal: SIGTERM
[PREPARE_CREDENTIALS] Preparing credentials
    at ChildProcess.completionListener (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/spawn-async/build/spawnAsync.js:40:23)
[PREPARE_CREDENTIALS] Creating keychain
[...]
[RUN_FASTLANE]     Run script build phase '[CP-User] Generate app.manifest for expo-updates' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXUpdates' from project 'Pods')
[RUN_FASTLANE] ▸ ** ARCHIVE FAILED **
[RUN_FASTLANE] ** ARCHIVE FAILED **
[RUN_FASTLANE] Exit status: 65

Reproducible demo or steps to reproduce from a blank project

Here is the yml file for the action:

on:
  workflow_dispatch:
  milestone:
    types: [closed]
jobs:
  build-ios:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v3

    - name: Setup Node.js environment
      uses: actions/setup-node@v3.6.0
      with:
        node-version: latest

    - name: Setup Android SDK Tools
      uses: android-actions/setup-android@v2.0.2

    - name: Npm install
      run: npm ci

    - name: Set up Xcode 14.2
      uses: maxim-lobanov/setup-xcode@v1
      with:
        xcode-version: '14.2'

    - name: Install fastlane
      run: brew install fastlane

    - name: Expo Github Action
      uses: expo/expo-github-action@7.2.0
      with:
        expo-version: latest
        eas-version: latest
        token: ${{ secrets.EXPO_TOKEN }}

    - name: Create Cert File
      run: |
        mkdir -p ios/certs
        echo -n "${{ secrets.P12_CERT }}" | base64 -d > ios/certs/dist-cert.p12

    - name: Create mobile provision
      run: |
        echo -n "${{ secrets.MOBILE_PROVISION }}" | base64 -d > ios/certs/profile.mobileprovision

    - name: Expo build
      run: eas build --platform ios --profile release --local --non-interactive

Also, the repo I am using is public, so you can take a look on the entire build to save time. You can find it here.

dsokal commented 1 year ago

Android SDK Tools

Why do you need this for iOS builds?

Error: bash exited with signal: SIGTERM at ChildProcess.completionListener (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/spawn-async/build/spawnAsync.js:40:23) at Object.onceWrapper (node:events:627:26) at ChildProcess.emit (node:events:512:28) at maybeClose (node:internal/child_process:1098:16) at Socket. (node:internal/child_process:456:11) at Socket.emit (node:events:512:28) at Pipe. (node:net:316:12) ... at spawnAsync (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23) at spawn (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/turtle-spawn/dist/index.js:27:47) at BuildContext.runGlobalExpoCliCommandAsync [as runGlobalExpoCliCommand] (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/eas-cli-local-build-plugin/dist/expoCli.js:14:39) at runExpoCliCommand (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/utils/project.js:23:20) at runExpoDoctor (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/common/setup.js:75:57) at /Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/common/setup.js:58:42 at BuildContext.runBuildPhase (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/context.js:83:34) at setupAsync (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/common/setup.js:56:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async buildAsync (/Users/runner/.npm/_npx/ac2fe9123ebf2e7d/node_modules/@expo/build-tools/dist/builders/ios.js:34:5)

This error is coming from expo doctor, it's just printed in the wrong order. Creating the keychain doesn't fail for you.

[PREBUILD] The ios project is malformed, project files will be cleared and reinitialized.

Have you seen this error?

[RUN_FASTLANE] Exit status: 65 [RUN_FASTLANE] [RUN_FASTLANE] Maybe the error shown is caused by using the wrong version of Xcode [RUN_FASTLANE] Found multiple versions of Xcode in '/Applications/' [RUN_FASTLANE] Make sure you selected the right version for your project [RUN_FASTLANE] This build process was executed using '/Applications/Xcode_14.2.app' [RUN_FASTLANE] If you want to update your Xcode path, either [RUN_FASTLANE] [RUN_FASTLANE] - Specify the Xcode version in your Fastfile [RUN_FASTLANE] ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0 [RUN_FASTLANE] [RUN_FASTLANE] - Specify an absolute path to your Xcode installation in your Fastfile [RUN_FASTLANE] ▸ xcode_select "/Applications/Xcode8.app" [RUN_FASTLANE] - Manually update the path using [RUN_FASTLANE] ▸ sudo xcode-select -s /Applications/Xcode.app [RUN_FASTLANE] [RUN_FASTLANE] +-------------+------------------------------+ [RUN_FASTLANE] | Build environment | [RUN_FASTLANE] +-------------+------------------------------+ [RUN_FASTLANE] | xcode_path | /Applications/Xcode_14.2.app | [RUN_FASTLANE] | gym_version | 2.211.0 | [RUN_FASTLANE] | sdk | iPhoneOS16.2.sdk | [RUN_FASTLANE] +-------------+------------------------------+ [RUN_FASTLANE] Looks like fastlane ran into a build/archive error with your project [RUN_FASTLANE] It's hard to tell what's causing the error, so we wrote some guides on how [RUN_FASTLANE] to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/ [RUN_FASTLANE] Before submitting an issue on GitHub, please follow the guide above and make [RUN_FASTLANE] sure your project is set up correctly. [RUN_FASTLANE] fastlane uses xcodebuild commands to generate your binary, you can see the [RUN_FASTLANE] the full commands printed out in yellow in the above log. [RUN_FASTLANE] Make sure to inspect the output above, as usually you'll find more error information there

This part could be helpful as well.


Unfortunately, at this point, this looks like something project/configuration specific. Are you able to build your app locally? If yes, this is a CI misconfiguration. I don't think this is an issue with eas-cli.

I'm closing the issue because of the invalid repro. I'll reopen it once you show this is not a project-specific error.

expo-bot commented 1 year ago

Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue.

The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue.

A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own.

Resources

LBeghini commented 1 year ago

@dsokal Here is a print of my terminal with the working app as well: image

Also, I have the app on a GitHub page here. Is working as expected.

I have separated the build from android and iOS in different files. Here is the iOS one.

LBeghini commented 1 year ago

And another thing. I removed the credentials and the build passed correctly. I haven't tested the artefact created just yet but this already discarded the problem with my CI (at least the environment).

I am guessing the problem is with the generated keys. @dsokal do you have any example of people that needed to generate the keys on the CI? On GitHub is being really hard to find use cases of people building their apps with actions.

dsokal commented 1 year ago

You can generate the credentials using eas build, then download them with eas credentials, and use the credentials.json file on Github (https://docs.expo.dev/app-signing/local-credentials/)