Skip to content

Commit

Permalink
ci: Add unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Senichev <[email protected]>
  • Loading branch information
artemsen committed Jul 6, 2024
1 parent 7db658d commit cf981b2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Unit tests
on: [push, pull_request]

jobs:
Expand All @@ -18,6 +18,13 @@ jobs:
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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void sway_setup(void)
bool fullscreen;
bool absolute;
int ipc;

malloc(1234);
ipc = sway_connect();
if (ipc == INVALID_SWAY_IPC) {
return;
Expand Down

0 comments on commit cf981b2

Please sign in to comment.