add compression-level input for save step#1689
add compression-level input for save step#1689StephenHodgson wants to merge 5 commits intoactions:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new compression-level input parameter to the cache and save actions, allowing users to control the compression strength (0-9) when creating cache archives. The feature integrates cleanly with existing code by adding validation functions and setting appropriate environment variables for the underlying compression tools (GZIP and zstd).
Key changes:
- Added
getCompressionLevel()andsetCompressionLevel()utility functions with validation for values 0-9 - Integrated compression level configuration into the cache save workflow
- Extended test coverage with unit tests and a gzip compression verification test
Reviewed changes
Copilot reviewed 11 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/actionUtils.ts | Added compression level getter/setter functions with range validation |
| src/saveImpl.ts | Integrated compression level retrieval and application before cache save |
| src/constants.ts | Added CompressionLevel input constant |
| action.yml | Added compression-level input to main cache action |
| save/action.yml | Added compression-level input to save action |
| save/README.md | Documented the compression-level input parameter |
| README.md | Added compression-level to inputs documentation and fixed trailing whitespace |
| tests/actionUtils.test.ts | Added comprehensive tests for compression level functions and gzip behavior |
| tests/saveImpl.test.ts | Added tests for compression level application and out-of-range handling |
| tests/save.test.ts | Added test verifying compression level sets environment variables |
| tests/saveOnly.test.ts | Added test verifying compression level sets environment variables |
| dist/* | Updated compiled distribution bundles with new functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| I decided to pull some of these changes down into the |
Description
Adds optional
compression-levelsupport and extends tests to validate gzip output size differences between low and high compression settings when saving cache.Motivation and Context
Allows users to control compression strength (0–9) and now includes a regression test to ensure higher compression produces smaller archives.
How Has This Been Tested?
npm test -- --runTestsByPath __tests__/actionUtils.test.tsnpm test -- --runTestsByPath __tests__/actionUtils.test.ts __tests__/saveImpl.test.ts __tests__/saveOnly.test.ts __tests__/save.test.tsScreenshots (if appropriate):
Types of changes
Checklist: