Ensure support for more Linux flavours

Add docker-based packaging tests
This commit is contained in:
Lovell Fuller
2015-11-09 08:37:30 +00:00
parent f4cbbd7b79
commit 05cec013fe
11 changed files with 114 additions and 13 deletions

58
packaging/test.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/sh
# Verify docker is available
if ! type docker >/dev/null; then
echo "Please install docker"
exit 1
fi
test="npm run clean && NODE_ENV=development npm install --unsafe-perm && npm test && npm run clean"
# Debian 7
echo -n "Testing wheezy... "
if docker run -i -t --rm -v $PWD:/v nodesource/wheezy:0.12 sh -c "cd /v && ./packaging/test/debian.sh && ./preinstall.sh && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi
# Debian 8
# Ubuntu 12.04, 14.04
for dist in jessie precise trusty; do
echo -n "Testing $dist... "
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 sh -c "cd /v && ./packaging/test/debian.sh && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi
done
# Centos 6
echo -n "Testing centos6... "
if docker run -i -t --rm -v $PWD:/v nodesource/centos6:0.12 sh -c "cd /v && source ./packaging/test/centos6.sh && ./preinstall.sh && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi
# Centos 7
# Fedora 20, 21
for dist in centos7 fedora20 fedora21; do
echo -n "Testing $dist... "
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 sh -c "cd /v && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi
done
# openSUSE 13.2
echo -n "Testing opensuse... "
docker run -i -t --rm -v $PWD:/v opensuse:13.2 sh -c "cd /v && ./packaging/test/opensuse.sh && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi
# Archlinux 2015.06.01
echo -n "Testing archlinux... "
docker run -i -t --rm -v $PWD:/v base/archlinux:2015.06.01 sh -c "cd /v && ./packaging/test/archlinux.sh && $test" >/dev/null;
then echo "OK"
else echo "fail"
fi

5
packaging/test/archlinux.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
# Install Node.js on Archlinux
pacman -Sy --noconfirm gcc make python2 nodejs npm
ln -s /usr/bin/python2 /usr/bin/python

8
packaging/test/centos6.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
# Install C++11 compatible version of g++ on Centos 6
curl -o /etc/yum.repos.d/devtools-1.1.repo http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum install -y devtoolset-1.1
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++

5
packaging/test/debian.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
# Install pkg-config on Debian/Ubuntu
apt-get update
apt-get install -y pkg-config

7
packaging/test/opensuse.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
# Install Node.js on openSUSE 13.2
zypper addrepo http://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_13.2/devel:languages:nodejs.repo
zypper --gpg-auto-import-keys refresh
zypper --non-interactive install gcc-c++ make nodejs-devel
npm install -g npm