diff --git a/.gitignore b/.gitignore index e63a49c..0bf1ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target Cargo.lock *.bk .vscode +.vagga diff --git a/.travis.yml b/.travis.yml index d8e9b98..bd28f52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,40 +1,32 @@ language: rust -cache: cargo - -sudo: required - +# We need this for the matrix, install is quick although unused rust: - stable - beta - nightly -os: - - linux +sudo: required dist: trusty +# We cannot cache .vagga, because we actually do not have read permissions +# without sudo and travis cache script runs not as sudo... +cache: + directories: + - .vagga/stable-home + - .vagga/beta-home + - .vagga/nightly-home + - .vagga/.cache + addons: apt: packages: - - libssl-dev - - libudev-dev - - libgbm-dev - - libxkbcommon-dev - - libegl1-mesa-dev - -before_install: - - sudo add-apt-repository -y ppa:wayland.admin/daily-builds - - sudo apt-get update -qq || echo "Ignoring failed apt-get update..." - - sudo apt-get install -y libwayland-dev libinput-dev - -branches: - only: - - master + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - global: - - RUST_BACKTRACE=1 matrix: - FEATURES="" # test individual features @@ -58,38 +50,36 @@ matrix: - rust: nightly before_script: - - export PATH=$HOME/.local/bin:$HOME/.cargo/bin:$PATH + - 'echo ubuntu-mirror: http://mirrors.us.kernel.org/ubuntu/ > ~/.vagga.yaml' + - 'echo alpine-mirror: http://mirrors.gigenet.com/alpinelinux/ >> ~/.vagga.yaml' - | - if [ "$FEATURES" = "cargo-fmt" ]; then - cargo install rustfmt-nightly --force; - fi - - | - if [ "$FEATURES" = "cargo-clippy" ]; then - cargo install clippy --force; - fi - - mkdir $(pwd)/socket - - export XDG_RUNTIME_DIR="$(pwd)/socket" + echo "$(id -un):100000:65536" | sudo tee /etc/subuid | sudo tee /etc/subgid + sudo apt-get install uidmap -y + curl http://files.zerogw.com/vagga/vagga-install.sh | sh + - vagga update-$TRAVIS_RUST_VERSION script: - | case $FEATURES in "all") - cargo test --all-features && - cargo doc --no-deps --all-features + vagga cargo-$TRAVIS_RUST_VERSION test --all-features && + vagga cargo-$TRAVIS_RUST_VERSION doc --no-deps --all-features ;; "default") - cargo test && - cargo doc --no-deps + vagga cargo-$TRAVIS_RUST_VERSION test && + vagga cargo-$TRAVIS_RUST_VERSION doc --no-deps ;; "cargo-fmt") - cargo fmt -- --write-mode=diff + vagga cargo-$TRAVIS_RUST_VERSION install -f rustfmt-nightly && + vagga cargo-$TRAVIS_RUST_VERSION fmt -- --write-mode=diff ;; "cargo-clippy") - cargo clippy --all-features -- -D warnings + vagga cargo-$TRAVIS_RUST_VERSION install -f clippy && + vagga cargo-$TRAVIS_RUST_VERSION clippy --all-features -- -D warnings ;; *) - cargo test --lib --doc --tests --no-default-features --features "$FEATURES" && - cargo doc --no-deps --no-default-features --features "$FEATURES" + vagga cargo-$TRAVIS_RUST_VERSION test --lib --doc --tests --no-default-features --features "$FEATURES" && + vagga cargo-$TRAVIS_RUST_VERSION doc --no-deps --no-default-features --features "$FEATURES" esac after_success: @@ -106,9 +96,9 @@ deploy: condition: "$FEATURES = all" notifications: - webhooks: - urls: - - "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGxldmFucyUzQXNhZmFyYWRlZy5uZXQvJTIxRkt4aGprSUNwakJWelZlQ2RGJTNBc2FmYXJhZGVnLm5ldA" - on_success: change - on_failure: always - on_start: never + webhooks: + urls: + - "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGxldmFucyUzQXNhZmFyYWRlZy5uZXQvJTIxRkt4aGprSUNwakJWelZlQ2RGJTNBc2FmYXJhZGVnLm5ldA" + on_success: change + on_failure: always + on_start: never diff --git a/vagga.yaml b/vagga.yaml new file mode 100644 index 0000000..48e4845 --- /dev/null +++ b/vagga.yaml @@ -0,0 +1,77 @@ +minimum-vagga: v0.5.0 + +containers: + base: + auto-clean: true + setup: + - !UbuntuRelease { codename: artful } + - !UbuntuUniverse + - !Install [build-essential, wget, curl, pkg-config, file, openssl, sudo, ca-certificates, libssl-dev, cmake, libudev-dev, libgbm-dev, libxkbcommon-dev, libegl1-mesa-dev, libwayland-dev, libinput-dev] + + stable: + auto-clean: true + environ: + HOME: /work/.vagga/stable-home + PATH: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/work/.vagga/stable-home/.cargo/bin:/work/.vagga/stable-home/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/ + RUST_BACKTRACE: 1 + XDG_RUNTIME_DIR: /work/.vagga/stable-home + setup: + - !Container base + - !Env HOME: /work/.vagga/stable-home + - !Sh curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain stable --no-modify-path + + beta: + auto-clean: true + environ: + HOME: /work/.vagga/beta-home + PATH: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/work/.vagga/beta-home/.cargo/bin:/work/.vagga/beta-home/.rustup/toolchains/beta-x86_64-unknown-linux-gnu/bin/ + RUST_BACKTRACE: 1 + XDG_RUNTIME_DIR: /work/.vagga/beta-home + setup: + - !Container base + - !Env HOME: /work/.vagga/beta-home + - !Sh curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain beta --no-modify-path + + nightly: + auto-clean: true + environ: + HOME: /work/.vagga/nightly-home + PATH: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/work/.vagga/nightly-home/.cargo/bin:/work/.vagga/nightly-home/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/ + RUST_BACKTRACE: 1 + XDG_RUNTIME_DIR: /work/.vagga/nightly-home + setup: + - !Container base + - !Env HOME: /work/.vagga/nightly-home + - !Sh curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain nightly --no-modify-path + +commands: + update-stable: !Command + description: Update container + container: stable + run: rustup update + + update-beta: !Command + description: Update container + container: beta + run: rustup update + + update-nightly: !Command + description: Update container + container: nightly + run: | + rustup update + + cargo-stable: !Command + description: Run cargo + container: stable + run: ["/work/.vagga/stable-home/.cargo/bin/cargo"] + + cargo-beta: !Command + description: Run cargo + container: beta + run: ["/work/.vagga/beta-home/.cargo/bin/cargo"] + + cargo-nightly: !Command + description: Run cargo + container: nightly + run: ["/work/.vagga/nightly-home/.cargo/bin/cargo"]