Skip to content

Commit d2cba6d

Browse files
authored
Merge pull request #157 from aidangarske/liboauth2-workflow
liboauth2 CI test support
2 parents 76f15e4 + 525e9ed commit d2cba6d

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,21 @@ if [ "$WOLFPROV_FORCE_FAIL" = "WOLFPROV_FORCE_FAIL=1" ]; then
242242
echo "Error: openssh-test.log not found"
243243
exit 1
244244
fi
245+
# ----- LIBOAUTH2 -----
246+
elif [ "$TEST_SUITE" = "liboauth2" ]; then
247+
if [ -f "liboauth2-test.log" ]; then
248+
# Check for expected error patterns
249+
if grep -q "FAIL: check_liboauth2" "liboauth2-test.log"; then
250+
echo "PASS: liboauth2 tests failed as expected with force fail enabled"
251+
exit 0
252+
else
253+
echo "FAIL: liboauth2 tests unexpectedly succeeded with force fail enabled"
254+
exit 1
255+
fi
256+
else
257+
echo "Error: liboauth2-test.log not found"
258+
exit 1
259+
fi
245260
else
246261
if [ $TEST_RESULT -eq 0 ]; then
247262
echo "$TEST_SUITE tests unexpectedly succeeded with force fail enabled"

.github/workflows/liboauth2.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: liboauth2 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+
uses: ./.github/workflows/build-wolfprovider.yml
18+
with:
19+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
20+
openssl_ref: ${{ matrix.openssl_ref }}
21+
strategy:
22+
matrix:
23+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
24+
openssl_ref: [ 'openssl-3.5.0' ]
25+
26+
test_liboauth2:
27+
runs-on: ubuntu-22.04
28+
needs: build_wolfprovider
29+
timeout-minutes: 20
30+
strategy:
31+
matrix:
32+
liboauth2_ref: [ 'v1.4.5.4' ] # No master with patch
33+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
34+
openssl_ref: [ 'openssl-3.5.0' ]
35+
force_fail: ['WOLFPROV_FORCE_FAIL=1', '']
36+
steps:
37+
- name: Checkout wolfProvider
38+
uses: actions/checkout@v4
39+
40+
- name: Retrieving OpenSSL from cache
41+
uses: actions/cache/restore@v4
42+
id: openssl-cache
43+
with:
44+
path: |
45+
openssl-source
46+
openssl-install
47+
48+
key: ossl-depends-${{ matrix.openssl_ref }}-${{ github.sha }}
49+
fail-on-cache-miss: true
50+
51+
- name: Retrieving wolfSSL/wolfProvider from cache
52+
uses: actions/cache/restore@v4
53+
id: wolfprov-cache
54+
with:
55+
path: |
56+
wolfssl-source
57+
wolfssl-install
58+
wolfprov-install
59+
provider.conf
60+
61+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ github.sha }}
62+
fail-on-cache-miss: true
63+
64+
- name: Install liboauth2 dependencies
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -y libssl-dev libcurl4-openssl-dev libjansson-dev \
68+
libcjose-dev pkg-config build-essential apache2-dev libhiredis-dev \
69+
libmemcached-dev autotools-dev autoconf automake libtool check
70+
71+
- name: Checkout OSP
72+
uses: actions/checkout@v4
73+
with:
74+
repository: wolfssl/osp
75+
path: osp
76+
77+
- name: Build liboauth2
78+
run: |
79+
git clone https://github.com/OpenIDC/liboauth2.git
80+
cd liboauth2
81+
git checkout ${{ matrix.liboauth2_ref }}
82+
patch -p1 < $GITHUB_WORKSPACE/osp/wolfProvider/liboauth2/liboauth2-${{ matrix.liboauth2_ref }}-wolfprov.patch
83+
84+
autoreconf -fiv
85+
./configure
86+
make -j$(nproc)
87+
88+
- name: Run liboauth2 tests
89+
working-directory: liboauth2
90+
run: |
91+
# Set environment variables
92+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
93+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
94+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
95+
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/openssl-install/lib64/pkgconfig
96+
export ${{ matrix.force_fail }}
97+
98+
# Build and run tests
99+
make check 2>&1 | tee liboauth2-test.log
100+
TEST_RESULT=$?
101+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} liboauth2

0 commit comments

Comments
 (0)