Skip to content

feat(tests): add ubus tests for umlua auth #114

feat(tests): add ubus tests for umlua auth

feat(tests): add ubus tests for umlua auth #114

Workflow file for this run

name: github-action-on-push
on:
push:
branches:
- main
- dev
jobs:
cog-check-job:
runs-on: ubuntu-latest
name: check conventional commit compliance
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Conventional commit check
uses: cocogitto/cocogitto-action@v3
build:
runs-on: ubuntu-latest
needs: cog-check-job
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_out
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install umINK dependencies
run: |
sudo apt-get update && \
sudo apt-get install -y \
gperf \
libmosquitto-dev \
mosquitto-dev \
mosquitto \
mosquitto-clients \
libpaho-mqtt-dev \
liblua5.3-dev \
libjson-c-dev \
libcmocka-dev \
libasan5 \
iproute2 \
cmake \
libxml2-utils &&
sudo ln -s /usr/lib/x86_64-linux-gnu/pkgconfig/lua-5.3.pc \
/usr/lib/x86_64-linux-gnu/pkgconfig/lua.pc &&
pip3 install 'gcovr == 6'
- name: libubox
run: |
git clone https://github.com/openwrt/libubox.git
cd libubox && mkdir build && cd build
cmake -DBUILD_LUA=off .. && sudo make install
- name: ubus
run: |
git clone https://github.com/openwrt/ubus.git
cd ubus && mkdir ubus && cd ubus
cmake -DBUILD_LUA=off ..
sudo make install
- name: mosquitto
run: |
mosquitto_passwd -c -b /tmp/pwdfile user password
cp /etc/mosquitto/mosquitto.conf /tmp
echo "password_file /tmp/pwdfile" >> /tmp/mosquitto.conf
echo "allow_anonymous false" >> /tmp/mosquitto.conf
echo "listener 1883" >> /tmp/mosquitto.conf
echo "protocol mqtt" >> /tmp/mosquitto.conf
mosquitto -c /tmp/mosquitto.conf -v -d
mosquitto_pub -h 127.0.0.1 -t "mink/DEBUG_UUID/1/cmd" -m test_payload -u user -P password -r
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
run: |
export ASAN_OPTIONS=verify_asan_link_order=0
./autogen.sh
./configure --enable-mqtt \
--enable-mosquitto-auth \
--enable-openwrt
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} \
make clean all
- name: run unit tests
run: |
rm -f /tmp/tmp_file_uuid
bash ./test/test_bin_upload.sh &
sudo LD_LIBRARY_PATH=/usr/local/lib /usr/local/sbin/ubusd &
sudo LD_LIBRARY_PATH=/usr/local/lib make check
- name: generate coverage data
run: |
mkdir coverage-dir
cd coverage-dir
gcovr --sonarqube coverage.xml -r ..
cd ..
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
--define sonar.coverageReportPaths=coverage-dir/coverage.xml