Skip to content

Commit f19eab9

Browse files
authored
Merge pull request #2764 from phansch/integration_tests
Add basic integration tests for travis
2 parents c0bf3a4 + 569c138 commit f19eab9

File tree

4 files changed

+57
-19
lines changed

4 files changed

+57
-19
lines changed

.github/deploy.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22
# Automatically deploy on gh-pages
33

4-
set -e
5-
set -x
4+
set -ex
65

76
SOURCE_BRANCH="master"
87
TARGET_BRANCH="gh-pages"

.travis.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,27 @@ install:
2929
- nvm use stable
3030
- npm install remark-cli remark-lint
3131

32+
matrix:
33+
include:
34+
- env: BASE_TESTS=true # runs the base tests
35+
- env: INTEGRATION=rust-lang/cargo
36+
- env: INTEGRATION=rust-lang-nursery/rand
37+
allow_failures:
38+
- env: INTEGRATION=rust-lang/cargo
39+
- env: INTEGRATION=rust-lang-nursery/rand
40+
3241
script:
33-
- PATH=$PATH:./node_modules/.bin
34-
- remark -f *.md > /dev/null
35-
- set -e
36-
- cargo build --features debugging
37-
- cargo test --features debugging
38-
- mkdir -p ~/rust/cargo/bin
39-
- cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
40-
- cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver
41-
- PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -D clippy
42-
- cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ..
43-
- cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
44-
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
45-
- cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../..
46-
- PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy
47-
- cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../..
48-
- set +e
42+
- |
43+
if [ -z ${INTEGRATION} ]; then
44+
./ci/base-tests.sh
45+
else
46+
./ci/integration-tests.sh
47+
fi
4948
5049
after_success: |
5150
#!/bin/bash
5251
if [ $(uname) == Linux ]; then
53-
set -e
52+
set -ex
5453
./.github/deploy.sh
5554
# trigger rebuild of the clippy-service, to keep it up to date with clippy itself
5655
if [ "$TRAVIS_PULL_REQUEST" == "false" ] &&

ci/base-tests.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set -ex
2+
PATH=$PATH:./node_modules/.bin
3+
remark -f *.md > /dev/null
4+
cargo build --features debugging
5+
cargo test --features debugging
6+
mkdir -p ~/rust/cargo/bin
7+
cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy
8+
cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver
9+
PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -D clippy
10+
cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ..
11+
cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
12+
cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../..
13+
cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../..
14+
PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy
15+
cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../..

ci/integration-tests.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set -x
2+
cargo install --force
3+
4+
echo "Running integration test for crate ${INTEGRATION}"
5+
6+
git clone --depth=1 https://github.com/${INTEGRATION}.git checkout
7+
cd checkout
8+
9+
function check() {
10+
cargo clippy --all &> clippy_output
11+
cat clippy_output
12+
! cat clippy_output | grep -q "internal compiler error"
13+
if [[ $? != 0 ]]; then
14+
return 1
15+
fi
16+
}
17+
18+
case ${INTEGRATION} in
19+
rust-lang/cargo)
20+
check
21+
;;
22+
*)
23+
check
24+
;;
25+
esac

0 commit comments

Comments
 (0)