Skip to content

Commit

Permalink
ci: add ci workflow for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
exbotanical committed Oct 13, 2023
1 parent 6d9637c commit e4858f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e4858f7

Please sign in to comment.