zamba icon indicating copy to clipboard operation
zamba copied to clipboard

Failed build: setup-ffmpeg fails on macos-latest job

Open github-actions[bot] opened this issue 9 months ago • 1 comments

Workflow failed: tests #713

github-actions[bot] avatar Apr 28 '24 00:04 github-actions[bot]

We get the following error on macos-latest images:

Error: setup-ffmpeg can only be run on 64-bit systems

This seems to come from an explicit check here for x64 (i.e., x86-64) system architecture.

https://github.com/Iamshankhadeep/setup-ffmpeg/blob/97b7510c1d4db9526df0a4320a6f41a2d330b23c/src/action.js#L26-L30

This action seems to download macOS binaries from https://evermeet.cx/ffmpeg/ and that provider's website explicitly says:

I do not plan to provide native ffmpeg binaries for Apple Silicon ARM.

So we're going to have to change how we install ffmpeg (at a minimum for macos-latest) to get things to work.

jayqi avatar May 03 '24 18:05 jayqi

It seems like our options are:

  • use macos-13 or earlier instead of macos-latest ("the new [M1] runner operates exclusively on macOS 14" (source)) -> EDIT: this looks out of date and it seems arm64 is in macos-13 too OR
  • use homebrew to install ffmpeg as we instruct in the zamba docs

Downside of the first option is it's not very future proof. Downside of the second option is it'll add about another minute to the CI run.

ejm714 avatar May 14 '24 21:05 ejm714

Think it makes sense to use homebrew to not be stuck on an old macos version and ultimately, an extra minute won't make much of difference given how slow the tests already are 😢

This basically means adding this block

      - if: matrix.os == 'macos-latest'
        name: Setup FFmpeg
        run: |
          brew install ffmpeg@4

However, we also need to add homebrew to the path

          echo 'export PATH="/opt/homebrew/opt/ffmpeg@4/bin:$PATH"' >> /Users/runner/.bash_profile
          source /Users/runner/.bash_profile

and that's where things get weird.

Oddly, things only work if I put that path block in the same step as make tests (where ffprobe gets called). I'd rather it live in the same block as brew install ffmpeg@4 but doing so only allows us to run ffmpeg or ffprobe in that install step, not in following steps like the test step.

The below is a workaround setup that I'd like to avoid because it's redundant, clunky, and it seems there should be a better way. @jayqi do you know if each action step uses a new shell or if there's a better way to tell the runner where to look for ffmpeg/ffprobe when on mac?

      - if: matrix.os == 'macos-latest'
        name: Run tests
        run: |
          echo 'export PATH="/opt/homebrew/opt/ffmpeg@4/bin:$PATH"' >> /Users/runner/.bash_profile
          source /Users/runner/.bash_profile
          ffmpeg -version
          ffprobe -version
          make tests

      - if: matrix.os == 'ubuntu-latest'
        name: Run tests
        run: |
          make tests

This is the current implementation in #329

ejm714 avatar May 15 '24 05:05 ejm714

@ejm714 I think you just need to do this in the ffmpeg install step to have it on the path for the rest of the steps: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path

pjbull avatar May 15 '24 21:05 pjbull