Merge pull request #84 from jcfr/reenable-parallel-build

Reenable parallel build
This commit is contained in:
Matt McCormick 2016-11-26 11:29:40 -05:00 committed by GitHub
commit b4e2a02e0c
2 changed files with 111 additions and 42 deletions

97
.circleci-matrix.yml Normal file
View File

@ -0,0 +1,97 @@
env:
- IMAGE=android-arm
- IMAGE=browser-asmjs
- IMAGE=linux-arm64
- IMAGE=linux-armv5
- IMAGE=linux-armv6
- IMAGE=linux-armv7
- IMAGE=linux-ppc64le
- IMAGE=linux-x64
- IMAGE=linux-x86
- IMAGE=manylinux-x64
- IMAGE=manylinux-x86
- IMAGE=windows-x64
- IMAGE=windows-x86
command:
- |
if [[ $STEP == "dependencies" ]]; then
if [[ $CIRCLE_NODE_INDEX == 0 ]]; then
if [[ ! -f ~/BASE_AVAILABLE ]]; then
if [[ -e ~/docker/base.tar ]]; then
echo "Loading base.tar from ~/docker cache"
time docker load -i ~/docker/base.tar
echo "Loading base.tar from ~/docker cache - done"
fi
echo "Pulling dockcross/base"
time docker pull dockcross/base
echo "Pulling dockcross/base - done"
time make base.test
echo "Saving debian:jessie dockcross/base into ~/docker cache"
mkdir -p ~/docker; time docker save -o ~/docker/base.tar debian:jessie dockcross/base
echo "Saving debian:jessie dockcross/base into ~/docker cache - done"
touch ~/BASE_AVAILABLE
else
echo "Base image already available"
fi
else
if [[ ! -f ~/BASE_DOWNLOADED ]]; then
echo "Waiting for node0"
while true; do
sleep 5
ssh -q node0 [[ -f ~/BASE_AVAILABLE ]]
exit_code=$?
if [[ $exit_code -eq 0 ]]; then break; elif [[ $exit_code -eq 1 ]]; then echo -n "."; else exit $exit_code;fi
done
echo "Waiting for node0 - done"
echo "Copying base image from node0"
mkdir -p ~/docker; time scp node0:~/docker/base.tar ~/docker/base.tar
echo "Copying base image from node0 - done"
touch ~/BASE_DOWNLOADED
else
echo "Base image already downloaded"
fi
fi
fi
if [[ $STEP == "test" ]]; then
if [[ -e ~/docker/$IMAGE.tar ]]; then
echo "Loading $IMAGE.tar from ~/docker cache"
time docker load -i ~/docker/$IMAGE.tar
echo "Loading $IMAGE.tar from ~/docker cache - done"
fi
echo "Pulling dockcross/$IMAGE"
time docker pull dockcross/$IMAGE
echo "Pulling dockcross/$IMAGE - done"
echo "Loading base.tar from ~/docker cache"
time docker load -i ~/docker/base.tar
echo "Loading base.tar from ~/docker cache - done"
time make $IMAGE.test
echo "Saving dockcross/$IMAGE into ~/docker cache"
mkdir -p ~/docker; time docker save dockcross/$IMAGE > ~/docker/$IMAGE.tar
echo "Saving dockcross/$IMAGE into ~/docker cache - done"
fi
- |
if [[ $STEP == "deployment" ]]; then
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
if [[ $CIRCLE_NODE_INDEX == 0 ]] && [[ ! -f ~/BASE_PUSHED ]]; then
echo "Pushing dockcross/base"
time docker push dockcross/base
echo "Pulling dockcross/base - done"
touch ~/BASE_PUSHED
fi
echo "Pushing dockcross/$IMAGE"
time docker push dockcross/$IMAGE
echo "Pushing dockcross/$IMAGE - done"
fi

View File

@ -12,54 +12,26 @@ dependencies:
override:
- docker info
- if [[ -e ~/docker/base.tar ]]; then docker load -i ~/docker/base.tar; fi
- docker pull dockcross/base
- |
for image in $(make display_images); do
if [[ -e ~/docker/$image.tar ]]; then
echo "Loading $image.tar"
docker load -i ~/docker/$image.tar;
fi
docker pull dockcross/$image
done
- curl -fsSL https://git.io/v2Ifs -o ~/bin/circleci-matrix
- chmod +x ~/bin/circleci-matrix
test:
override:
- make base.test
- mkdir -p ~/docker; docker save dockcross/base > ~/docker/base.tar
- make android-arm.test
- mkdir -p ~/docker; docker save dockcross/android-arm > ~/docker/android-arm.tar
- make browser-asmjs.test
- mkdir -p ~/docker; docker save dockcross/browser-asmjs > ~/docker/browser-asmjs.tar
- make linux-arm64.test
- mkdir -p ~/docker; docker save dockcross/linux-arm64 > ~/docker/linux-arm64.tar
- make linux-armv5.test
- mkdir -p ~/docker; docker save dockcross/linux-armv5 > ~/docker/linux-armv5.tar
- make linux-armv6.test
- mkdir -p ~/docker; docker save dockcross/linux-armv6 > ~/docker/linux-armv6.tar
- make linux-armv7.test
- mkdir -p ~/docker; docker save dockcross/linux-armv7 > ~/docker/linux-armv7.tar
- make linux-ppc64le.test
- mkdir -p ~/docker; docker save dockcross/linux-ppc64le > ~/docker/linux-ppc64le.tar
- make linux-x64.test
- mkdir -p ~/docker; docker save dockcross/linux-x64 > ~/docker/linux-x64.tar
- make linux-x86.test
- mkdir -p ~/docker; docker save dockcross/linux-x86 > ~/docker/linux-x86.tar
- make manylinux-x64.test
- mkdir -p ~/docker; docker save dockcross/manylinux-x64 > ~/docker/manylinux-x64.tar
- make manylinux-x86.test
- mkdir -p ~/docker; docker save dockcross/manylinux-x86 > ~/docker/manylinux-x86.tar
- make windows-x64.test:
- circleci-matrix:
parallel: true
environment:
STEP: dependencies
- circleci-matrix:
parallel: true
timeout: 3000
- mkdir -p ~/docker; docker save dockcross/windows-x64 > ~/docker/windows-x64.tar
- make windows-x86.test:
timeout: 3000
- mkdir -p ~/docker; docker save dockcross/windows-x86 > ~/docker/windows-x86.tar
environment:
STEP: test
deployment:
hub:
branch: master
commands:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker push dockcross/base
- for image in $(make display_images); do docker push dockcross/$image; done
- circleci-matrix:
parallel: true
environment:
STEP: deployment