In this lesson, Alice and her team address GitHub Actions’ artifact retention limits by implementing a long-term storage solution. By adding a dedicated workflow that collects test and coverage reports and syncs them to an Amazon S3 bucket, they ensure indefinite access to CI artifacts.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Background
Our existing CI pipeline uses two primary jobs:| Job Name | Artifact Name | Description |
|---|---|---|
| unit-test | test-reports | Runs unit tests and exports JUnit XML |
| code-coverage | coverage-report | Generates coverage data (lcov) |
Artifacts are retained for up to 90 days and can be no larger than 5 GB each. Syncing reports to S3 immediately after CI avoids expiration and size caps.
Solution Overview
- Extend (or create) a workflow that triggers when the primary CI run completes.
- Download the
test-reportsandcoverage-reportartifacts. - Use an S3 sync action to upload all reports to your S3 bucket.
Workflow Configuration
Add a new file at.github/workflows/report-storage.yml:
Make sure you’ve defined the following secrets under Settings > Secrets and variables > Actions:
S3_BUCKETAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
The
workflow_run trigger ensures the upload job only runs after the CI workflow has completed successfully.Next Steps
- Commit and push
report-storage.ymlto your repository. - Confirm that
unit-testandcode-coveragejobs publish artifacts namedtest-reportsandcoverage-report. - Trigger your CI workflow and verify the
reports/directory appears in your S3 bucket.