Skip to content

[CI]: Cache docker images with GH cache action #3

@mattdeform

Description

@mattdeform

Summary

To avoid pulling a fresh docker image every CI run cache the image. If an image exists in the cache use it, otherwise if there is a newer image available or image is not in the cache: pull.

Basic example

Something like:

steps:
  - name: Checkout code
  - name: Get Docker image last modified date  # used to invalidate cache if image has been updated
  - name: Cache Docker images
  - name: Load cached Docker image
      if: steps.cache-docker.outputs.cache-hit == 'true'

  - name: Pull Docker image if not cached
    if: steps.cache-docker.outputs.cache-hit != 'true'

  - name: Install dependencies
  - name: Set Maya environment variables and run tests

Motivation

Speed up the CI significantly, and lower bandwidth used.

Notes

  • Need to figure out action cache size allowance (docs say 10gig), appear to be maxing out at 500mb.
  • Retry this once repo is public

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions