mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
ci: test build outputs
This modifies CI to check that we generate completion files and a man page. We also enable tests on arm.
This commit is contained in:
parent
6553940328
commit
e1f1ede17d
@ -1,5 +1,4 @@
|
|||||||
language: rust
|
language: rust
|
||||||
cache: cargo
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PROJECT_NAME: ripgrep
|
- PROJECT_NAME: ripgrep
|
||||||
@ -7,12 +6,16 @@ env:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
|
# For generating man page.
|
||||||
|
- libxslt1-dev
|
||||||
|
- asciidoc
|
||||||
|
- docbook-xsl
|
||||||
|
- xsltproc
|
||||||
|
- libxml2-utils
|
||||||
# Needed for completion-function test.
|
# Needed for completion-function test.
|
||||||
- zsh
|
- zsh
|
||||||
# Needed for testing decompression search.
|
# Needed for testing decompression search.
|
||||||
- xz-utils
|
- xz-utils
|
||||||
# For generating man page.
|
|
||||||
- asciidoc
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
|
47
ci/script.sh
47
ci/script.sh
@ -7,14 +7,49 @@ set -ex
|
|||||||
. "$(dirname $0)/utils.sh"
|
. "$(dirname $0)/utils.sh"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# disable_cross_doctests
|
# Travis sometimes caches the target directory, which makes testing the
|
||||||
|
# output of cargo a little trickier. So just wipe it.
|
||||||
|
cargo clean
|
||||||
|
# Test a normal debug build.
|
||||||
cargo build --target "${TARGET}" --verbose --all
|
cargo build --target "${TARGET}" --verbose --all
|
||||||
if [ "$(architecture)" = "amd64" ] || [ "$(architecture)" = "i386" ]; then
|
|
||||||
cargo test --target "${TARGET}" --verbose --all
|
# Show the output of build.rs stderr.
|
||||||
"$( dirname "${0}" )/test_complete.sh"
|
set +x
|
||||||
fi
|
find ./target/"$TARGET"/debug -name stderr | while read stderr; do
|
||||||
|
if [ -s "$stderr" ]; then
|
||||||
|
echo "===== $stderr ====="
|
||||||
|
cat "$stderr"
|
||||||
|
echo "====="
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
set -x
|
||||||
|
|
||||||
# sanity check the file type
|
# sanity check the file type
|
||||||
file target/$TARGET/debug/rg
|
file target/"$TARGET"/debug/rg
|
||||||
|
|
||||||
|
# Apparently tests don't work on arm, so just bail now. I guess we provide
|
||||||
|
# ARM releases on a best effort basis?
|
||||||
|
if is_arm; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test that zsh completions are in sync with ripgrep's actual args.
|
||||||
|
"$(dirname "${0}")/test_complete.sh"
|
||||||
|
|
||||||
|
# Check that we've generated man page and other shell completions.
|
||||||
|
find ./target/"$TARGET"/debug/build/ripgrep-* -name 'out' | \
|
||||||
|
while read outdir; do
|
||||||
|
file "$outdir/rg.bash"
|
||||||
|
file "$outdir/rg.fish"
|
||||||
|
file "$outdir/_rg.ps1"
|
||||||
|
# man page requires asciidoc, and we only install it on Linux x86.
|
||||||
|
if is_linux; then
|
||||||
|
file "$outdir/rg.1"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run tests for ripgrep and all sub-crates.
|
||||||
|
cargo test --target "${TARGET}" --verbose --all
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
51
ci/utils.sh
51
ci/utils.sh
@ -13,17 +13,6 @@ host() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_prefix() {
|
|
||||||
case "$TARGET" in
|
|
||||||
arm*-gnueabihf)
|
|
||||||
echo arm-linux-gnueabihf-
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
architecture() {
|
architecture() {
|
||||||
case "$TARGET" in
|
case "$TARGET" in
|
||||||
x86_64-*)
|
x86_64-*)
|
||||||
@ -41,9 +30,41 @@ architecture() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
is_ssse3_target() {
|
gcc_prefix() {
|
||||||
case "$TARGET" in
|
case "$(architecture)" in
|
||||||
x86_64*) return 0 ;;
|
armhf)
|
||||||
*) return 1 ;;
|
echo arm-linux-gnueabihf-
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
is_ssse3_target() {
|
||||||
|
case "$(architecture)" in
|
||||||
|
amd64) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
is_x86() {
|
||||||
|
case "$(architecture)" in
|
||||||
|
amd64|i386) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
is_arm() {
|
||||||
|
case "$(architecture)" in
|
||||||
|
armhf) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
is_linux() {
|
||||||
|
case "$TRAVIS_OS_NAME" in
|
||||||
|
linux) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user