Ravindra BagaleCourses & study guides

Chapter 9: GitHub Actions Hands-On

9.4 Caching and artifacts

Cache — speed dependency installs (pip, npm) between runs. Setup actions often have a cache: input; or use actions/cache.

Artifacts — upload files from a job for download later (test reports, coverage HTML). Different from container images in a registry.

- name: Upload test report
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: pytest-report
    path: report.xml
Tool Keeps Typical use
Cache Dependencies between workflow runs Faster pip / npm
Artifact upload Job outputs for humans / later jobs Reports, SBOM files
Container registry Versioned runnable images Deploy the same bits

Practice task

In one sentence each: when would you use a cache vs an uploaded artifact vs pushing an image to GHCR for badge API?