diff options
author | Ryo Nakamura <upa@haeena.net> | 2022-11-06 16:00:18 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2022-11-06 16:03:47 +0900 |
commit | df404ec3c6e8e4d218b9742110b52d32bde34a41 (patch) | |
tree | 020fe6f120c51e0b3e1ed1b3dbeeb0580ce10606 /scripts | |
parent | 15dbb564c8a68a159b997f113751bbbc038b44d0 (diff) |
cleanup docker files and build/test procedure
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install-build-deps.sh | 18 | ||||
-rwxr-xr-x | scripts/test-in-container.sh | 35 |
2 files changed, 53 insertions, 0 deletions
diff --git a/scripts/install-build-deps.sh b/scripts/install-build-deps.sh new file mode 100755 index 0000000..df2552d --- /dev/null +++ b/scripts/install-build-deps.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e +# +# Install build dpenedencies. + +source /etc/os-release +set -x + +case $ID in + ubuntu*) + apt-get install -y gcc make cmake libssh-dev + ;; + centos* | rhel*) + dnf install -y gcc make cmake libssh-devel rpm-build + ;; + *) + echo "unsupported dependency install: $ID" + exit 1 +esac diff --git a/scripts/test-in-container.sh b/scripts/test-in-container.sh new file mode 100755 index 0000000..ee389fe --- /dev/null +++ b/scripts/test-in-container.sh @@ -0,0 +1,35 @@ +#!/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. + +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*) + 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 +fi + +# Run test +python3 -m pytest ../test -v |