diff mbox series

[libubox,2/2] CI: Add github action

Message ID 20230308231152.2142824-2-hauke@hauke-m.de
State Under Review
Delegated to: Hauke Mehrtens
Headers show
Series [libubox,1/2] fuzz: Compile using libstd++ | expand

Commit Message

Hauke Mehrtens March 8, 2023, 11:11 p.m. UTC
Add a github action to build libubox and then execute the tests.

clang 14 generates debug informations in DWARF 5 format, but valgrind
19.0 does not support that. Install valgrind 20.0 from experimental
which supports it.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---

I created a github pull request with these changes too:
https://github.com/openwrt/libubox/pull/2

 .github/workflows/test.yml | 61 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 .github/workflows/test.yml
diff mbox series

Patch

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..c6cdf0d
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,61 @@ 
+name: 'Run tests'
+
+on:
+  push:
+
+jobs:
+  build_test:
+    strategy:
+      matrix:
+        include:
+          - compiler: "-DCMAKE_C_COMPILER=clang"
+          - compiler: "-DCMAKE_C_COMPILER=gcc"
+
+    name: Build and run tests
+    runs-on: ubuntu-latest
+    container:
+      image: debian:bookworm
+
+    steps:
+
+      - name: Add Debian experimental
+        run: |
+           echo "deb http://deb.debian.org/debian/ experimental main" >> /etc/apt/sources.list
+
+      - name: Install compiler
+        run: |
+          apt update
+          apt install -y cmake build-essential lua5.1 pkgconf libjson-c-dev liblua5.1-0-dev python3.11-venv clang
+          apt -t experimental install -y valgrind
+          useradd -ms /bin/bash buildbot
+
+      - name: Checkout libubox
+        uses: actions/checkout@v3
+        with:
+          path: libubox
+
+      - name: Create build directory
+        run: mkdir build
+
+      - name: Fix permission
+        run: chown -R buildbot:buildbot build libubox
+
+      - name: Run cmake
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: build
+        run: cmake ../libubox -DUNIT_TESTING=true ${{ matrix.compiler }}
+
+      - name: build
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: build
+        run: make
+
+      - name: Run tests
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: build
+        run: make test
+
+      - name: Show logs
+        shell: su buildbot -c "sh -e {0}"
+        working-directory: build
+        run: cat Testing/Temporary/LastTest.log