66 pull_request :
77 branches : [ '*' ]
88
9+ # give permissions to write a comment on the pull request
10+ permissions :
11+ pull-requests : write
12+ actions : read
13+ contents : read
14+
915concurrency :
1016 group : ${{ github.workflow }}-${{ github.ref }}
1117 cancel-in-progress : true
@@ -43,13 +49,12 @@ jobs:
4349 build_wolfssh :
4450 needs :
4551 - build_wolfssl
46- - create_matrix
4752 strategy :
4853 fail-fast : false
4954 matrix :
5055 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
5358 runs-on : ${{ matrix.os }}
5459 timeout-minutes : 10
5560 steps :
@@ -71,53 +76,109 @@ jobs:
7176 - name : configure
7277 working-directory : ./wolfssh/
7378 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 "
7580
7681 - name : make
7782 working-directory : ./wolfssh/
7883 run : make
7984
8085 - name : Get Saved OpenSSH Upload Results
81- uses : actions/downlad-artifact@v4
86+ id : cache-upload
87+ uses : actions/cache@v4
8288 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
8592
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
86103
87- - name : Put test key in authorized keys file
104+ - name : Setup OpenSSH Test Server
105+ working-directory : ./wolfssh/
88106 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
91115 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
94122
95123 - name : Run SFTP client benchmark
96124 working-directory : ./wolfssh/
125+ timeout-minutes : 5
97126 run : |
98- ./scripts/get-sftp-benchmark.sh
127+ ./scripts/get-sftp-benchmark.sh 22222
99128
100129 - name : Store Upload Speed PNG
101130 uses : actions/upload-artifact@v4
102131 with :
103- name : upload-results.png
132+ name : upload-results-pr${{ github.event.pull_request.number }} .png
104133 path : wolfssh/upload-results.png
134+ retention-days : 2
105135
106136 - name : Store Download Speed PNG
107137 uses : actions/upload-artifact@v4
108138 with :
109- name : download-results.png
139+ name : download-results-pr${{ github.event.pull_request.number }} .png
110140 path : wolfssh/download-results.png
141+ retention-days : 2
111142
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()
115181 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