Closed timon-schelling closed 1 year ago
Hmm, for some weird reason I didn't get an email when you made this issue. Glad I found it!
Yes, this sounds like a great idea. I'll take a look. It shouldn't be too hard.
steps:
- uses: actions/checkout@v3
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
- name: Cache Docker images
uses: ScribeMD/docker-cache@0.3.3
with:
key: docker-${{ runner.os }}-${{ hashFiles('.github/workflows/build.yaml') }}
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
command: "build"
I tried this but downloading and unpacking from Cache is actualy slower than pulling the docker image. I Hope you find a better way.
Btw, supporting caching for builds inside cross containers could also help build times.
I just tested caching the install of the cross
binary and that seems to save about 20s. Yes, caching the target
dir inside the Docker image would be a big win. I'll take a look at that too.
Actually, I realized that caching the cargo and target dirs is probably not in scope for this action. You can simply use the Swatinem/rust-cache
action and it just works because (I assume) the checkout dir is mounted as a volume inside the Docker image.
That particular action has a lot of parameters. If I used it inside this action, I'd have to add all those parameters to this action just so you could set them, which doesn't seem very useful. I will update the docs for this action to note that you can use that action with this one.
This is done in v0.0.8.
Thanks for creating this action, exactly what I needed.
I would like to propose the implementation of the GitHub actions caching mechanism for Rust cross download. This would significantly improve build times by removing the need for redundant downloads across runs.
https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
I'll try to come up with a solution myself, but I'm probably not knowledgeable enough in GitHub action development.