Harden java-package validation across distributions - #1165
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 10b8fe1e-18f4-42cb-8672-11215715a713
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes and hardens java-package validation by introducing a single distribution→package capability registry, then using it to validate requested package types (and the Temurin jdk+jmods + version constraint) before installer selection. It also aligns the published action contract (action metadata + docs) and adds contract-style tests to keep docs, metadata, and E2E matrices consistent with the registry.
Changes:
- Add
JAVA_PACKAGE_CAPABILITIES+validateJavaPackage()and use it fromgetJavaDistribution(). - Expand/clarify the published
java-packagecontract inaction.yml,README.md, and the advanced compatibility table. - Add contract and factory tests to ensure docs/metadata/E2E combinations match the registry, and to verify rejection/acceptance behavior.
Show a summary per file
| File | Description |
|---|---|
| src/distributions/package-types.ts | Introduces the typed distribution/package registry and validation logic (including Temurin jdk+jmods version constraint). |
| src/distributions/distribution-factory.ts | Calls centralized package validation before constructing an installer; removes the previous special-case jdk+jmods check. |
| README.md | Updates java-package documentation to reflect all supported variants and points readers to the compatibility table. |
| docs/advanced-usage.md | Updates the package compatibility section wording and clarifies jdkfile validation behavior. |
| action.yml | Expands the java-package input description to include JetBrains variants and clarifies per-distribution support. |
| tests/java-package-contract.test.ts | Adds contract tests to keep action.yml, README, advanced docs, and E2E matrices aligned with the registry. |
| tests/distributors/distribution-factory.test.ts | Adds table-driven acceptance/rejection tests for package validation and Temurin jdk+jmods version gating. |
| dist/setup/index.js | Updates the bundled distribution output to include the new package-types module and validation behavior. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
tests/java-package-contract.test.ts:72
- The
include:matrix parsing assumesdistributionvalues are always single-quoted. YAML allows quoted or unquoted scalars, so this can miss valid entries and silently reduce coverage (future workflow edits could make the test pass while no longer validating all include rows).
const includedPackages = workflow.matchAll(
/- distribution: '([^']+)'\s*\n\s*java-package: ([^\s]+)/g
);
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Low
Comment on lines
+57
to
+59
| const defaultMatrix = workflow.match( | ||
| /distribution:\s*\n\s*\[([^\]]+)\]\s*\n\s*java-package:\s*\['([^']+)'\]/ | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
java-packagevalues were interpreted inconsistently across distributions, allowing typos to select a default artifact or fail only after cache or network work. This change introduces one typed capability registry and validates distribution, package, and Temurin JMOD version combinations before installer construction.The same registry now drives table-based behavior tests and contract checks for action metadata, README guidance, the advanced compatibility table, and E2E package combinations. The published contract includes the JetBrains JCEF and FreeType variants,
jdkfileis restricted tojdk, and the generated setup bundle is updated.Related issue:
Fixes: #1164
Check list:
npm run checklocally (format, lint, build, test) and all checks pass.