Skip to content

add compression-level input for save step#1689

Draft
StephenHodgson wants to merge 5 commits intoactions:mainfrom
RageAgainstThePixel:feature/compression-level
Draft

add compression-level input for save step#1689
StephenHodgson wants to merge 5 commits intoactions:mainfrom
RageAgainstThePixel:feature/compression-level

Conversation

@StephenHodgson
Copy link

@StephenHodgson StephenHodgson commented Dec 13, 2025

Description

Adds optional compression-level support 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.ts
  • npm test -- --runTestsByPath __tests__/actionUtils.test.ts __tests__/saveImpl.test.ts __tests__/saveOnly.test.ts __tests__/save.test.ts

Screenshots (if appropriate):

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (add or update README or docs)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
@StephenHodgson StephenHodgson marked this pull request as ready for review December 13, 2025 21:02
@StephenHodgson StephenHodgson requested a review from a team as a code owner December 13, 2025 21:02
Copilot AI review requested due to automatic review settings December 13, 2025 21:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and setCompressionLevel() 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@StephenHodgson StephenHodgson changed the title add compression-level inputs add compression-level input for save step Dec 13, 2025
@StephenHodgson StephenHodgson marked this pull request as draft December 14, 2025 21:17
@StephenHodgson
Copy link
Author

StephenHodgson commented Dec 14, 2025

I decided to pull some of these changes down into the toolkit/cache project instead.
Put back into draft until those changes are released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants