From 012e61ad12c375a1f4109788436ad71d4672d6d7 Mon Sep 17 00:00:00 2001 From: Titus von Koeller <9048635+Titus-von-Koeller@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:12:54 +0000 Subject: [PATCH] switch to python script with GH markdown formatting --- .github/workflows/python-package.yml | 12 +----------- scripts/auditwheel_show.py | 29 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) create mode 100755 scripts/auditwheel_show.py diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d485d3072..e8fd5298c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -196,17 +196,7 @@ jobs: run: python -m build . - name: Show auditwheel information if: matrix.os == 'ubuntu-latest' - run: | - pip install -q auditwheel - for whl in dist/*.whl; do - printf '%.0s=' {1..60} # separator line, same as below - echo -e "\nChecking wheel: $whl" - printf '%.0s-' {1..60} - echo - auditwheel show "$whl" - printf '%.0s-' {1..60} - echo - done + run: pip install -q auditwheel && python ./scripts/auditwheel_show.py - name: Upload build artifact uses: actions/upload-artifact@v4 with: diff --git a/scripts/auditwheel_show.py b/scripts/auditwheel_show.py new file mode 100755 index 000000000..a74cba30a --- /dev/null +++ b/scripts/auditwheel_show.py @@ -0,0 +1,29 @@ +import glob +import os +import subprocess + + +def append_to_summary(content): + with open(os.getenv("GITHUB_STEP_SUMMARY"), "a") as summary_file: + summary_file.write(content + "\n") + + +subprocess.run(["pip", "install", "-q", "auditwheel"]) + +wheel_files = glob.glob("dist/*.whl") + +for whl in wheel_files: + append_to_summary("---") + append_to_summary("### šŸŽ” Auditing wheel: `" + whl + "`\n") + + audit_wheel_output = subprocess.run( + ["auditwheel", "show", whl], capture_output=True, text=True + ) + + if audit_wheel_output.stdout: + append_to_summary(audit_wheel_output.stdout + "\n") + + if audit_wheel_output.stderr: + append_to_summary("**Error:**\n```\n" + audit_wheel_output.stderr + "```\n") + + append_to_summary("\nšŸ **Slithering on to the next one...** šŸ\n")