From 1dbd92030724ff1e9df58291722d33d2d89fbc12 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 31 Jul 2020 00:23:15 +0200 Subject: ci: Initial CI --- .builds/alpine.yml | 26 ++++++++++++++++++++++++++ .builds/archlinux.yml | 28 ++++++++++++++++++++++++++++ .builds/smoketest-builtin.sh | 21 +++++++++++++++++++++ .builds/smoketest-seatd.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 .builds/alpine.yml create mode 100644 .builds/archlinux.yml create mode 100755 .builds/smoketest-builtin.sh create mode 100755 .builds/smoketest-seatd.sh (limited to '.builds') diff --git a/.builds/alpine.yml b/.builds/alpine.yml new file mode 100644 index 0000000..0075534 --- /dev/null +++ b/.builds/alpine.yml @@ -0,0 +1,26 @@ +image: alpine/edge +packages: + - meson + - linux-headers + - clang + - clang-analyzer +sources: + - https://git.sr.ht/~kennylevinsen/seatd +tasks: + - prepare: | + cd seatd + meson build -Dseatd=enabled -Dbuiltin=enabled -Dlogind=disabled + - build: | + cd seatd + ninja -C build + - scan-build: | + cd seatd + ninja -C build scan-build + [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ] + - smoketest: | + cd seatd + timeout -s KILL 30s ./.builds/smoketest-seatd.sh + - check-format: | + cd seatd + ninja -C build clang-format + git diff --exit-code diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml new file mode 100644 index 0000000..4eda0a8 --- /dev/null +++ b/.builds/archlinux.yml @@ -0,0 +1,28 @@ +image: archlinux +packages: + - meson + - linux-headers + - clang + - clang-analyzer +sources: + - https://git.sr.ht/~kennylevinsen/seatd +tasks: + - prepare: | + cd seatd + meson -Dlogind=enabled -Dseatd=enabled -Dbuiltin=enabled build + - build: | + cd seatd + ninja -C build + - scan-build: | + cd seatd + ninja -C build scan-build + [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ] + - smoketest: | + cd seatd + rm -rf build + meson -Db_sanitize=address -Dlogind=enabled -Dseatd=enabled -Dbuiltin=enabled build + ninja -C build + timeout -s KILL 30s ./.builds/smoketest-seatd.sh + - smoketest-builtin: | + cd seatd + timeout -s KILL 30s ./.builds/smoketest-builtin.sh diff --git a/.builds/smoketest-builtin.sh b/.builds/smoketest-builtin.sh new file mode 100755 index 0000000..acf4640 --- /dev/null +++ b/.builds/smoketest-builtin.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +res=0 +# +# Run simpletest a few times +# +cnt=0 +while [ "$cnt" -lt 5 ] +do + echo "Simpletest run $cnt" + if ! sudo LIBSEAT_BACKEND=builtin LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest + then + echo "Simpletest failed" + res=1 + break + fi + cnt=$((cnt+1)) +done + + +exit $res diff --git a/.builds/smoketest-seatd.sh b/.builds/smoketest-seatd.sh new file mode 100755 index 0000000..ec97a1f --- /dev/null +++ b/.builds/smoketest-seatd.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# +# Start seatd +# +[ -f seatd.sock ] && sudo rm seatd.sock +sudo LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/seatd & + +# seatd is started in the background, so wait for it to come alive +cnt=0 +while ! [ -e ./seatd.sock ] && [ "$cnt" -lt 10 ] +do + sleep 0.1 + cnt=$((cnt+1)) +done + +if ! [ -e ./seatd.sock ] +then + echo "seatd socket not found" + exit 1 +fi + +sudo chmod 777 ./seatd.sock + +# +# Run simpletest a few times +# +cnt=0 +while [ "$cnt" -lt 5 ] +do + echo "Simpletest run $cnt" + if ! LIBSEAT_LOGLEVEL=debug SEATD_SOCK=./seatd.sock ./build/simpletest + then + echo "Simpletest failed" + sudo killall seatd + exit 1 + fi + cnt=$((cnt+1)) +done + +# +# Wait for it to shut down +# +sudo killall seatd 2>/dev/null -- cgit v1.2.3