Skip to content

Commit 19007bb

Browse files
change caching setup and comment both artifiacts
1 parent 6343f29 commit 19007bb

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

.github/workflows/sftp-benchmark.yml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,20 @@ jobs:
8383
run: make
8484

8585
- name: Get Saved OpenSSH Upload Results
86-
uses: actions/download-artifact@v4
87-
continue-on-error: true
86+
id: cache-upload
87+
uses: actions/cache@v4
8888
with:
89-
name: openssh-average-download.csv
9089
path: wolfssh/openssh-average-download.csv
90+
key: openssh-average-download.csv
91+
fail-on-cache-miss: false
9192

9293
- name: Get Saved OpenSSH Download Results
93-
uses: actions/download-artifact@v4
94-
continue-on-error: true
94+
id: cache-download
95+
uses: actions/cache@v4
9596
with:
96-
name: openssh-average-upload.csv
9797
path: wolfssh/openssh-average-upload.csv
98+
key: openssh-averavge-upload.csv
99+
fail-on-cache-miss: false
98100

99101
- name: Install gnuplot
100102
run: sudo apt-get install gnuplot
@@ -139,34 +141,38 @@ jobs:
139141
retention-days: 2
140142

141143
- name: Upload OpenSSH Download Results
142-
if: steps.download-artifact.outputs.found != 'true'
143-
uses: actions/upload-artifact@v4
144+
if: steps.cache-download.outputs.cache-hit != 'true'
145+
uses: actions/cache@v4
144146
with:
145-
name: openssh-average-upload.csv
146-
path: wolfssh/openssh-average-upload.csv
147+
path: wolfssh/openssh-average-download.csv
148+
key: openssh-average-download.csv
147149

148150
- name: Upload OpenSSH Upload Results
149-
if: steps.download-artifact.outputs.found != 'true'
150-
uses: actions/upload-artifact@v4
151+
if: steps.cache-upload.outputs.cache-hit != 'true'
152+
uses: actions/cache@v4
151153
with:
152-
name: openssh-average-download.csv
153-
path: wolfssh/openssh-average-download.csv
154+
path: wolfssh/openssh-average-upload.csv
155+
key: openssh-average-upload.csv
154156

155157
- name: Comment on PR about performance
156158
env:
159+
GITHUB_URL: ${{ github.event.pull_request.comments_url }}
157160
GH_TOKEN: ${{ github.token }}
158161
PR_NUMBER: ${{ github.event.pull_request.number }}
162+
RUN_ID: ${{ github.run_id }}
159163
run: |
160-
# Get the artifact URL
161-
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/artifacts \
162-
--jq '.artifacts[0].id')
164+
# Get both artifact IDs
165+
DOWNLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
166+
--jq '.artifacts[] | select(.name | contains("download-results-pr")) | .id')
167+
UPLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
168+
--jq '.artifacts[] | select(.name | contains("upload-results-pr")) | .id')
163169
164170
# Create the comment with direct link to download
165171
curl -X POST \
166-
-H "Authorization: Bearer ${{ github.token }}" \
167-
-H "Accept: application/vnd.github.v3+json" \
168-
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/comments" \
169-
-d "{\"body\":\"Graphs have been generated and are available in the [workflow artifacts](https://github.com/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID)\"}"
172+
$GITHUB_URL \
173+
-H "Content-Type: application/json" \
174+
-H "Authorization: token $GITHUB_TOKEN" \
175+
-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)\"}"
170176
171177
- name: Print logs if failed
172178
working-directory: ./wolfssh/

0 commit comments

Comments
 (0)