diff --git a/.travis.yml b/.travis.yml index 19fb8993c97..7269bc90f5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,11 +60,17 @@ before_install: # (assuming it will have libsdl2-dev and Rust by then) # see https://docs.travis-ci.com/user/trusty-ci-environment/ - "export DISPLAY=:99.0" - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi + #- if [[ $TRAVIS_OS_NAME == "linux" ]]; then sh -e /etc/init.d/xvfb start; fi - if [[ $TRAVIS_OS_NAME == "linux" ]]; then scripts/travis-install-sdl2.sh ; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew update; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew install sdl2; fi - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew outdated cmake || brew upgrade cmake; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then rustup target add asmjs-unknown-emscripten ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then rustup target add wasm32-unknown-emscripten ; fi + # The binary emsdk packages don't work as they are built to expect GLIBCXX_3.4.21 which isn't + # installed in the build environment. Instead, use a docker image with emsdk installed. + # See https://kripken.github.io/emscripten-site/docs/compiling/Travis.html + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scripts/travis-emscripten-docker-setup.sh ; fi addons: apt: @@ -109,4 +115,6 @@ script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cargo test -p gfx_window_glfw --features "glfw"; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cargo test --all --features vulkan; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cargo test --all --features metal; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker exec -it emscripten cargo test --all --target=asmjs-unknown-emscripten ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker exec -it emscripten cargo test --all --target=wasm32-unknown-emscripten ; fi #- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cargo test --all --features d3d11; fi diff --git a/scripts/travis-emscripten-docker-setup.sh b/scripts/travis-emscripten-docker-setup.sh new file mode 100755 index 00000000000..723e3c29dbe --- /dev/null +++ b/scripts/travis-emscripten-docker-setup.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -ev + +# Start a container with the travis $HOME mounted at /root to get access to the rust installation, +# and the $TRAVIS_BUILD_DIR mounted to /src, (which is the container's initial working directory) +# so we can later run `cargo test ...` without changing directory. +DOCKER_BASE_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +docker run -dit --name emscripten -e PATH=$DOCKER_BASE_PATH:/root/.cargo/bin -v $TRAVIS_BUILD_DIR:/src -v $HOME:/root trzeci/emscripten