Add integration tests

This commit is contained in:
Philipp Hansch 2018-05-16 09:10:35 +02:00
parent 1af2f20da6
commit cc9122777b
No known key found for this signature in database
GPG Key ID: B6FA06A6E0E2665B
3 changed files with 53 additions and 16 deletions

View File

@ -29,23 +29,21 @@ install:
- nvm use stable
- npm install remark-cli remark-lint
matrix:
include:
- env: INTEGRATION=rust-lang/cargo
- env: INTEGRATION=rust-lang-nursery/rand
allow_failures:
- env: INTEGRATION=rust-lang/cargo
- env: INTEGRATION=rust-lang-nursery/rand
script:
- PATH=$PATH:./node_modules/.bin
- remark -f *.md > /dev/null
- set -e
- cargo build --features debugging
- cargo test --features debugging
- mkdir -p ~/rust/cargo/bin
- cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
- cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver
- PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -D clippy
- cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ..
- cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
- cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../..
- PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../..
- set +e
- |
if [ -z ${INTEGRATION} ]; then
./ci/base-tests.sh
else
./ci/integration-tests.sh
fi
after_success: |
#!/bin/bash

15
ci/base-tests.sh Normal file
View File

@ -0,0 +1,15 @@
PATH=$PATH:./node_modules/.bin
remark -f *.md > /dev/null
set -e
cargo build --features debugging
cargo test --features debugging
mkdir -p ~/rust/cargo/bin
cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver
PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -D clippy
cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ..
cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../..
PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy
cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../..

24
ci/integration-tests.sh Executable file
View File

@ -0,0 +1,24 @@
cargo install --force
echo "Running integration test for crate ${INTEGRATION}"
git clone https://github.com/${INTEGRATION}.git
function check() {
cargo clippy --all &> clippy_output
cat clippy_output
! cat clippy_output | grep -q "internal error"
if [[ $? != 0 ]]; then
return 1
fi
}
case ${INTEGRATION} in
rust-lang/cargo)
check
;;
*)
cd ${INTEGRATION}
check
;;
esac