Add docker-compose.yml to be used for compile tests

Ideally this will be expanded in order to simplify compilation tests of
DAHDI on supported distributions.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2020-02-23 19:39:26 -06:00
parent 26fb7c34cb
commit 90e8a54e3a
8 changed files with 155 additions and 0 deletions

2
.gitignore vendored
View File

@ -3,6 +3,7 @@
/.pc
.cache.mk
*.[oa]
*.mod
*.mod.[oc]
@ -16,6 +17,7 @@ cscope.*
*.symvers
*.markers
.*.o.d
*.ur-safe
README.html
modules.order

57
docker-compose.yml Normal file
View File

@ -0,0 +1,57 @@
version: '3'
services:
test-centos7:
build:
context: ./
dockerfile: test/docker/centos7
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-centos6:
build:
context: ./
dockerfile: test/docker/centos6
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debianstable:
build:
context: ./
dockerfile: test/docker/debianstable
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debiantesting:
build:
context: ./
dockerfile: test/docker/debiantesting
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-fedorarawhide:
build:
context: ./
dockerfile: test/docker/fedorarawhide
volumes:
- ./:/source
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true

10
test/docker/centos6 Normal file
View File

@ -0,0 +1,10 @@
FROM centos:6
RUN yum update -y
RUN yum install -y \
gcc \
git \
make \
wget
RUN yum install -y kernel-devel
CMD ["/source/test/test-build.sh"]

10
test/docker/centos7 Normal file
View File

@ -0,0 +1,10 @@
FROM centos:7
RUN yum update -y
RUN yum install -y \
gcc \
git \
make \
wget
RUN yum install -y kernel-devel.x86_64 0:3.10.0-1062.12.1
CMD ["/source/test/test-build.sh"]

12
test/docker/debianstable Normal file
View File

@ -0,0 +1,12 @@
FROM debian:stable
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
gcc \
git \
linux-headers-amd64 \
make \
wget
CMD ["/source/test/test-build.sh"]

12
test/docker/debiantesting Normal file
View File

@ -0,0 +1,12 @@
FROM debian:testing
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
gcc \
git \
linux-headers-amd64 \
make \
wget
CMD ["/source/test/test-build.sh"]

11
test/docker/fedorarawhide Normal file
View File

@ -0,0 +1,11 @@
FROM fedora:rawhide
RUN dnf update -y && dnf install -y \
diffutils \
gcc \
git \
kmod \
make \
wget
RUN dnf update -y && dnf install -y kernel-devel
CMD ["/source/test/test-build.sh"]

41
test/test-build.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
set -e
if [ "$1" != "" ]; then
JOBS=$1
fi
if command -v apt >/dev/null; then
if [ ! -e /root/last-update ]; then
date > /root/last-update
fi
if [ -z "$(find /root/last-update -mmin -60)" ]; then
apt-get update && apt-get install -y linux-headers-amd64
date > /root/last-update
fi
KERNELS=$(find /usr/src -maxdepth 1 -type d -name 'linux-headers-*' -not -name '*common*')
else
if command -v dnf > /dev/null ; then
dnf update kernel-devel
else
yum update kernel-devel
fi
KERNELS=$(find /usr/src/kernels -maxdepth 1 -type d -regextype sed -regex '.*[.]\(el\|fc\).*')
fi
if [ "$KERNELS" = "" ]; then
echo >&2 "Failed to find any kernels"
exit 1
fi
# Copy the source into the container so we can run builds in parallel
rm -fr /root/code
cp -fr /source /root/code
cd /root/code
for KSRC in $KERNELS ; do
echo "Building against $KSRC"
export KSRC=$KSRC
make -s clean
make -s -j $(grep -c "^processor" /proc/cpuinfo)
done