Skip to content

Commit a8223f5

Browse files
Test Userpadelsbach
authored andcommitted
Add Github CI testing support for wolfProvider
1 parent f8f4324 commit a8223f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+826
-1067
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
275275
elif [ "$TEST_SUITE" = "tcpdump" ]; then
276276
if [ -f "tcpdump-test.log" ]; then
277277
# Check for expected 7 failed tests (ESP/crypto segfaults)
278-
if grep -q "7 tests failed" tcpdump-test.log; then
279-
echo "PASS: tcpdump tests failed as expected with force fail enabled (7 tests failed)"
278+
if grep -q "2 tests failed" tcpdump-test.log; then
279+
echo "PASS: tcpdump tests failed as expected with force fail enabled (2 tests failed)"
280280
exit 0
281281
else
282-
echo "FAIL: tcpdump tests did not fail as expected (should have 7 failed tests)"
282+
echo "FAIL: tcpdump tests did not fail as expected (should have 2 failed tests)"
283283
exit 1
284284
fi
285285
else

.github/scripts/docker/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dockerfile used in `.github/workflows/build-wolfprovider.yml`
2+
FROM debian:bookworm
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
build-essential \
8+
devscripts \
9+
debhelper \
10+
dh-autoreconf \
11+
libtool \
12+
pkg-config \
13+
git \
14+
wget \
15+
curl \
16+
ca-certificates \
17+
openssl \
18+
dpkg-dev \
19+
lintian \
20+
fakeroot \
21+
dh-exec \
22+
equivs \
23+
expect \
24+
xxd \
25+
bc \
26+
libdistro-info-perl \
27+
&& rm -rf /var/lib/apt/lists/*

.github/workflows/bind9.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ jobs:
1818
with:
1919
wolfssl_ref: ${{ matrix.wolfssl_ref }}
2020
openssl_ref: ${{ matrix.openssl_ref }}
21+
fips_ref: ${{ matrix.fips_ref }}
2122
replace_default: ${{ matrix.replace_default }}
2223
strategy:
2324
matrix:
2425
wolfssl_ref: [ 'v5.8.2-stable' ]
2526
openssl_ref: [ 'openssl-3.5.2' ]
27+
fips_ref: [ 'FIPS', 'non-FIPS' ]
2628
replace_default: [ true ]
27-
fips: [ false ]
2829

2930
test_bind:
3031
runs-on: ubuntu-22.04
32+
needs: build_wolfprovider
3133
container:
3234
image: debian:bookworm
3335
env:
3436
DEBIAN_FRONTEND: noninteractive
35-
needs: build_wolfprovider
3637
# This should be a safe limit for the tests to run.
3738
timeout-minutes: 20
3839
strategy:
@@ -41,9 +42,9 @@ jobs:
4142
bind_ref: [ 'v9.18.28' ]
4243
wolfssl_ref: [ 'v5.8.2-stable' ]
4344
openssl_ref: [ 'openssl-3.5.2' ]
45+
fips_ref: [ 'FIPS', 'non-FIPS' ]
4446
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
4547
replace_default: [ true ]
46-
fips: [ false ]
4748
env:
4849
WOLFSSL_PACKAGES_PATH: /tmp/wolfssl-packages
4950
OPENSSL_PACKAGES_PATH: /tmp/openssl-packages
@@ -54,24 +55,14 @@ jobs:
5455
with:
5556
fetch-depth: 1
5657

57-
- name: Checking OpenSSL/wolfProvider packages in cache
58-
uses: actions/cache/restore@v4
59-
id: wolfprov-cache
58+
- name: Download packages from build job
59+
uses: actions/download-artifact@v4
6060
with:
61-
path: |
62-
${{ env.WOLFSSL_PACKAGES_PATH }}
63-
${{ env.OPENSSL_PACKAGES_PATH }}
64-
${{ env.WOLFPROV_PACKAGES_PATH }}
65-
key: openssl-wolfprov-debian-packages-${{ github.sha }}${{ matrix.replace_default && '-replace-default' || '' }}
66-
fail-on-cache-miss: true
61+
name: debian-packages-${{ matrix.fips_ref }}${{ matrix.replace_default && '-replace-default' || '' }}-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}
62+
path: /tmp
6763

6864
- name: Install wolfSSL/OpenSSL/wolfprov packages
6965
run: |
70-
printf "Installing OpenSSL/wolfProvider packages:\n"
71-
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
72-
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
73-
ls -la ${{ env.WOLFPROV_PACKAGES_PATH }}
74-
7566
apt install --reinstall -y --allow-downgrades --allow-change-held-packages \
7667
${{ env.WOLFSSL_PACKAGES_PATH }}/libwolfssl_*.deb
7768
@@ -85,7 +76,9 @@ jobs:
8576
8677
- name: Verify wolfProvider is properly installed
8778
run: |
88-
$GITHUB_WORKSPACE/scripts/verify-install.sh ${{ matrix.replace_default && '--replace-default' || '' }} ${{ matrix.fips && '--fips' || '' }}
79+
$GITHUB_WORKSPACE/scripts/verify-install.sh \
80+
${{ matrix.replace_default && '--replace-default' || '' }} \
81+
${{ matrix.fips_ref == 'FIPS' && '--fips' || '' }}
8982
9083
- name: Install bind9 test dependencies
9184
run: |
@@ -113,7 +106,11 @@ jobs:
113106
fetch-depth: 1
114107
- run: |
115108
cd bind9
116-
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/bind9/bind9-${{ matrix.bind_ref }}-wolfprov.patch
109+
if [ "${{ matrix.fips_ref }}" = "FIPS" ]; then
110+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/bind9/bind9-${{ matrix.bind_ref }}-wolfprov-fips.patch
111+
else
112+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/bind9/bind9-${{ matrix.bind_ref }}-wolfprov.patch
113+
fi
117114
118115
- name: Build and test bind9 with wolfProvider
119116
working-directory: bind9

.github/workflows/build-wolfprovider.yml

Lines changed: 145 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
openssl_ref:
1010
required: true
1111
type: string
12+
fips_ref:
13+
required: false
14+
type: string
1215
replace_default:
1316
required: false
1417
type: boolean
@@ -18,103 +21,187 @@ jobs:
1821
build_wolfprovider_common:
1922
name: Build wolfProvider
2023
runs-on: ubuntu-22.04
21-
# Run inside Debian Bookworm to match packaging environment
24+
# Grant permissions to read packages from ghcr.io
25+
permissions:
26+
contents: read
27+
packages: read
28+
# Run inside Debian Bookworm using container from ghcr.io/wolfssl/build-wolfprovider-debian:bookworm
29+
# We are using this container to avoid having to install all the dependencies on the host machine
30+
# and speed up the build process.
31+
# Note: Docker image paths must be lowercase even though the GitHub org is wolfSSL
2232
container:
23-
image: debian:bookworm
33+
image: ghcr.io/wolfssl/build-wolfprovider-debian:bookworm
2434
env:
2535
DEBIAN_FRONTEND: noninteractive
36+
# Add network capabilities so ifconfig/RTNETLINK operations are permitted
37+
# These are passed to `docker run` as runtime options
38+
options: --cap-add=NET_ADMIN --cap-add=NET_RAW
2639
timeout-minutes: 20
2740
env:
2841
WOLFSSL_PACKAGES_PATH: /tmp/wolfssl-packages
2942
OPENSSL_PACKAGES_PATH: /tmp/openssl-packages
3043
WOLFPROV_PACKAGES_PATH: /tmp/wolfprov-packages
44+
DEBS_PATH: debs
3145
steps:
32-
# Install git prior to cloning to ensure we have the full repo
33-
# TODO: create a docker with these pre-installed
34-
- name: Install common dependencies
46+
# Check if artifact already exists from another job in the same workflow run
47+
# When multiple matrix jobs run in parallel, the first one to finish uploads the artifact
48+
# Other jobs can then find it and skip rebuilding (no need to download it, just check it exists)
49+
- name: Check for existing artifact from same run
50+
id: check_artifact
51+
continue-on-error: true
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: debian-packages-${{ inputs.fips_ref }}${{ inputs.replace_default && '-replace-default' || '' }}-${{ inputs.wolfssl_ref }}-${{ inputs.openssl_ref }}
55+
56+
# Download pre-built packages from debs branch
57+
- name: Checkout debs branch
58+
if: steps.check_artifact.outcome != 'success'
59+
uses: actions/checkout@v4
60+
with:
61+
repository: wolfSSL/wolfProvider
62+
ref: debs
63+
sparse-checkout: |
64+
fips
65+
nonfips
66+
openssl
67+
sparse-checkout-cone-mode: false
68+
path: ${{ env.DEBS_PATH }}
69+
70+
- name: Setup packages from debs branch
71+
if: steps.check_artifact.outcome != 'success'
72+
run: |
73+
mkdir -p ${{ env.WOLFSSL_PACKAGES_PATH }}
74+
mkdir -p ${{ env.OPENSSL_PACKAGES_PATH }}
75+
76+
echo "Available packages in debs branch:"
77+
ls -la ${{ env.DEBS_PATH }}/
78+
79+
# Copy packages based on build type
80+
if [ "${{ inputs.fips_ref }}" = "FIPS" ]; then
81+
if [ -d "${{ env.DEBS_PATH }}/fips" ] && [ "$(ls -A ${{ env.DEBS_PATH }}/fips/*.deb 2>/dev/null)" ]; then
82+
echo "Copying FIPS wolfSSL packages..."
83+
cp ${{ env.DEBS_PATH }}/fips/*.deb ${{ env.WOLFSSL_PACKAGES_PATH }}/
84+
else
85+
echo "ERROR: No FIPS packages found in debs branch"
86+
exit 1
87+
fi
88+
else
89+
if [ -d "${{ env.DEBS_PATH }}/nonfips" ] && [ "$(ls -A ${{ env.DEBS_PATH }}/nonfips/*.deb 2>/dev/null)" ]; then
90+
echo "Copying non-FIPS wolfSSL packages..."
91+
cp ${{ env.DEBS_PATH }}/nonfips/*.deb ${{ env.WOLFSSL_PACKAGES_PATH }}/
92+
else
93+
echo "ERROR: No non-FIPS packages found in debs branch"
94+
exit 1
95+
fi
96+
fi
97+
# Copy OpenSSL packages based on replace_default setting
98+
if [ "${{ inputs.replace_default }}" = "true" ]; then
99+
if [ -d "${{ env.DEBS_PATH }}/openssl/debs-replace-default" ] && [ "$(ls -A ${{ env.DEBS_PATH }}/openssl/debs-replace-default/*.deb 2>/dev/null)" ]; then
100+
echo "Copying OpenSSL replace-default packages..."
101+
cp ${{ env.DEBS_PATH }}/openssl/debs-replace-default/*.deb ${{ env.OPENSSL_PACKAGES_PATH }}/
102+
else
103+
echo "WARNING: No OpenSSL replace-default packages found in debs branch"
104+
fi
105+
else
106+
if [ -d "${{ env.DEBS_PATH }}/openssl/debs-default" ] && [ "$(ls -A ${{ env.DEBS_PATH }}/openssl/debs-default/*.deb 2>/dev/null)" ]; then
107+
echo "Copying OpenSSL default packages..."
108+
cp ${{ env.DEBS_PATH }}/openssl/debs-default/*.deb ${{ env.OPENSSL_PACKAGES_PATH }}/
109+
else
110+
echo "WARNING: No OpenSSL default packages found in debs branch"
111+
fi
112+
fi
113+
114+
echo ""
115+
echo "Packages ready for installation:"
116+
echo "wolfSSL packages:"
117+
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
118+
echo ""
119+
echo "OpenSSL packages:"
120+
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
121+
122+
- name: Install OpenSSL and wolfSSL packages
123+
if: steps.check_artifact.outcome != 'success'
35124
run: |
36-
apt-get update && apt-get install -y --no-install-recommends \
37-
build-essential \
38-
devscripts \
39-
debhelper \
40-
dh-autoreconf \
41-
libtool \
42-
pkg-config \
43-
git \
44-
wget \
45-
curl \
46-
ca-certificates \
47-
openssl \
48-
dpkg-dev \
49-
lintian \
50-
fakeroot \
51-
dh-exec \
52-
equivs \
53-
expect \
54-
xxd \
55-
bc \
56-
libdistro-info-perl
125+
echo "Installing OpenSSL and wolfSSL packages (${{ inputs.fips_ref }})..."
126+
127+
# Install OpenSSL packages first
128+
if [ -n "$(ls -A ${{ env.OPENSSL_PACKAGES_PATH }}/*.deb 2>/dev/null)" ]; then
129+
echo "Installing OpenSSL packages..."
130+
dpkg -i ${{ env.OPENSSL_PACKAGES_PATH }}/*.deb || true
131+
fi
132+
# Install wolfSSL packages
133+
if [ -n "$(ls -A ${{ env.WOLFSSL_PACKAGES_PATH }}/*.deb 2>/dev/null)" ]; then
134+
echo "Installing wolfSSL packages..."
135+
dpkg -i ${{ env.WOLFSSL_PACKAGES_PATH }}/*.deb || true
136+
fi
137+
138+
# Fix any dependency issues
139+
apt-get install -f -y
140+
141+
echo ""
142+
echo "Packages installed successfully:"
143+
echo "OpenSSL:"
144+
dpkg -l | grep openssl || echo " No OpenSSL packages found"
145+
echo ""
146+
echo "wolfSSL:"
147+
dpkg -l | grep wolfssl || echo " No wolfSSL packages found"
57148
58149
- name: Checkout wolfProvider
150+
if: steps.check_artifact.outcome != 'success'
59151
uses: actions/checkout@v4
60152
with:
61153
fetch-depth: 1
62154
fetch-tags: true
63155

64156
# Avoid "detected dubious ownership" warning
65157
- name: Ensure the working directory safe
158+
if: steps.check_artifact.outcome != 'success'
66159
run: |
67160
git config --global --add safe.directory "$GITHUB_WORKSPACE"
68161
69162
# When running on a fork the upstream tags are not present, so fetch them explicitly
70163
- name: Fetch tags from upstream(for Debian versioning)
164+
if: steps.check_artifact.outcome != 'success'
71165
run: |
72166
git remote add upstream https://github.com/wolfSSL/wolfProvider.git || true
73167
git fetch upstream --tags --no-recurse-submodules
74168
75-
- name: Install wolfSSL
76-
run: |
77-
$GITHUB_WORKSPACE/debian/install-wolfssl.sh --tag ${{ inputs.wolfssl_ref }} ${{ env.WOLFSSL_PACKAGES_PATH }}
78-
79-
- name: Install OpenSSL
80-
run: |
81-
$GITHUB_WORKSPACE/debian/install-openssl.sh ${{ inputs.replace_default && '--replace-default' || '' }} ${{ env.OPENSSL_PACKAGES_PATH }}
82-
83169
- name: Install wolfProvider
170+
if: steps.check_artifact.outcome != 'success'
84171
run: |
85-
$GITHUB_WORKSPACE/debian/install-wolfprov.sh ${{ env.WOLFPROV_PACKAGES_PATH }}
172+
$GITHUB_WORKSPACE/debian/install-wolfprov.sh ${{ inputs.fips_ref == 'FIPS' && '--fips' || '' }} ${{ env.WOLFPROV_PACKAGES_PATH }}
86173
87-
- name: List packages directories
174+
- name: Setup packages directory
175+
if: steps.check_artifact.outcome != 'success'
88176
run: |
177+
mkdir -p ${{ env.WOLFPROV_PACKAGES_PATH }}
178+
179+
# Copy wolfProvider packages (built in previous step)
180+
cp $GITHUB_WORKSPACE/../libwolfprov*.deb ${{ env.WOLFPROV_PACKAGES_PATH }}
181+
cp $GITHUB_WORKSPACE/../libwolfprov*.dsc ${{ env.WOLFPROV_PACKAGES_PATH }}
182+
cp $GITHUB_WORKSPACE/../libwolfprov*.tar.gz ${{ env.WOLFPROV_PACKAGES_PATH }}
183+
184+
# Note: OpenSSL and wolfSSL packages already copied from debs branch earlier
185+
186+
printf "Listing packages directory:\n"
187+
echo "wolfProvider packages:"
89188
ls -la ${{ env.WOLFPROV_PACKAGES_PATH }}
189+
echo ""
190+
echo "wolfSSL packages:"
90191
ls -la ${{ env.WOLFSSL_PACKAGES_PATH }}
192+
echo ""
193+
echo "OpenSSL packages:"
91194
ls -la ${{ env.OPENSSL_PACKAGES_PATH }}
92195
93-
- name: Save all packages to cache for use by other workflows
94-
uses: actions/cache/save@v4
95-
continue-on-error: true
196+
# Save all packages as artifacts for consumers
197+
# Skip upload if artifact already exists (from a parallel run)
198+
- name: Upload wolfProvider packages
199+
if: steps.check_artifact.outcome != 'success'
200+
uses: actions/upload-artifact@v4
96201
with:
202+
name: debian-packages-${{ inputs.fips_ref }}${{ inputs.replace_default && '-replace-default' || '' }}-${{ inputs.wolfssl_ref }}-${{ inputs.openssl_ref }}
97203
path: |
98204
${{ env.WOLFSSL_PACKAGES_PATH }}
99205
${{ env.OPENSSL_PACKAGES_PATH }}
100206
${{ env.WOLFPROV_PACKAGES_PATH }}
101-
key: openssl-wolfprov-debian-packages-${{ github.sha }}${{ inputs.replace_default && '-replace-default' || '' }}
102-
103-
# Save all packages in a single artifact for consumers
104-
# TODO: support debug builds
105-
- name: Upload wolfProvider artifacts
106-
uses: actions/upload-artifact@v4
107-
continue-on-error: true
108-
with:
109-
name: openssl-wolfprov-debian-packages-${{ github.sha }}${{ inputs.replace_default && '-replace-default' || '' }}
110-
path: |
111-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.deb
112-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.dsc
113-
${{ env.WOLFSSL_PACKAGES_PATH }}/*.tar.gz
114-
${{ env.OPENSSL_PACKAGES_PATH }}/*.deb
115-
${{ env.OPENSSL_PACKAGES_PATH }}/*.dsc
116-
${{ env.OPENSSL_PACKAGES_PATH }}/*.tar.gz
117-
${{ env.WOLFPROV_PACKAGES_PATH }}/*.deb
118-
${{ env.WOLFPROV_PACKAGES_PATH }}/*.dsc
119-
${{ env.WOLFPROV_PACKAGES_PATH }}/*.tar.gz
120207
retention-days: 1

0 commit comments

Comments
 (0)