game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
821 stars 231 forks source link

[iOS] Error while reading movie during project import #488

Open AytoMaximo opened 1 year ago

AytoMaximo commented 1 year ago

Bug description

Hi! I have a simple test project, which should start a video play on my raw image component after app starts. However after CICD the video is gone and I've found the following log:

Start importing Assets/iPhone_final_1920x1080.mp4 using Guid(4a6cabe8c82444838bfda281abe35b82) Importer(-1,00000000000000000000000000000000) Error while reading movie: /github/workspace/Assets/iPhone_final_1920x1080.mp4 -> (artifact id: '64692c41f188253627aa45a741fde930') in 0.001871 seconds

MP4 file was added to LFS, if it is important.

My build pipeline:

name: AppStore CICD

on: workflow_dispatch

jobs:
  buildForiOSPlatform:
    name: Build for iOS
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        unityVersion:
          - 2021.3.16f1
        targetPlatform:
          - iOS

    steps:
      #Checkout (without LFS)
      - name: Checkout
        uses: actions/checkout@v2

      # Git LFS
      - name: Create LFS file list
        run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

      - name: Restore LFS cache
        uses: actions/cache@v2
        id: lfs-cache
        with:
          path: .git/lfs
          key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}

      - name: Git LFS Pull
        run: |
          git lfs pull
          git add .
          git reset --hard    

      #Cache
      - name: Cache Library folder
        uses: actions/cache@v2
        with:
          path: Library
          key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-     

      #Build
      - name: Build project
        uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          unityVersion: ${{ matrix.unityVersion }}
          targetPlatform: ${{ matrix.targetPlatform }}
          allowDirtyBuild: true
          #customParameters: '-myParameter myValue -myBoolean -ThirdParameter andItsValue'

      #Output
      - name: Get Artefacts
        uses: actions/upload-artifact@v2
        with:
          name: build-iOS
          path: build/iOS

  releaseToAppStore:
    name: Release to the App Store
    runs-on: macos-latest
    needs: buildForiOSPlatform
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Download iOS Artifact
        uses: actions/download-artifact@v2
        with:
          name: build-iOS
          path: build/iOS

      - name: Fix File Permissions and Run fastlane
        env:
          APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }}
          APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }}
          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

          MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
          MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

          APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
          APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
          APPSTORE_P8: ${{ secrets.APPSTORE_P8 }}

          IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }}
          IOS_BUNDLE_ID: com.AytoMaximo.GameCI # Change it to match your Unity bundle id
          PROJECT_NAME: GameCI # Change it to match your project's name
        run: |
          eval "$(ssh-agent -s)"
          ssh-add - <<< "${MATCH_DEPLOY_KEY}"
          find $IOS_BUILD_PATH -type f -name "**.sh" -exec chmod +x {} \;
          bundle install
          bundle exec fastlane ios beta

      - name: Cleanup to avoid storage limit
        if: always()
        uses: geekyeggo/delete-artifact@v1
        with:
          name: build-iOS

How I can get to know what exactly is causing this error? Thank you in advance!

SimonSchruff commented 2 months ago

I am aware this is an old post, but this issue still persists so in case anyone stumbles across this, here is the solution. The problem is that Unity does not support .mp4 formats on linux, which you are using as your hosted runner. See video file compatibility for reference. You can fix the issue by converting my .mp4 file into .webm format with vp8 codec. One way to achieve this is using ffmpeg, or directly recording in the desired format. Cheers!