Make CI build flatter (and therefore faster) (#123)

Now with a fancier script for running h2spec
will ensure that the server executable is killed when h2spec finishes,
de-interleaves h2spec & example server stdout
This commit is contained in:
Eliza Weisman
2017-09-27 16:20:08 -05:00
committed by Carl Lerche
parent a54b89a84f
commit c1fbabf686
2 changed files with 51 additions and 40 deletions

View File

@@ -12,12 +12,15 @@ addons:
packages:
- libssl-dev
rust:
- nightly
- stable
matrix:
include:
- rust: nightly
before_deploy: cargo doc --no-deps
- rust: stable
install:
- bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
- if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then cargo install --force rustfmt-nightly; fi
before_script:
- cargo clean
@@ -34,50 +37,30 @@ script:
# Run tests, uploading results to codecov..
# hpack tests are _super_ slow in coverage, so skip them here.
- cargo tarpaulin --features unstable --out Xml -- --skip hpack
- cargo tarpaulin --features unstable --skip-clean --no-count --out Xml -- --skip hpack
# Test _only_ hpack.
- cargo test --lib -- hpack
# Run rustfmt on nightly
- if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then cargo fmt -- --write-mode=diff; fi
# Run h2spec on stable
- if [ "${TRAVIS_RUST_VERSION}" = "stable" ]; then ./ci/h2spec.sh; fi
after_success:
- bash <(curl -Ls https://codecov.io/bash)
jobs:
# allow_failures:
# - rust: nightly
include:
- stage: h2spec
rust: nightly
install: |
wget https://github.com/summerwind/h2spec/releases/download/v2.1.0/h2spec_linux_amd64.tar.gz &&
tar xf h2spec_linux_amd64.tar.gz
script:
- cargo build --example server
- |
exec 3< <(./target/debug/examples/server);
sed '/listening on Ok(V4(127.0.0.1:5928))/q' <&3 ; cat <&3 &
./h2spec -p 5928
- stage: docs
script: cargo doc --no-deps
install: skip
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN
target_branch: gh-pages
local_dir: target/doc
on:
branch: master
repo: carllerche/h2
rust: nightly
after_success: skip
- stage: fmt
rust: nightly
install: cargo install --force rustfmt-nightly
script: cargo fmt -- --write-mode=diff
after_success: skip
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN
target_branch: gh-pages
local_dir: target/doc
on:
branch: master
repo: carllerche/h2
rust: nightly
env:
global:
- secure: LkjG3IYPu7GY7zuMdYyLtdvjR4a6elX6or1Du7LTBz4JSlQXYAaj6DxhfZfm4d1kECIlnJJ2T21BqDoJDnld5lLu6VcXQ2ZEo/2f2k77GQ/9w3erwcDtqxK02rPoslFNzSd2SCdafjGKdbcvGW2HVBEu5gYEfOdu1Cdy6Av3+vLPk5To50khBQY90Kk+cmSd7J0+CHw/wSXnVgIVoO4742+aj5pxZQLx3lsi3ZPzIh1VL4QOUlaI98ybrCVNxADQCeXRRDzj0d8NzeKlkm8eXpgpiMVRJWURMa3rU2sHU9wh+YjMyoqGZWv2LlzG5LBqde3RWPQ99ebxVhlly6RgEom8yvZbavcGJ4BA0OjviLYAMb1Wjlu1paLZikEqlvTojhpzz3PVuIBZHl+rUgnUfkuhfmMzTBJTPHPMP0GtqpIAGpyRwbv56DquuEiubl70FZmz52sXGDseoABv9jQ4SNJrDrA+bfIWkPpWwqnKaWIgGPl0n3GKeceQM3RshpaE59awYUDS4ybjtacb2Fr99fx25mTO2W4x5hcDqAvBohxRPXgRB2y0ZmrcJyCV3rfkiGFUK7H8ZBqNQ6GG/GYilgj40q6TgcnXxUxyKkykDiS9VU0QAjAwz0pkCNipJ+ImS1j0LHEOcKMKZ7OsGOuSqBmF24ewBs+XzXY7dTnM/Xc=

28
ci/h2spec.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
LOGFILE="h2server.log"
if ! [ -e "h2spec" ] ; then
# if we don't already have a h2spec executable, wget it from github
wget https://github.com/summerwind/h2spec/releases/download/v2.1.0/h2spec_linux_amd64.tar.gz
tar xf h2spec_linux_amd64.tar.gz
fi
cargo build --example server
exec 3< <(./target/debug/examples/server);
SERVER_PID=$!
# wait 'til the server is listening before running h2spec, and pipe server's
# stdout to a log file.
sed '/listening on Ok(V4(127.0.0.1:5928))/q' <&3 ; cat <&3 > "${LOGFILE}" &
# run h2spec against the server, printing the server log if h2spec failed
./h2spec -p 5928
H2SPEC_STATUS=$?
if [ "${H2SPEC_STATUS}" -eq 0 ]; then
echo "h2spec passed!"
else
echo "h2spec failed! server logs:"
cat "${LOGFILE}"
fi
kill "${SERVER_PID}"
exit "${H2SPEC_STATUS}"