Skip to content

CI: Improve actions/setup workflow #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 8, 2025

Conversation

ByteOtter
Copy link
Contributor

What this PR does / why we need it:
Expands the existing setup actions with logic that skips python installation when python is already installed and sets the caching method depending on the lockfile type (pip for requirements.txt and poetry for poetry.lock; If no lockfile is found, an empty requirements.txt is created and caching type set to pip)

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Copy link
Contributor

@NotTheEvilOne NotTheEvilOne left a comment

Choose a reason for hiding this comment

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

We should support outputs for this action. E.g.:

outputs:
  cache_type:
    description: "Detected Python cache strategy."
    value: ${{ steps.lockfile.outputs.cache_type }}

* Check for existing python installation before installing new
* Base caching method on found lockfile type
@ByteOtter ByteOtter force-pushed the ci/improve-setup-action branch from eb7c16d to 967d5ef Compare August 7, 2025 09:02
* Format Code
* Combine cache type evaluation and installation verification into one
* Expose cache_type as output to invoked actions
@ByteOtter
Copy link
Contributor Author

We should support outputs for this action. E.g.:

outputs:
  cache_type:
    description: "Detected Python cache strategy."
    value: ${{ steps.lockfile.outputs.cache_type }}

Did just that with the latest commit. cache_type should now be accessible from actions that use this one.

@NotTheEvilOne
Copy link
Contributor

If I remember correctly each GitHub runner has an Python instance installed. We could not determine if the expected version is installed in this case. We might need to reconsider (support input for Python version and check for that version) or can't skip setup-python calls unfortunately.

@ByteOtter
Copy link
Contributor Author

Hmm I think in that case we should remove that skipping of setup-python .. I think otherwise it's just going to get messy without really much of a benefit in my view.

@ByteOtter
Copy link
Contributor Author

Currently encountering this error right here:

Error: Unable to locate executable file: poetry. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Which means that at the point setup is running, setup-python expects poetry to be installed, when it detects a poetry.lock in order to inspect the cache. To fix this, we could move the install-poetry step into setup as well.

@NotTheEvilOne
Copy link
Contributor

Different from pip which setup-python provides automatically you should be right in installing poetry if cache_type matches. In this case we should most likely rename it to something like package_tool?

@NotTheEvilOne NotTheEvilOne force-pushed the ci/improve-setup-action branch from 57391bf to d3a8901 Compare August 8, 2025 04:56
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.00%. Comparing base (b305d15) to head (8759217).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #156   +/-   ##
=======================================
  Coverage   63.00%   63.00%           
=======================================
  Files          27       27           
  Lines        1192     1192           
=======================================
  Hits          751      751           
  Misses        441      441           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NotTheEvilOne NotTheEvilOne force-pushed the ci/improve-setup-action branch from d3a8901 to 8759217 Compare August 8, 2025 05:02
Copy link
Contributor

@NotTheEvilOne NotTheEvilOne left a comment

Choose a reason for hiding this comment

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

LGTM

@NotTheEvilOne NotTheEvilOne merged commit 1bac212 into gardenlinux:main Aug 8, 2025
5 checks passed
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.

2 participants