Skip to content
Permalink
Browse files

Improves local docker testing.

  • Loading branch information...
kzaher committed Apr 28, 2019
1 parent f2388eb commit cddb7da2bc2166abb0852c9a72a32424ff3fde85
Showing with 24 additions and 16 deletions.
  1. +1 −1 Package.swift
  2. +5 −0 scripts/Dockerfile
  3. +15 −7 scripts/all-tests.sh
  4. +3 −8 scripts/test-linux.sh
@@ -2,7 +2,7 @@
import PackageDescription

let buildTests = true
let buildTests = false

extension Product {
static func allTests() -> [Product] {
@@ -0,0 +1,5 @@
FROM ubuntu:18.04
# docker build -t swift:rxswift-linux-5.0.1 scripts
ENV swift=5.0.1
ENV PATH=${PATH}:/tmp/swift-${swift}-RELEASE-ubuntu18.04/usr/bin
RUN /bin/bash -c "set -e; echo \"Installing swift ${swift}\"; apt-get update && apt-get install -y curl clang libicu-dev libbsd-dev git && curl -v \"https://swift.org/builds/swift-${swift}-release/ubuntu1804/swift-${swift}-RELEASE/swift-${swift}-RELEASE-ubuntu18.04.tar.gz\" > /tmp/swift.tar.gz; tar -xzf /tmp/swift.tar.gz -C /tmp; swift -version;"
@@ -170,9 +170,7 @@ fi

if [ "${VALIDATE_UNIX}" -eq 1 ]; then
if [[ "${UNIX_NAME}" == "${DARWIN}" ]]; then
if [[ "${RX_RUN_LINUX_TESTS}" -eq 1 ]]; then
./scripts/test-linux.sh
fi
./scripts/test-linux.sh

# compile and run playgrounds
. scripts/validate-playgrounds.sh
@@ -192,10 +190,20 @@ if [ "${VALIDATE_UNIX}" -eq 1 ]; then
rx "AllTests-macOS" ${configuration} "" test
done
elif [[ "${UNIX_NAME}" == "${LINUX}" ]]; then
cat Package.swift | sed "s/let buildTests = false/let buildTests = true/" > Package.tests.swift
mv Package.tests.swift Package.swift
swift build -c debug --disable-sandbox # until compiler is fixed
./.build/debug/AllTestz
CONFIGURATIONS=(debug release)
for configuration in ${CONFIGURATIONS[@]}
do
echo "Linux Configuration ${configuration}"
git checkout Package.swift
if [[ $configuration == "debug" ]]; then
cat Package.swift | sed "s/let buildTests = false/let buildTests = true/" > Package.tests.swift
mv Package.tests.swift Package.swift
fi
swift build -c ${configuration}
if [[ $configuration == "debug" ]]; then
./.build/debug/AllTestz
fi
done
else
unsupported_os
fi
@@ -12,20 +12,15 @@ if [[ `uname` == "Darwin" ]]; then
trap cleanup EXIT
echo "Running linux"
eval $(docker-machine env default)
docker run --rm -it -v `pwd`:/RxSwift swift:5.0 bash -c "cd /RxSwift; scripts/test-linux.sh"
docker run --rm -it -v `pwd`:/RxSwift swift:rxswift-linux-5.0.1 bash -c "cd /RxSwift; scripts/test-linux.sh" || (echo "You maybe need to create a docker image: 'docker build -t swift:rxswift-linux-5.0.1 scripts' to create docker container" && exit -1)
elif [[ `uname` == "Linux" ]]; then
CONFIGURATIONS=(debug release)

rm -rf .build || true

./scripts/all-tests.sh Unix

git checkout Package.swift
echo "Using `swift -version`"

for configuration in ${CONFIGURATIONS[@]}
do
swift build -c ${configuration}
done
./scripts/all-tests.sh Unix
else
echo "Unknown os (`uname`)"
exit -1

0 comments on commit cddb7da

Please sign in to comment.
You can’t perform that action at this time.