diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..9b7cdf71 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: C/C++ CI + +on: + push: + branches: [ $default-branch ] + pull_request: + types: [ opened, reopened, synchronize ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libevent-dev \ + libssl-dev \ + libpq-dev libmariadb-dev libsqlite3-dev \ + libhiredis-dev \ + libmongoc-dev \ + libmicrohttpd-dev + - uses: actions/checkout@v3 + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check + - name: apps tests + run: cd examples && ./run_tests.sh diff --git a/examples/run_tests.sh b/examples/run_tests.sh new file mode 100755 index 00000000..5c3671d7 --- /dev/null +++ b/examples/run_tests.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo 'Running turnserver' +../bin/turnserver --use-auth-secret --static-auth-secret=secret --realm=north.gov --allow-loopback-peers --no-cli > /dev/null & +echo 'Running peer client' +../bin/turnutils_peer -L 127.0.0.1 -L ::1 -L 0.0.0.0 > /dev/null & + +sleep 2 + +echo 'Running turn client TCP' +../bin/turnutils_uclient -t -e 127.0.0.1 -X -g -u user -W secret -t 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null +if [ $? -eq 0 ]; then + echo OK +else + echo FAIL + exit $? +fi + +echo 'Running turn client UDP' +../bin/turnutils_uclient -e 127.0.0.1 -X -g -u user -W secret -t 127.0.0.1 | grep "start_mclient: tot_send_bytes ~ 1000, tot_recv_bytes ~ 1000" > /dev/null +if [ $? -eq 0 ]; then + echo OK +else + echo FAIL + exit $? +fi