Speed up CI, Reduce container image size #591
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use caching for cargo build to reduce the build times from 5 mins to 45 seconds when dependencies are non changing
Restructure the entire Dockerfile to use multistaging to reduce the docker image by ~500 mb from 1.05 GB to 584 MB.
Use github action internal caching so we dont have to deal with uploading and download the cache as an artifact.
Use cargo chef to build all the dependencies as a layer so that can be cached and have to only compile av1an itself.
Without cargo chef after my initial changes cold run was 9m 49s and when caching the build times came down to 6m 28s but the cache would be invalided on any code change so it was not usable
With cargo chef on a cold run it was still 9m 49s and a cached run it came down to 4m 57s, since this is caching the dependencies and still building av1an the time going forward should be closer to the 5m mark than the 9m 49s cold run.