Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmayPatil105 committed Jun 12, 2024
1 parent b851d0d commit fd7051b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check memory leaks

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependency
run: |
sudo apt-get -y install cmake valgrind
- name: Build
run: bash ci/build-and-install.sh
- name: Test
run: bash ci/test-memory.sh
19 changes: 19 additions & 0 deletions ci/test-memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

BINARY="./build/src/md2html"
TESTS_FILE_DIR="./tests"

failed=0

for md in "$TESTS_FILE_DIR"/*; do
valgrind --leak-check=full --error-exitcode=1 $BINARY -i $md
if [ $? -eq 1 ]; then
failed=1
fi
done

if [ $failed -eq 1 ]; then
exit 1
else
exit 0
fi

0 comments on commit fd7051b

Please sign in to comment.