Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Run tests'

on:
push:
pull_request:

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 libc++abi-dev libc++-dev
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: Run 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 changes: 1 addition & 1 deletion tests/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MACRO(ADD_FUZZER_TEST name)
ADD_EXECUTABLE(${name} ${name}.c)
TARGET_COMPILE_OPTIONS(${name} PRIVATE -g -O1 -fno-omit-frame-pointer -fsanitize=fuzzer,address,leak,undefined)
TARGET_INCLUDE_DIRECTORIES(${name} PRIVATE ${PROJECT_SOURCE_DIR})
TARGET_LINK_OPTIONS(${name} PRIVATE -stdlib=libc++ -fsanitize=fuzzer,address,leak,undefined)
TARGET_LINK_OPTIONS(${name} PRIVATE -fsanitize=fuzzer,address,leak,undefined)
TARGET_LINK_LIBRARIES(${name} ubox blobmsg_json json_script ${json})
ADD_TEST(
NAME ${name}
Expand Down