From 9d17aa45b907e65dac0c8e92f5ee6673f10de135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Almeida?= Date: Mon, 13 Nov 2023 08:40:52 +0000 Subject: [PATCH] Added github workflow to build and run the tests in Ubuntu (#25) * Added github workflow to build the project in Ubuntu * Run the tests in each CI run --- .github/workflows/makefile.yml | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/makefile.yml diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 0000000..c49768e --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,60 @@ +name: C/C++ CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: [ubuntu-22.04] + + steps: + - name: "Checkout" + uses: actions/checkout@v3 + + - name: "Checkout capicxx-core-runtime" + uses: actions/checkout@v3 + with: + repository: COVESA/capicxx-core-runtime + path: 'capicxx-core-runtime' + + - name: "Install dbus and googletest" + run: | + wget http://dbus.freedesktop.org/releases/dbus/dbus-1.13.6.tar.gz + tar -xzf dbus-1.13.6.tar.gz + for patch in src/dbus-patches/*.patch + do + patch -d dbus-1.13.6 -Np1 -i "$PWD/$patch" || continue + done + + cmake -B build-dbus/libdbus -D DBUS_BUILD_TESTS=N -D CMAKE_INSTALL_PREFIX=install -S dbus-1.13.6/cmake + cmake --build build-dbus/libdbus + cmake --install build-dbus/libdbus --strip + + sudo apt-get install libgtest-dev + cd /usr/src/gtest + sudo cmake CMakeLists.txt + sudo make + sudo cp lib/*.a /usr/lib + sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a + sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a + + - name: "Build capicxx-core-runtime" + run: | + cmake -S capicxx-core-runtime -B build-core-runtime -D CMAKE_INSTALL_PREFIX=install + cmake --build build-core-runtime --target install + + - name: "Build capicxx-dbus-runtime" + run: | + cmake -S . -B build-dbus-runtime -D GTEST_ROOT=/usr/src/googletest -D CMAKE_PREFIX_PATH=install -D CMAKE_INSTALL_PREFIX=install + cmake --build build-dbus-runtime --target build_tests + cmake --install build-dbus-runtime --strip + + - name: "Run tests" + run: | + ls -l ${{ github.workspace }}/install/lib + export LD_LIBRARY_PATH=${{ github.workspace }}/install/lib + export COMMONAPI_CONFIG=${{ github.workspace }}/src/test/commonapi-dbus.ini + env -C build-dbus-runtime ctest -V