From f87a54586e8bd6ba67d5d1c8fee30f776f4915b1 Mon Sep 17 00:00:00 2001 From: Stephen Sherratt Date: Mon, 17 Sep 2018 19:56:39 +0100 Subject: [PATCH 1/2] Add tests building with emscripten target --- .travis.yml | 8 ++++++++ scripts/travis-emscripten-docker-setup.sh | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100755 scripts/travis-emscripten-docker-setup.sh diff --git a/.travis.yml b/.travis.yml index e071b1b65bf..0534b8e11ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,12 @@ before_install: - 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: @@ -68,3 +74,5 @@ script: - cargo test -p gfx_window_glutin $HEADLESS_FEATURE - 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 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 From 15d6f4456269c1ec13555703c08c9931cb0ac60f Mon Sep 17 00:00:00 2001 From: Stephen Sherratt Date: Thu, 27 Jun 2019 21:49:42 +0100 Subject: [PATCH 2/2] Comment out xvfb from travis config as it was failing on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 56a332c95a7..7269bc90f5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ 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