-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support running inside windows self-hosted runner #43
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -71,7 +71,11 @@ runs: | |||||||||||||
# NOTE: Sourced, not executed as a script. | ||||||||||||||
source "${{ github.action_path }}/setup/venv.bash" | ||||||||||||||
|
||||||||||||||
${{ github.action_path }}/action.py "${{ inputs.inputs }}" | ||||||||||||||
if [[ "${{runner.os}}" == "Windows" ]]; then | ||||||||||||||
python "${{ github.action_path }}/action.py" "${{ inputs.inputs }}" | ||||||||||||||
else | ||||||||||||||
${{ github.action_path }}/action.py "${{ inputs.inputs }}" | ||||||||||||||
fi | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Windows form should work well in both cases, so maybe skip the conditional entirely?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh that would be fine then. I just thought about not changing the existing lines to not break anything since i don't have a Linux environment to test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the code and left the "python" line. |
||||||||||||||
env: | ||||||||||||||
GHA_PIP_AUDIT_SUMMARY: "${{ inputs.summary }}" | ||||||||||||||
GHA_PIP_AUDIT_NO_DEPS: "${{ inputs.no-deps }}" | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,12 @@ fi | |
# `python -m pip install ...` invocation might happen to choose. | ||
if [[ -n "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}" ]] ; then | ||
if [[ -d "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}" ]]; then | ||
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/bin/activate" | ||
if [[ "$OSTYPE" == "msys" || "$(uname)" == MSYS_NT* || "$(uname)" == MINGW* ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is coming from Bash. If you think it could break the Linux code i can remove it. Anyways i put two more validations to identify if OS is Windows. It will be ok if i have to remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the code and removed $OSTYPE. |
||
# execute in windows | ||
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/scripts/activate" | ||
else | ||
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/bin/activate" | ||
fi | ||
else | ||
die "Fatal: virtual environment is not a directory" | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had encoding issues with emojis, that is why i added that new line for the emojis. I took as reference this post https://stackoverflow.com/questions/3597480/how-to-make-python-3-print-utf8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than fiddling with
sys.stdout.buffer
directly, could you try usingsys.stdout.reconfigure
? For example, calling this once somewhere early in the program should be sufficient:...and then we can continue using
print
as normal everywhere else 🙂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have tested a couple of things to avoid the encoding issue but have no luck. I have just tested what you mentioned but got the error again.
"UnicodeEncodeError: 'charmap' codec can't encode character '\u274c' in position 0: character maps to <undefined>"
. Maybe i need to think about something else to try.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After, testing a little bit more i realized that i was missing
encoding="utf-8"
where GITHUB_STEP_SUMMARY and GITHUB_OUTPUT were opened. Hopefully, it won't break anything. I updated the code.