diff --git a/docker/launch.sh b/docker/launch.sh new file mode 100755 index 0000000000..7cc29ae36c --- /dev/null +++ b/docker/launch.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -e + +# Build both sets by default +if [[ -z "$BUILDS" ]]; then + BUILDS="stable unstable" +fi + +# Build specified distributions +if [[ -z $DISTROS ]]; then + DISTROS="ubuntu14.04" +fi + +for build in $BUILDS; do + # cd so $distro is only the distro name + cd $build + for distro in $DISTROS; do + echo "Building $build/$distro" + # copy the common script because it lives outside the docker build context + if [[ "$build" = "unstable" ]]; then + cp bootstrap.ps1 $distro + fi + # build and tag the image so they can be derived from + docker build -t powershell/powershell:$build-$distro $distro + done + cd .. +done diff --git a/docker/test.sh b/docker/test.sh new file mode 100644 index 0000000000..fb5d2163c8 --- /dev/null +++ b/docker/test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +# Build specified distributions +if [[ -z $DISTROS ]]; then + DISTROS="ubuntu14.04 ubuntu16.04 centos7" +fi + +build=unstable +command="cd PowerShell; Import-Module ./build.psm1; Start-PSPester" + +cd $build +for distro in $DISTROS; do + echo "Testing $build/$distro" + # Run Pester tests inside container + docker run -it powershell/powershell:$build-$distro powershell -c "$command" +done +cd .. diff --git a/docker/unstable/.gitignore b/docker/unstable/.gitignore new file mode 100644 index 0000000000..c1ce1f3f4f --- /dev/null +++ b/docker/unstable/.gitignore @@ -0,0 +1 @@ +*/bootstrap.ps1 diff --git a/docker/unstable/bootstrap.ps1 b/docker/unstable/bootstrap.ps1 new file mode 100644 index 0000000000..eda0de163b --- /dev/null +++ b/docker/unstable/bootstrap.ps1 @@ -0,0 +1,8 @@ +# This is intended to be used inside Docker containers + +git clone --recursive https://github.com/PowerShell/PowerShell.git +Set-Location PowerShell +Import-Module ./build.psm1 +Start-PSBootstrap -Package -NoSudo +Start-PSBuild -Crossgen +Start-PSPackage