mirror of
https://github.com/tomasriveral/NoteWrapper.git
synced 2026-08-11 18:18:36 +02:00
Merge (#14) from tomasriveral/github-testing. Test: add github actions
Added make test run the program for five seconds and sees if it crashes Added github action to build and test
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
gcc \
|
||||||
|
make \
|
||||||
|
pkg-config \
|
||||||
|
libcjson-dev \
|
||||||
|
libncurses-dev \
|
||||||
|
git
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: make test
|
||||||
@@ -23,3 +23,17 @@ run: $(TARGET)
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGET)
|
rm -f $(TARGET)
|
||||||
|
|
||||||
|
test: $(TARGET)
|
||||||
|
@timeout 5s ./$(TARGET); \
|
||||||
|
status=$$?; \
|
||||||
|
if [ $$status -eq 124 ]; then \
|
||||||
|
echo "Program ran for 5 seconds without crashing ✅"; \
|
||||||
|
exit 0; \
|
||||||
|
elif [ $$status -ne 0 ]; then \
|
||||||
|
echo "Program crashed ❌"; \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
echo "Program exited cleanly ✅"; \
|
||||||
|
exit 0; \
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user