Skip to content

Commit 49de419

Browse files
authored
Merge pull request #138 from aidangarske/openssh-workflow
openssh.yml - Github CI Workflow
2 parents 1543ff8 + 8b0e69c commit 49de419

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

.github/scripts/check-workflow-result.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,21 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
212212
echo "Error: stunnel-test.log not found"
213213
exit 1
214214
fi
215+
# ----- OPENSSH -----
216+
elif [ "$TEST_SUITE" = "openssh" ]; then
217+
if [ -f "openssh-test.log" ]; then
218+
# Check for expected PRNGD socket error and exit code 255
219+
if grep -q "Couldn't connect to PRNGD socket" openssh-test.log && grep -q "Error 255" openssh-test.log; then
220+
echo "PASS: OpenSSH tests failed as expected with PRNGD socket error"
221+
exit 0
222+
else
223+
echo "FAIL: OpenSSH tests did not fail as expected"
224+
exit 1
225+
fi
226+
else
227+
echo "Error: openssh-test.log not found"
228+
exit 1
229+
fi
215230
else
216231
if [ $TEST_RESULT -eq 0 ]; then
217232
echo "$TEST_SUITE tests unexpectedly succeeded with force fail enabled"

.github/workflows/openssh.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: openssh Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfprovider:
17+
name: Build wolfProvider
18+
runs-on: ubuntu-22.04
19+
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
23+
openssl_ref: [ 'openssl-3.5.0' ]
24+
steps:
25+
- name: Checkout wolfProvider
26+
uses: actions/checkout@v4
27+
28+
# Check if this version of wolfssl/wolfprovider has already been built,
29+
# mark to cache these items on post if we do end up building
30+
- name: Checking wolfSSL/wolfProvider in cache
31+
uses: actions/cache@v4
32+
id: wolfprov-cache
33+
with:
34+
path: |
35+
wolfssl-source
36+
wolfssl-install
37+
wolfprov-install
38+
provider.conf
39+
40+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
41+
lookup-only: true
42+
43+
# If wolfssl/wolfprovider have not yet been built, pull ossl from cache
44+
- name: Checking OpenSSL in cache
45+
if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true'
46+
uses: actions/cache@v4
47+
id: openssl-cache
48+
with:
49+
path: |
50+
openssl-source
51+
openssl-install
52+
53+
key: ossl-depends-${{ matrix.openssl_ref }}
54+
55+
# If not yet built this version, build it now
56+
- name: Build wolfProvider
57+
if: steps.wolfprov-${{ matrix.wolfssl_ref }}-cache.hit != 'true'
58+
run: |
59+
OPENSSL_TAG=${{ matrix.openssl_ref }} WOLFSSL_TAG=${{ matrix.wolfssl_ref }} ./scripts/build-wolfprovider.sh
60+
61+
- name: Print errors
62+
if: ${{ failure() }}
63+
run: |
64+
if [ -f test-suite.log ] ; then
65+
cat test-suite.log
66+
fi
67+
68+
test_openssh:
69+
runs-on: ubuntu-22.04
70+
needs: build_wolfprovider
71+
# This should be a safe limit for the tests to run.
72+
timeout-minutes: 20
73+
strategy:
74+
matrix:
75+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
76+
openssl_ref: [ 'openssl-3.5.0' ]
77+
openssh_ref: [ 'master', 'V_10_0_P2', 'V_9_9_P1' ]
78+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
79+
exclude:
80+
- openssh_ref: 'master'
81+
force_fail: 'WOLFPROV_FORCE_FAIL=1'
82+
steps:
83+
- name: Checkout wolfProvider
84+
uses: actions/checkout@v4
85+
86+
- name: Retrieving OpenSSL from cache
87+
uses: actions/cache/restore@v4
88+
id: openssl-cache
89+
with:
90+
path: |
91+
openssl-source
92+
openssl-install
93+
94+
key: ossl-depends-${{ matrix.openssl_ref }}
95+
fail-on-cache-miss: true
96+
97+
- name: Retrieving wolfSSL/wolfProvider from cache
98+
uses: actions/cache/restore@v4
99+
id: wolfprov-cache
100+
with:
101+
path: |
102+
wolfssl-source
103+
wolfssl-install
104+
wolfprov-install
105+
provider.conf
106+
107+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
108+
fail-on-cache-miss: true
109+
110+
- name: Checkout OSP
111+
uses: actions/checkout@v4
112+
with:
113+
repository: wolfssl/osp
114+
path: osp
115+
116+
- name: Checkout openssh
117+
uses: actions/checkout@v4
118+
with:
119+
repository: openssh/openssh-portable
120+
path: openssh-portable
121+
ref: ${{ matrix.openssh_ref }}
122+
123+
- name: Build and Test openssh-portable
124+
working-directory: openssh-portable
125+
run: |
126+
# Set environment variables
127+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
128+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
129+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
130+
131+
# Apply the patch for the correct version of OpenSSH
132+
if [ "${{ matrix.openssh_ref }}" != "master" ]; then
133+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/openssh/openssh-${{ matrix.openssh_ref }}-wolfprov.patch
134+
else
135+
# for master we need to supply the latest release version
136+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/openssh/openssh-V_10_0_P2-wolfprov.patch
137+
fi
138+
139+
autoreconf -ivf
140+
./configure --with-ssl-dir=$GITHUB_WORKSPACE/openssl-install \
141+
--with-rpath=-Wl,-rpath=$GITHUB_WORKSPACE/openssl-install/lib64 \
142+
--with-prngd-socket=/tmp/prngd
143+
make -j
144+
145+
# Run all the tests except (t-exec) as it takes too long
146+
export ${{ matrix.force_fail }}
147+
make file-tests interop-tests extra-tests unit 2>&1 | tee openssh-test.log || true
148+
TEST_RESULT=$?
149+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} openssh

0 commit comments

Comments
 (0)