diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8bda0d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Continuous Integration Workflow + +on: + push: + branches: + - master + + pull_request: + branches: + - master + +jobs: + test_job: + runs-on: ubuntu-latest + name: A job to run the libutil tests + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Test action step + id: test + uses: ./.github/actions/test + + - name: Get the output data + run: echo "ls -la results ${{ steps.test.outputs.files }}" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cba4add --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y git gcc make + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/Makefile b/Makefile index a81e44b..33616a4 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ $(EXAMPLE_TARGET): $(STATIC_TARGET) clean: rm -f $(OBJ) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(EXAMPLE_TARGET) $(TEST_TARGET) -test: $(STATIC_TARGET) +unit_test: $(STATIC_TARGET) $(CC) $(TESTS) $(wildcard $(DEPSDIR)/tap.c/*.c) $(STATIC_TARGET) -I$(LINCDIR) -I$(SRCDIR) -I$(DEPSDIR) $(LIBS) -o $(TEST_TARGET) ./$(TEST_TARGET) $(MAKE) clean diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..6c81e98 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh -l + +ret="$(make -s unit_test 2>/dev/null)" + +echo "$ret" + +if [ "$(echo "$ret" | grep 'not ok')" != "" ]; then + exit 1 +fi