Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests building with emscripten target #2408

Open
wants to merge 3 commits into
base: pre-ll
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions scripts/travis-emscripten-docker-setup.sh
Original file line number Diff line number Diff line change
@@ -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