btrfs-progs: ci: add 32bit build test on alpine/musl

Add new CI image target based on 32bit Alpine with musl. It's a copy of
musl and requires docker's buildx extension to properly select the
platform.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-05-23 18:34:12 +02:00
parent 1868bc796b
commit ec841d1451
5 changed files with 87 additions and 0 deletions

34
ci/ci-build-musl-i386 Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# Usage: $0 [branch] [configure options]
# Create source tarball from HEAD or given branch and build it in musl CI
# environment. Configure options follow branch name that can be empty.
HERE=`pwd`
if [ -f "configure.ac" ]; then
SOURCEDIR=`pwd`
elif [ -f "../configure.ac" ]; then
cd ..
SOURCEDIR=`pwd`
else
echo "ERROR: cannot determine source directory from `pwd`"
exit 1
fi
CIIMAGEDIR=ci/images/ci-musl-i386
BRANCH=${1:-HEAD}
if [ "$#" -ge 1 ]; then
shift
fi
HASH=$(git log -1 --format='%h %s' "$BRANCH")
echo "CI: Generate archive from $BRANCH ($HASH)"
git archive --prefix=btrfs-progs-devel/ -o devel.tar "$BRANCH"
echo "$BRANCH $HASH" > GITCOMMIT
tar uvf devel.tar GITCOMMIT
#rm GITCOMMIT
gzip --force --best devel.tar
cd "$CIIMAGEDIR"
cp "$SOURCEDIR/devel.tar.gz" .
./docker-build
./docker-run -- ./test-build devel --disable-documentation --disable-backtrace --disable-libudev "$@"

View File

@ -0,0 +1,19 @@
FROM alpine:edge
WORKDIR /tmp
RUN apk update
RUN apk add linux-headers musl-dev util-linux-dev bash
RUN apk add attr-dev acl-dev e2fsprogs-dev zlib-dev lzo-dev zstd-dev
RUN apk add autoconf automake make gcc tar gzip clang
RUN apk add python3 py3-setuptools python3-dev
RUN apk add libgcrypt-dev libsodium-dev libkcapi-dev
# For downloading fresh sources
RUN apk add wget
# Only build tests
COPY ./test-build .
COPY ./devel.tar.gz .
CMD ./test-build devel --disable-documentation --disable-backtrace --disable-libudev

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Run from the directory with Dockerfile, directory name should match the image
# name
prefix=kdave
image=$(basename `pwd` | tr '[A-Z]' '[a-z]')
# Make sure the file exists as it's required but can be empty. In that case
# it's downloaded when ./test-build is executed
touch devel.tar.gz
docker buildx build --platform linux/386 -t "$prefix/$image" .

View File

@ -0,0 +1 @@
../docker-run

View File

@ -0,0 +1,22 @@
#!/bin/sh
# usage: $0 [branch name] [configure parameters]
urlbase="https://github.com/kdave/btrfs-progs/archive"
branch=${1:-devel}
fname="${branch}.tar.gz"
url="${urlbase}/${fname}"
shift
echo "btrfs-progs build test of branch ${branch}"
cd /tmp
if [ -f "$fname" -a -s "$fname" ]; then
echo "Found local file $fname, not downloading"
else
echo "Missing or empty tar, downloading devel branch from git"
rm -- "$fname"
wget "$url" -O "$fname"
fi
tar xf "$fname"
cd "btrfs-progs-$branch"
ci/build-default "$@"