From 26755c3e70e25bf09b2ffdf182a5cabb3fa79ac5 Mon Sep 17 00:00:00 2001 From: Michael Mior Date: Wed, 28 Aug 2024 13:23:02 -0400 Subject: [PATCH] Add plots to step summary --- .github/plot_markdown.py | 12 ++++++++++++ .github/workflows/ci.yml | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 .github/plot_markdown.py diff --git a/.github/plot_markdown.py b/.github/plot_markdown.py new file mode 100644 index 0000000..ddc4bcf --- /dev/null +++ b/.github/plot_markdown.py @@ -0,0 +1,12 @@ +import glob +import json +import os + + +if __name__ == '__main__': + img_urls = json.loads(os.environ['IMG_URLS']) + img_files = glob.glob('dist/results/plots/*.png') + for (url, file) in zip(img_urls, img_files): + name = file.split('/')[-1].split('.')[0] + print(f"## {name}") + print(f"![{name}]({url})\n") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc3854a..8ce72f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,14 @@ jobs: MARKDOWN_TABLE: ${{ steps.csv-table-output.outputs.markdown-table }} run: echo "$MARKDOWN_TABLE" >> $GITHUB_STEP_SUMMARY + - run: make plots + - name: Upload plots + id: imgur + uses: devicons/public-upload-to-imgur@v2.2.2 + with: + path: dist/results/plots/*.png + client_id: ${{secrets.IMGUR_CLIENT_ID}} + - name: Add plots to summary + env: + IMG_URLS: ${{ steps.imgur.outputs.imgur_urls }} + run: python .github/plot_markdown.py >> $GITHUB_STEP_SUMMARY