6
6
pull_request :
7
7
branches : [ '*' ]
8
8
9
+ # give permissions to write a comment on the pull request
10
+ permissions :
11
+ pull-requests : write
12
+ actions : read
13
+ contents : read
14
+
9
15
concurrency :
10
16
group : ${{ github.workflow }}-${{ github.ref }}
11
17
cancel-in-progress : true
@@ -43,13 +49,12 @@ jobs:
43
49
build_wolfssh :
44
50
needs :
45
51
- build_wolfssl
46
- - create_matrix
47
52
strategy :
48
53
fail-fast : false
49
54
matrix :
50
55
os : [ ubuntu-latest ]
51
- wolfssl : ${{ fromJson(needs.create_matrix.outputs['versions']) }}
52
- name : Build and test wolfsshd
56
+ wolfssl : [ master ]
57
+ name : Collect SFTP performance
53
58
runs-on : ${{ matrix.os }}
54
59
timeout-minutes : 10
55
60
steps :
@@ -71,53 +76,109 @@ jobs:
71
76
- name : configure
72
77
working-directory : ./wolfssh/
73
78
run : |
74
- ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120"
79
+ ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120 -DEXAMPLE_SFTP_BENCHMARK "
75
80
76
81
- name : make
77
82
working-directory : ./wolfssh/
78
83
run : make
79
84
80
85
- name : Get Saved OpenSSH Upload Results
81
- uses : actions/downlad-artifact@v4
86
+ id : cache-upload
87
+ uses : actions/cache@v4
82
88
with :
83
- path : ./wolfssh/
84
- artifact_id : ' openssh-upload'
89
+ path : wolfssh/openssh-average-download.csv
90
+ key : openssh-average-download.csv
91
+ fail-on-cache-miss : false
85
92
93
+ - name : Get Saved OpenSSH Download Results
94
+ id : cache-download
95
+ uses : actions/cache@v4
96
+ with :
97
+ path : wolfssh/openssh-average-upload.csv
98
+ key : openssh-averavge-upload.csv
99
+ fail-on-cache-miss : false
100
+
101
+ - name : Install gnuplot
102
+ run : sudo apt-get install gnuplot
86
103
87
- - name : Put test key in authorized keys file
104
+ - name : Setup OpenSSH Test Server
105
+ working-directory : ./wolfssh/
88
106
run : |
89
- touch ~/.ssh/authorized_keys_test
90
- cat ./keys/hansel-*.pub > authorized_keys_test
107
+ sudo apt-get install openssh-server
108
+ mkdir ~/.ssh
109
+ chmod 700 ~/.ssh
110
+ echo "AuthorizedKeysFile $PWD/keys/hansel-key-ecc.pub" >> sshd-config-test.txt
111
+ echo "PubkeyAuthentication yes" >> sshd-config-test.txt
112
+ echo "Subsystem sftp internal-sftp" >> sshd-config-test.txt
113
+ echo "KbdInteractiveAuthentication no" >> sshd-config-test.txt
114
+ sed -i.bak "s/hansel/$USER/" ./keys/hansel-key-ecc.pub
91
115
chmod 600 ./keys/hansel-key-*.pem
92
- sudo systemctl restart sshd
93
- sudo service sshd restart
116
+ chmod 600 ./keys/hansel-key-*.pub
117
+ sudo mkdir -p /run/sshd
118
+ sudo chmod 755 /run/sshd
119
+ sudo /usr/sbin/sshd -p 22222 -f sshd-config-test.txt -E $PWD/sshd-log.txt
120
+ cat sshd-config-test.txt
121
+ ps -e | grep sshd
94
122
95
123
- name : Run SFTP client benchmark
96
124
working-directory : ./wolfssh/
125
+ timeout-minutes : 5
97
126
run : |
98
- ./scripts/get-sftp-benchmark.sh
127
+ ./scripts/get-sftp-benchmark.sh 22222
99
128
100
129
- name : Store Upload Speed PNG
101
130
uses : actions/upload-artifact@v4
102
131
with :
103
- name : upload-results.png
132
+ name : upload-results-pr${{ github.event.pull_request.number }} .png
104
133
path : wolfssh/upload-results.png
134
+ retention-days : 2
105
135
106
136
- name : Store Download Speed PNG
107
137
uses : actions/upload-artifact@v4
108
138
with :
109
- name : download-results.png
139
+ name : download-results-pr${{ github.event.pull_request.number }} .png
110
140
path : wolfssh/download-results.png
141
+ retention-days : 2
111
142
112
- - name : Comment on PR about performance
113
- env :
114
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143
+ - name : Upload OpenSSH Download Results
144
+ if : steps.cache-download.outputs.cache-hit != 'true'
145
+ uses : actions/cache@v4
146
+ with :
147
+ path : wolfssh/openssh-average-download.csv
148
+ key : openssh-average-download.csv
149
+
150
+ - name : Upload OpenSSH Upload Results
151
+ if : steps.cache-upload.outputs.cache-hit != 'true'
152
+ uses : actions/cache@v4
153
+ with :
154
+ path : wolfssh/openssh-average-upload.csv
155
+ key : openssh-average-upload.csv
156
+
157
+ # Currently the comment in PR does not work correctly
158
+ # - name: Comment on PR about performance
159
+ # env:
160
+ # GITHUB_URL: ${{ github.event.pull_request.comments_url }}
161
+ # GH_TOKEN: ${{ github.token }}
162
+ # PR_NUMBER: ${{ github.event.pull_request.number }}
163
+ # RUN_ID: ${{ github.run_id }}
164
+ # run: |
165
+ # # Get both artifact IDs
166
+ # DOWNLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
167
+ # --jq '.artifacts[] | select(.name | contains("download-results-pr")) | .id')
168
+ # UPLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \
169
+ # --jq '.artifacts[] | select(.name | contains("upload-results-pr")) | .id')
170
+ #
171
+ # # Create the comment with direct link to download
172
+ # curl -X POST \
173
+ # $GITHUB_URL \
174
+ # -H "Content-Type: application/json" \
175
+ # -H "Authorization: token $GH_TOKEN" \
176
+ # -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)\"}"
177
+
178
+ - name : Print logs if failed
179
+ working-directory : ./wolfssh/
180
+ if : failure()
115
181
run : |
116
- PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
117
- gh pr comment $PR_NUMBER --body "Attached is the performance results" \
118
- --attach download-results.png \
119
- --attach upload-results.png
120
-
121
- artifacts :
122
- ' openssh-upload ' : { 'path': 'wolfssh/openssh-average-upload.csv' }
123
- ' openssh-download ' : { 'path': 'wolfssh/openssh-average-download.csv' }
182
+ sudo cat sshd-log.txt
183
+ cat log.csv
184
+
0 commit comments