From 2663ea3f9825b32f99cdf35c02689509feeac801 Mon Sep 17 00:00:00 2001 From: Artem Senichev Date: Sat, 6 Jul 2024 21:25:15 +0300 Subject: [PATCH] ci: Add unit tests Signed-off-by: Artem Senichev --- .github/workflows/{ci.yml => check.yml} | 27 ++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) rename .github/workflows/{ci.yml => check.yml} (58%) diff --git a/.github/workflows/ci.yml b/.github/workflows/check.yml similarity index 58% rename from .github/workflows/ci.yml rename to .github/workflows/check.yml index 0f83395..8bd56d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -name: CI +name: Unit tests on: [push, pull_request] jobs: @@ -17,6 +17,13 @@ jobs: libfreetype-dev libfontconfig-dev libopenexr-dev libgif-dev libheif-dev libavif-dev libjpeg-dev librsvg2-dev libtiff-dev libwebp-dev + libgtest-dev cmake + + - name: Install gtest + run: | + mkdir /tmp/gtest + cd /tmp/gtest && cmake /usr/src/gtest && make -j$(nproc) + sudo cp /tmp/gtest/lib/* /usr/lib/ - name: Check out source code uses: actions/checkout@v3 @@ -27,11 +34,21 @@ jobs: run: echo "VERSION=$(git describe --tags --long --always | sed 's/^v//;s/-/./')" >> $GITHUB_OUTPUT id: version - - name: Configure - run: meson -Dversion=${{steps.version.outputs.VERSION}} --buildtype release --prefix /usr ./build - name: Build - run: ninja -C ./build + run: | + export CC="clang" + export CXX="clang++" + export CFLAGS="-g -fsanitize=address" + export CXXFLAGS="-g -fsanitize=address" + export LDFLAGS="-fsanitize=address" + meson -Dversion=${{steps.version.outputs.VERSION}} -Dtests=enabled --prefix=/usr ./build + ninja -C ./build + - name: Install run: DESTDIR=install ninja -C ./build install - - name: Check + + - name: Check version run: ./build/install/usr/bin/swayimg --version + + - name: Run unit tests + run: meson test --verbose -C ./build