Skip to content

Commit

Permalink
build.sh: Add support for meson dist
Browse files Browse the repository at this point in the history
For testing a release build.
Run it in CI.
Also quit on failure (set -e)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Feb 12, 2024
1 parent 1c08152 commit 354312b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,13 @@ jobs:
- name: Install
run: ./build.sh install

- name: Dist
run: ./build.sh dist

- name: Show install log
run: ./build.sh install-log

- name: Run tests
- name: Tests
run: if [ ! "$SKIP_TESTS" ]; then ./build.sh test; else echo "tests skipped"; fi

- name: Show test log
Expand Down
22 changes: 21 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
# Copyright (c) 2019-2021 Petr Vorel <pvorel@suse.cz>
set -e

CFLAGS="${CFLAGS:--Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=return-type -fno-common}"
CC="${CC:-gcc}"
Expand Down Expand Up @@ -77,6 +78,21 @@ install()
run "make install"
}

dist()
{
local formats="xztar,gztar,zip"
local f

echo "=== dist ($formats) ==="
run "meson dist -C $BUILD_DIR --formats $formats"

for f in $formats; do
f=$BUILD_DIR/meson-dist/iputils-20240117.$f
ls -lah $f
file $f | grep -E '(compressed|archive) data'
done
}

run_tests()
{
local ret
Expand Down Expand Up @@ -111,7 +127,7 @@ cd `dirname $0`

cmd=
case "$1" in
dependencies|info|configure|build|build-log|install|install-log|test|test-log|"") cmd="$1";;
build|build-log|configure|dependencies|dist|info|install|install-log|test|test-log|"") cmd="$1";;
*) echo "ERROR: wrong command '$1'" >&2; exit 1;;
esac

Expand Down Expand Up @@ -139,6 +155,10 @@ if [ -z "$cmd" -o "$cmd" = "install" ]; then
install
fi

if [ -z "$cmd" -o "$cmd" = "dist" ]; then
dist
fi

if [ "$cmd" = "install-log" ]; then
print_log install-log.txt
fi
Expand Down

0 comments on commit 354312b

Please sign in to comment.