diff options
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | docker/centos-8.Dockerfile | 3 | ||||
-rw-r--r-- | docker/rocky-8.6.Dockerfile | 3 | ||||
-rw-r--r-- | docker/ubuntu-20.04.Dockerfile | 3 | ||||
-rw-r--r-- | docker/ubuntu-22.04.Dockerfile | 3 | ||||
-rwxr-xr-x | scripts/test-in-container.sh | 22 |
6 files changed, 22 insertions, 39 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 27f3cbb..88d5109 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,26 +107,15 @@ include(CPack) # Custom targets to build and test mscp in docker containers. # foreach(IN ZIP_LISTS) (cmake >= 3.17) can shorten the following lists. # However, ubuntu 20.04 has cmake 3.16.3. -list(APPEND DIST_NAMES ubuntu) -list(APPEND DIST_VERS 20.04) -list(APPEND DIST_PKGS deb) - -list(APPEND DIST_NAMES ubuntu) -list(APPEND DIST_VERS 22.04) -list(APPEND DIST_PKGS deb) - -list(APPEND DIST_NAMES centos) -list(APPEND DIST_VERS 8) -list(APPEND DIST_PKGS rpm) - -list(APPEND DIST_NAMES rocky) -list(APPEND DIST_VERS 8.6) -list(APPEND DIST_PKGS rpm) +list(APPEND DIST_NAMES ubuntu ubuntu centos rocky) +list(APPEND DIST_VERS 20.04 22.04 8 8.6) +list(APPEND DIST_PKGS deb deb rpm rpm) foreach(x RANGE 3) list(GET DIST_NAMES ${x} DIST_NAME) list(GET DIST_VERS ${x} DIST_VER) list(GET DIST_PKGS ${x} DIST_PKG) + set(DOCKER_IMAGE mscp-${DIST_NAME}:${DIST_VER}) set(DOCKER_INDEX ${DIST_NAME}-${DIST_VER}) set(PKG_FILE_NAME @@ -150,4 +139,12 @@ foreach(x RANGE 3) COMMAND docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${DOCKER_IMAGE} cp /mscp/build/${PKG_FILE_NAME} /out/) + + list(APPEND DOCKER_BUILDS docker-build-${DOCKER_INDEX}) + list(APPEND DOCKER_TESTS docker-test-${DOCKER_INDEX}) + list(APPEND DOCKER_PKGS docker-pkg-${DOCKER_INDEX}) endforeach() + +add_custom_target(docker-build-all DEPENDS ${DOCKER_BUILDS}) +add_custom_target(docker-test-all DEPENDS ${DOCKER_TESTS}) +add_custom_target(docker-pkg-all DEPENDS ${DOCKER_PKGS}) diff --git a/docker/centos-8.Dockerfile b/docker/centos-8.Dockerfile index a5e1ebe..586b1e9 100644 --- a/docker/centos-8.Dockerfile +++ b/docker/centos-8.Dockerfile @@ -31,5 +31,6 @@ RUN cd ${mscpdir} \ && cmake -B build \ && cd ${mscpdir}/build \ && make \ - && cpack -G RPM CPackConfig.cmake + && cpack -G RPM CPackConfig.cmake \ + && rpm -iv *.rpm diff --git a/docker/rocky-8.6.Dockerfile b/docker/rocky-8.6.Dockerfile index 90b804c..323129c 100644 --- a/docker/rocky-8.6.Dockerfile +++ b/docker/rocky-8.6.Dockerfile @@ -26,5 +26,6 @@ RUN cd ${mscpdir} \ && cmake -B build \ && cd ${mscpdir}/build \ && make \ - && cpack -G RPM CPackConfig.cmake + && cpack -G RPM CPackConfig.cmake \ + && rpm -iv *.rpm diff --git a/docker/ubuntu-20.04.Dockerfile b/docker/ubuntu-20.04.Dockerfile index bc5fd86..0ca4148 100644 --- a/docker/ubuntu-20.04.Dockerfile +++ b/docker/ubuntu-20.04.Dockerfile @@ -31,4 +31,5 @@ RUN cd ${mscpdir} \ && cmake -B build \ && cd ${mscpdir}/build \ && make \ - && cpack -G DEB CPackConfig.cmake + && cpack -G DEB CPackConfig.cmake \ + && dpkg -i *.deb diff --git a/docker/ubuntu-22.04.Dockerfile b/docker/ubuntu-22.04.Dockerfile index 73f4307..c00f695 100644 --- a/docker/ubuntu-22.04.Dockerfile +++ b/docker/ubuntu-22.04.Dockerfile @@ -31,4 +31,5 @@ RUN cd ${mscpdir} \ && cmake -B build \ && cd ${mscpdir}/build \ && make \ - && cpack -G DEB CPackConfig.cmake + && cpack -G DEB CPackConfig.cmake \ + && dpkg -i *.deb diff --git a/scripts/test-in-container.sh b/scripts/test-in-container.sh index 01d483c..49891c7 100755 --- a/scripts/test-in-container.sh +++ b/scripts/test-in-container.sh @@ -1,31 +1,13 @@ #!/bin/bash -e # -# Run this script in docker containers. This script installs mscp from built package -# and run test for mscp in the installed path. +# Run this script in mscp docker containers. +# This script runs end-to-end test with installed mscp. -source /etc/os-release script_dir=$(cd $(dirname ${0}) && pwd) cd $script_dir -project_version=$(cat ../VERSION) -arch=$(uname -p) set -x -# install package -case $ID in - ubuntu*) - pkg=mscp_${project_version}-${ID}-${VERSION_ID}-${arch}.deb - dpkg -i ../build/$pkg - ;; - centos* | rhel* | rocky*) - pkg=mscp_${project_version}-${ID}-${VERSION_ID}-${arch}.rpm - rpm -iv ../build/$pkg - ;; - *) - echo "unsupported test platform: $ID" - exit 1 -esac - # Run sshd if [ ! -e /var/run/sshd.pid ]; then /usr/sbin/sshd |