From 5f0de27d836efc3301dbd517cecd6cec0055dc26 Mon Sep 17 00:00:00 2001 From: Artem Senichev Date: Sat, 6 Jul 2024 21:13:13 +0300 Subject: [PATCH] ci: Add unit tests Signed-off-by: Artem Senichev --- .github/workflows/check.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..24bce1b --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,46 @@ +name: CI +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Update package info + run: sudo apt update + - name: Install dependencies + run: > + sudo apt install --no-install-recommends --yes + build-essential meson pkg-config wayland-protocols + libwayland-dev libjson-c-dev libxkbcommon-dev + libfreetype-dev libfontconfig-dev + libopenexr-dev libgif-dev libheif-dev libavif-dev + libjpeg-dev librsvg2-dev libtiff-dev libwebp-dev + + - name: Install gtest + run: | + sudo apt install --no-install-recommends --yes libgtest-dev cmake + 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 + with: + fetch-depth: 0 + + - name: Get version + 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}} -Dtests=enabled --prefix=/usr ./build + - name: Build + run: ninja -C ./build + - name: Install + run: DESTDIR=install ninja -C ./build install + - name: Check version + run: ./build/install/usr/bin/swayimg --version + - name: Run unit tests + run: meson test --verbose -C ./build