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

Hauke Mehrtens hauke at hauke-m.de
Wed Mar 8 15:11:52 PST 2023


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 at 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 --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 at 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
-- 
2.39.2




More information about the openwrt-devel mailing list