Skip to content

Commit

Permalink
change caching setup and comment both artifiacts
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Feb 25, 2025
1 parent 6343f29 commit 19007bb
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions .github/workflows/sftp-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,20 @@ jobs:
run: make

- name: Get Saved OpenSSH Upload Results
uses: actions/download-artifact@v4
continue-on-error: true
id: cache-upload
uses: actions/cache@v4
with:
name: openssh-average-download.csv
path: wolfssh/openssh-average-download.csv
key: openssh-average-download.csv
fail-on-cache-miss: false

- name: Get Saved OpenSSH Download Results
uses: actions/download-artifact@v4
continue-on-error: true
id: cache-download
uses: actions/cache@v4
with:
name: openssh-average-upload.csv
path: wolfssh/openssh-average-upload.csv
key: openssh-averavge-upload.csv
fail-on-cache-miss: false

- name: Install gnuplot
run: sudo apt-get install gnuplot
Expand Down Expand Up @@ -139,34 +141,38 @@ jobs:
retention-days: 2

- name: Upload OpenSSH Download Results
if: steps.download-artifact.outputs.found != 'true'
uses: actions/upload-artifact@v4
if: steps.cache-download.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
name: openssh-average-upload.csv
path: wolfssh/openssh-average-upload.csv
path: wolfssh/openssh-average-download.csv
key: openssh-average-download.csv

- name: Upload OpenSSH Upload Results
if: steps.download-artifact.outputs.found != 'true'
uses: actions/upload-artifact@v4
if: steps.cache-upload.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
name: openssh-average-download.csv
path: wolfssh/openssh-average-download.csv
path: wolfssh/openssh-average-upload.csv
key: openssh-average-upload.csv

- name: Comment on PR about performance
env:
GITHUB_URL: ${{ github.event.pull_request.comments_url }}
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
RUN_ID: ${{ github.run_id }}
run: |
# Get the artifact URL
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/artifacts \
--jq '.artifacts[0].id')
# Get both artifact IDs
DOWNLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
--jq '.artifacts[] | select(.name | contains("download-results-pr")) | .id')
UPLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
--jq '.artifacts[] | select(.name | contains("upload-results-pr")) | .id')
# Create the comment with direct link to download
curl -X POST \
-H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/comments" \
-d "{\"body\":\"Graphs have been generated and are available in the [workflow artifacts](https://github.com/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID)\"}"
$GITHUB_URL \
-H "Content-Type: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
-d "{\"body\":\"Performance test results:\n\n- [Download Results](https://github.com/${{ github.repository }}/actions/runs/$RUN_ID/artifacts/$DOWNLOAD_ARTIFACT)\n- [Upload Results](https://github.com/${{ github.repository }}/actions/runs/$RUN_ID/artifacts/$UPLOAD_ARTIFACT)\"}"
- name: Print logs if failed
working-directory: ./wolfssh/
Expand Down

0 comments on commit 19007bb

Please sign in to comment.