Skip to content

Commit

Permalink
Run many parallel CI jobs
Browse files Browse the repository at this point in the history
Our CI is performing multiple different jobs:

* For every libclang version we support:
  * With both debug and release profiles:
    * Generating bindings from our test headers, with and without extra
      assertions, and asserting there is no diff from the expectations.
    * Compiling and testing the generated bindings.
    * Compiling and testing the bindgen-integration crate.
* Testing the md book.
* Asserting that there aren't any system includes in any of the test headers.
* Asserting that all the pub functions have doc comments.

We were previously doing these things sequentially for each libclang
version. This commit breaks these jobs up explicitly and runs each of them one
at a time so that they can each be run in parallel, on different Travis CI
machines.
  • Loading branch information
fitzgen committed Aug 10, 2017
1 parent 08003a4 commit 59b8535
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 45 deletions.
32 changes: 25 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,32 @@ env:
global:
- CARGO_TARGET_DIR=/tmp/bindgen
matrix:
- LLVM_VERSION=3.8.1
- LLVM_VERSION=3.9.0
- LLVM_VERSION=4.0.0
- LLVM_VERSION="3.8.1" BINDGEN_JOB="test" BINDGEN_PROFILE=
- LLVM_VERSION="3.8.1" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="testing_only_extra_assertions"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- LLVM_VERSION="4.0.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- LLVM_VERSION="4.0.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="misc"

matrix:
fast_finish: true
allow_failures:
- env: LLVM_VERSION=4.0.0 BINDGEN_JOB=rustfmt

cache:
directories:
Expand All @@ -32,14 +52,12 @@ cache:
before_install: . ./ci/before_install.sh

script:
# - ./ci/assert-rustfmt.sh
- BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/assert-docs.sh
- BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/test.sh
- ./ci/test-book.sh
- BINDGEN_JOB="$BINDGEN_JOB" BINDGEN_PROFILE="$BINDGEN_PROFILE" BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/script.sh

after_success:
- test "$TRAVIS_PULL_REQUEST" == "false" &&
test "$TRAVIS_BRANCH" == "master" &&
test "$BINDGEN_JOB" == "misc" &&
./ci/deploy-book.sh

notifications:
Expand Down
40 changes: 40 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -xeu
cd "$(dirname "$0")/.."

# Note that `$BINDGEN_PROFILE` is never in quotes so that it expands to nothing
# (not even an empty string argument) when the variable is empty. This is
# necessary so we don't pass an unexpected flag to cargo.

export RUST_BACKTRACE=1

case "$BINDGEN_JOB" in
"test")
cargo test $BINDGEN_PROFILE --features "$BINDGEN_FEATURES"
./ci/assert-no-diff.sh
;;

"integration")
cd ./bindgen-integration
cargo test $BINDGEN_PROFILE --features "$BINDGEN_FEATURES"
;;

"expectations")
cd ./tests/expectations
cargo test $BINDGEN_PROFILE
;;

"misc")
./ci/assert-docs.sh
./ci/test-book.sh
./ci/no-includes.sh
# `rustfmt` isn't reaching a fixed point on bindgen
# code... https://github.com/rust-lang-nursery/rustfmt/issues/1376
# ./ci/assert-rustfmt.sh
;;

*)
echo "Error! Unknown \$BINDGEN_JOB: '$BINDGEN_JOB'"
exit 1
esac
38 changes: 0 additions & 38 deletions ci/test.sh

This file was deleted.

0 comments on commit 59b8535

Please sign in to comment.