|
| 1 | +name: libwebsockets 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_libwebsockets: |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + needs: build_wolfprovider |
| 29 | + # This should be a safe limit for the tests to run. |
| 30 | + timeout-minutes: 20 |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + libwebsockets_ref: [ 'main', 'v4.3.3' ] |
| 34 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 35 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 36 | + force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ] |
| 37 | + exclude: |
| 38 | + - libwebsockets_ref: 'main' |
| 39 | + force_fail: 'WOLFPROV_FORCE_FAIL=1' |
| 40 | + steps: |
| 41 | + # Checkout the source so we can run the check-workflow-result script |
| 42 | + - name: Checkout wolfProvider |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + sparse-checkout: | |
| 46 | + .github |
| 47 | + - name: Retrieving wolfProvider from cache |
| 48 | + uses: actions/cache/restore@v4 |
| 49 | + id: wolfprov-cache-restore |
| 50 | + with: |
| 51 | + path: | |
| 52 | + scripts |
| 53 | + wolfssl-source |
| 54 | + wolfssl-install |
| 55 | + wolfprov-install |
| 56 | + openssl-install |
| 57 | + provider.conf |
| 58 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 59 | + fail-on-cache-miss: true |
| 60 | + |
| 61 | + - name: Install libwebsockets dependencies |
| 62 | + run: | |
| 63 | + sudo apt-get update |
| 64 | + sudo apt-get install -y libc6 libcap2 zlib1g cmake build-essential |
| 65 | + - name: Download libwebsockets |
| 66 | + uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + repository: warmcat/libwebsockets |
| 69 | + ref: ${{ matrix.libwebsockets_ref }} |
| 70 | + path: libwebsockets |
| 71 | + |
| 72 | + - name: Build libwebsockets |
| 73 | + working-directory: libwebsockets |
| 74 | + run: | |
| 75 | + mkdir build |
| 76 | + cd build |
| 77 | + cmake .. |
| 78 | + make -j$(nproc) |
| 79 | + sudo make install |
| 80 | + - name: Run libwebsockets tests |
| 81 | + working-directory: libwebsockets |
| 82 | + run: | |
| 83 | + echo "Setting environment variables..." |
| 84 | + source $GITHUB_WORKSPACE/scripts/env-setup |
| 85 | + export ${{ matrix.force_fail }} |
| 86 | + ./build/bin/libwebsockets-test-server --port=11111 --ssl > server.log 2>&1 & SERVER_PID=$! |
| 87 | + sleep 5 |
| 88 | + timeout 10 ./build/bin/libwebsockets-test-client 127.0.0.1 --port=11111 --ssl > client.log 2>&1 || echo "Client exited with error $?" |
| 89 | + ldd ./build/bin/libwebsockets-test-server | grep wolfProvider |
| 90 | + ldd ./build/bin/libwebsockets-test-client | grep wolfProvider |
| 91 | + kill $SERVER_PID || echo "Server already exited" |
| 92 | + cat server.log || echo "Missing server.log" |
| 93 | + cat client.log || echo "Missing client.log" |
| 94 | + cat server.log client.log > libwebsockets-test.log |
| 95 | + if grep -q "error:03080006" libwebsockets-test.log || grep -q "Failed to create default vhost" libwebsockets-test.log; then |
| 96 | + TEST_RESULT=1 |
| 97 | + else |
| 98 | + TEST_RESULT=0 |
| 99 | + fi |
| 100 | + $GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} libwebsockets |
0 commit comments