BtbN / FFmpeg-Builds

MIT License
6.97k stars 956 forks source link

GitHub Actions fails with ERROR: could not read ... no such file or directory #379

Closed MarcA711 closed 1 month ago

MarcA711 commented 1 month ago

Hey,

I am trying to set up actions for my fork from your repo that builds ffmpeg with rockchip hardware acceleration. However, I always get this error:

docker buildx --builder ffbuilder build --cache-from=type=local,src=.cache/ghcr.io/marca711/rockchip-ffmpeg-builds/base-linuxarm64_latest --cache-to=type=local,mode=max,dest=.cache/ghcr.io/marca711/rockchip-ffmpeg-builds/base-linuxarm64_latest --build-arg GH_REPO=ghcr.io/marca711/rockchip-ffmpeg-builds --build-context ghcr.io/marca711/rockchip-ffmpeg-builds/base:latest=oci-layout:///home/runner/work/Rockchip-FFmpeg-Builds/Rockchip-FFmpeg-Builds/.cache/images/base --load --tag ghcr.io/marca711/rockchip-ffmpeg-builds/base-linuxarm64:latest images/base-linuxarm64
ERROR: could not read /home/runner/work/Rockchip-FFmpeg-Builds/Rockchip-FFmpeg-Builds/.cache/images/base/index.json: open /home/runner/work/Rockchip-FFmpeg-Builds/Rockchip-FFmpeg-Builds/.cache/images/base/index.json: no such file or directory
+ rm -f /tmp/tmp.GeiXXobXQ2.toml
Error: Process completed with exit code 1.

In https://github.com/BtbN/FFmpeg-Builds/issues/364 you said that there must be some error before that causes this. But I couldn't find any other error in my logs. I hope that you could have a look at this.

This was my latest (failed) run: https://github.com/MarcA711/Rockchip-FFmpeg-Builds/actions/runs/9333126841

This is my workflow file (I removed the matrix): https://github.com/MarcA711/Rockchip-FFmpeg-Builds/blob/fix-gh-actions/.github/workflows/pr.yml

And the logs: logs_24425440181.zip

Thank you very much!

BtbN commented 1 month ago

Looks almost like the docker version on GHA is just too old or something, and it does not write a valid oci image. Not sure what to do about it. It'd mean the PR workflow has been broken since quite a while.

BtbN commented 1 month ago

You could try updating the image of the workflow to ubuntu-24.04, maybe that has a more up to date docker version.

BtbN commented 1 month ago

Yes, can confirm that fixes it. Also please note that the workflow you crafted is incredibly inefficient and will do no caching whatsoever and thus take forever each time and waste a lot of resources.

MarcA711 commented 1 month ago

Thank you really much for the quick help! It seems to work now.

Also please note that the workflow you crafted is incredibly inefficient and will do no caching whatsoever and thus take forever each time and waste a lot of resources.

Initially, I thought that it does caching, but I think it just uses an existing cache if it exists without creating/ updating it.

Can I just add a step to store the .cache folder in GH actions cache? You are pushing some images to ghcr.io, is this also part of caching/ reducing traffic or is this just to make them available to other users so they don't need to build them?

Should I try to create my workflow based on your "build" workflow? I used the "pr" workflow because it is easier. Should I consider the "pr" workflow outdated or is it ok to use it if I add caching to it?

BtbN commented 1 month ago

I'd say just copy the non PR-Workflow and change it to do your build. It has the caching logic built in. There is no easy way to cache stuff properly on Github, since it needs to know a Cache-Key ahead of time, which is why the workflow is so convoluted and calculates a hash of a bunch of stuff to determine some kind of Cache-Key.

I've reported that issue to the Github-Authors of the cache action, and they basically told me "You're holding it wrong" and don't care about caching anything but node packages or something.

MarcA711 commented 1 month ago

Thank you, I will do this.

This means I have to push the images to ghcr.io for caching purposes and can not just remove these lines that push to ghcr, am I correct?

BtbN commented 1 month ago

ghcr.io is used for caching as well, yes.

MarcA711 commented 2 weeks ago

Hey @BtbN , are you interested in adding a addin for FFmpeg with hardware acceleration for Rockchip hardware? Currently, I maintain a fork to build rockchip ffmepg. Here are the changes I did: https://github.com/BtbN/FFmpeg-Builds/compare/master...MarcA711:Rockchip-FFmpeg-Builds:master

I thought it would maybe be better to upstream these changes for better visibility and to keep everything in one place. If there are updates for the rockchip related libraries or other changes have to be done, I can open a PR. However, if you don't want a specific FFmpeg version in your repo, I can keep my fork.

And sorry for reusing this issue for my unrelated question. I thought it wouldn't be worth to create a new issue/ discussion.

BtbN commented 2 weeks ago

I do not include and third party patches to FFmpeg here. That's just a pointless maintenance nightmare and also just by principle of these builds being vanilla ffmpeg. If it's just a small static library that needs built, and FFmpeg already has all the stuff it needs, feel free to PR it.