Skip to content

Conversation

@guicamest
Copy link
Contributor

@guicamest guicamest commented Jan 25, 2025

Description:
Add support for .sdkmanrc file in java-version-file parameter, as well as tests and updated documentation related to the new feature.

I've renamed one e2e test (setup-java-version-from-file-major-minor-patch-with-dist) to include the actual name of the file under test. Without it, there were many job runs with the same name (i.e. ${{ matrix.distribution }} version from file 'openjdk64-17.0.10' - ${{ matrix.os }}), making it quite difficult to find the appropriate ones to verify - and losing a key element of the test: the name of the java-version-file.

Related issue: #669

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@guicamest guicamest requested a review from a team as a code owner January 25, 2025 23:13
@guicamest
Copy link
Contributor Author

@aparnajyothi-y @HarithaVattikuti sorry for the direct ping. Would it be possible for the team to take a look at the PR or at least provide some feedback any time soon?

@guicamest guicamest marked this pull request as draft February 19, 2025 19:53
@guicamest guicamest marked this pull request as ready for review February 19, 2025 19:53
@mahabaleshwars
Copy link
Contributor

Thank you, @guicamest, for your work on this feature and for the detailed documentation and test updates!

I noticed that the branch currently has conflicts with src/util.ts, which need to be resolved before we can proceed with the merge. Let me know if you need any assistance in resolving these conflicts.

Please also ensure that all relevant documentation and test coverage boxes are checked, as per the checklist.

@guicamest guicamest force-pushed the feat/669/support_sdkmanrc branch from 77c7e7f to dd4a6bd Compare November 4, 2025 11:42
@guicamest
Copy link
Contributor Author

Thank you, @guicamest, for your work on this feature and for the detailed documentation and test updates!

I noticed that the branch currently has conflicts with src/util.ts, which need to be resolved before we can proceed with the merge. Let me know if you need any assistance in resolving these conflicts.

Please also ensure that all relevant documentation and test coverage boxes are checked, as per the checklist.

Thanks for taking a look @mahabaleshwars :) I've solved the conflicts 👍

@mahabaleshwars
Copy link
Contributor

Hi @guicamest,

Thank you for this contribution! This is a valuable addition that will help teams using SDKMAN maintain consistency between local and CI environments. I have a few suggestions to make this PR even better:

📚 Documentation Request

File: docs/advanced-usage.md

Please add a complete example showing how to use .sdkmanrc with the java-version-file parameter. While we haven't added examples for other tool-version-files previously, this would be a good opportunity to improve our documentation.

Example workflow:

- name: Setup Java from .sdkmanrc
  uses: actions/setup-java@v4
  with:
    java-version-file: '.sdkmanrc'
    distribution: 'temurin'

Also include:

Expected .sdkmanrc file format (e.g., java=21.0.1-tem)
Fallback behavior when the file is missing or malformed
A note for existing users about this new capability

🧪 Test Coverage Improvements
Please add comprehensive negative test cases to ensure robust error handling. Consider edge cases such as:

Invalid file formats
Missing or malformed content
Empty or incomplete entries
The goal is to ensure the parser gracefully handles unexpected inputs and provides helpful error messages to users.

💡 Suggestions

Consider adding:

Debug logging for .sdkmanrc parsing to help troubleshoot issues

✅ Overall

Once the test coverage and documentation are enhanced, this will be ready to merge. Great work on this feature!

Add example step/file for `.sdkmanrc`
@guicamest
Copy link
Contributor Author

guicamest commented Nov 13, 2025

@mahabaleshwars Are the changes to the documentation looking good now? 54b5143

image

@mahabaleshwars
Copy link
Contributor

Hi @guicamest,

Thank you for this valuable contribution to support .sdkmanrc files!

A suggestion for the documentation:

Please remove the '(NEW)' marker from the documentation. Since this will become part of the permanent documentation once merged, temporal markers like '(NEW)' can become confusing for future readers who won't know when it was considered ""new"". The feature's novelty is already captured in the PR history and release notes.

@guicamest
Copy link
Contributor Author

Hi @guicamest,

Thank you for this valuable contribution to support .sdkmanrc files!

A suggestion for the documentation:

Please remove the '(NEW)' marker from the documentation. Since this will become part of the permanent documentation once merged, temporal markers like '(NEW)' can become confusing for future readers who won't know when it was considered ""new"". The feature's novelty is already captured in the PR history and release notes.

I agree, I'll remove it. It was previously like that, but you suggested to (add) "A note for existing users about this new capability" 🤷

@guicamest
Copy link
Contributor Author

guicamest commented Nov 14, 2025

@mahabaleshwars The (NEW) text has been removed :) Regarding:

Consider adding:
Debug logging for .sdkmanrc parsing to help troubleshoot issues

There is already a debug log which outputs the version read from the file:

  core.debug(`Version from file '${fileContent}'`);

I've changed it to:

  core.debug(`Parsed version '${capturedVersion}' from file '${versionFileName}'`);

So as to have information about the filename as well. What do you think?

@mahabaleshwars
Copy link
Contributor

Hi @guicamest,
The Prettier format check is failing for src/util.ts. Please run the following command to automatically fix the formatting:

npm run format

The dist/ directory is out of sync with your source code changes. After making your code changes, you need to rebuild the distribution files by running:

npm run build

Then commit the updated dist/cleanup/index.js and dist/setup/index.js files.
Once these changes are made, the CI checks should pass. Let me know if you need any help! 🙂

@guicamest
Copy link
Contributor Author

@mahabaleshwars Thanks for the instructions ❤️ I've pushed the files after I run the commands 👍

@mahabaleshwars
Copy link
Contributor

Hi @guicamest,

Unfortunately, the same checks are still failing. This issue is most likely due to line endings getting changed from LF to CRLF automatically in your code editor or local Git configuration.

Please try running the following commands in your terminal to fix the formatting and validate the changes locally:

Format the code:

npm run format

Check the formatting (this will validate the fix immediately):

npm run format-check

Run the build to ensure everything is correct:

npm run build

After running these, please commit and push the changes.

If this doesn't resolve the issue, would it be okay if we commit the fix directly to your branch to help move this forward?

@guicamest
Copy link
Contributor Author

guicamest commented Nov 20, 2025

Let' try it one more time: a985bcf :)

If it doesn't work then your contribution will be more than welcomed! 😊

@guicamest
Copy link
Contributor Author

Nice, thanks a lot @mahabaleshwars ! 😌

@HarithaVattikuti HarithaVattikuti merged commit 4e7e684 into actions:main Nov 25, 2025
376 checks passed
@guicamest guicamest deleted the feat/669/support_sdkmanrc branch November 27, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants