summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-02-04 12:14:38 -0500
committerAndrew Gallant <jamslam@gmail.com>2018-02-06 12:07:59 -0500
commitb50ae9a99c46acf40d1c47c2e0ef6947fefbc044 (patch)
tree77b9a1114a4a08fd3340b59f2f4bd3ee58b4210c /ci
parent224c112e0509ab2aeb28de05efbbce9486a55eff (diff)
ci: cleanup
This cleans up our CI scripts but doesn't significantly change anything. Mostly this is removing dead code and wrong comments, and making the style a bit more consistent.
Diffstat (limited to 'ci')
-rwxr-xr-x[-rw-r--r--]ci/before_deploy.sh31
-rwxr-xr-x[-rw-r--r--]ci/install.sh38
-rwxr-xr-x[-rw-r--r--]ci/script.sh18
-rwxr-xr-x[-rw-r--r--]ci/sha256.sh0
-rw-r--r--ci/utils.sh29
5 files changed, 41 insertions, 75 deletions
diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh
index 4890f96b..35bdc0b1 100644..100755
--- a/ci/before_deploy.sh
+++ b/ci/before_deploy.sh
@@ -1,40 +1,39 @@
-# `before_deploy` phase: here we package the build artifacts
+#!/bin/bash
+
+# package the build artifacts
set -ex
-. $(dirname $0)/utils.sh
+. "$(dirname $0)/utils.sh"
# Generate artifacts for release
mk_artifacts() {
if is_ssse3_target; then
RUSTFLAGS="-C target-feature=+ssse3" \
- cargo build --target $TARGET --release --features simd-accel
+ cargo build --target "$TARGET" --release --features simd-accel
else
- cargo build --target $TARGET --release
+ cargo build --target "$TARGET" --release
fi
}
mk_tarball() {
- # create a "staging" directory
- local td=$(mktempd)
- local out_dir=$(pwd)
- local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
local gcc_prefix="$(gcc_prefix)"
- mkdir "${td:?}/${name}"
- mkdir "$td/$name/complete"
+ local td="$(mktemp -d)"
+ local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"
+ mkdir -p "$td/$name/complete"
+ mkdir deployment
+ local out_dir="$(pwd)/deployment"
cp target/$TARGET/release/rg "$td/$name/rg"
- ${gcc_prefix}strip "$td/$name/rg"
+ "${gcc_prefix}strip" "$td/$name/rg"
cp {doc/rg.1,README.md,UNLICENSE,COPYING,LICENSE-MIT} "$td/$name/"
cp \
- target/$TARGET/release/build/ripgrep-*/out/{rg.bash-completion,rg.fish,_rg.ps1} \
+ target/"$TARGET"/release/build/ripgrep-*/out/{rg.bash,rg.fish,_rg.ps1} \
"$td/$name/complete/"
cp complete/_rg "$td/$name/complete/"
- pushd $td
- tar czf "$out_dir/$name.tar.gz" *
- popd
- rm -r $td
+ (cd "$td" && tar czf "$out_dir/$name.tar.gz" *)
+ rm -rf "$td"
}
main() {
diff --git a/ci/install.sh b/ci/install.sh
index ffddf866..08d65b1a 100644..100755
--- a/ci/install.sh
+++ b/ci/install.sh
@@ -1,29 +1,22 @@
-# `install` phase: install stuff needed for the `script` phase
+#!/bin/bash
+
+# install stuff needed for the `script` phase
+
+# Where rustup gets installed.
+export PATH="$PATH:$HOME/.cargo/bin"
set -ex
-. $(dirname $0)/utils.sh
-
-install_c_toolchain() {
- case $TARGET in
- aarch64-unknown-linux-gnu)
- sudo apt-get install -y --no-install-recommends \
- gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross
- ;;
- *)
- # For other targets, this is handled by addons.apt.packages in .travis.yml
- ;;
- esac
-}
+. "$(dirname $0)/utils.sh"
install_rustup() {
- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
-
+ curl https://sh.rustup.rs -sSf \
+ | sh -s -- -y --default-toolchain="$TRAVIS_RUST_VERSION"
rustc -V
cargo -V
}
-install_standard_crates() {
+install_targets() {
if [ $(host) != "$TARGET" ]; then
rustup target add $TARGET
fi
@@ -33,11 +26,13 @@ configure_cargo() {
local prefix=$(gcc_prefix)
if [ -n "${prefix}" ]; then
local gcc_suffix=
- test -n "${GCC_VERSION}" && gcc_suffix="-${GCC_VERSION}" || :
+ if [ -n "$GCC_VERSION" ]; then
+ gcc_suffix="-$GCC_VERSION"
+ fi
local gcc="${prefix}gcc${gcc_suffix}"
# information about the cross compiler
- ${gcc} -v
+ "${gcc}" -v
# tell cargo which linker to use for cross compilation
mkdir -p .cargo
@@ -49,12 +44,9 @@ EOF
}
main() {
- install_c_toolchain
install_rustup
- install_standard_crates
+ install_targets
configure_cargo
-
- # TODO if you need to install extra stuff add it here
}
main
diff --git a/ci/script.sh b/ci/script.sh
index 32aef003..e9f9bcb3 100644..100755
--- a/ci/script.sh
+++ b/ci/script.sh
@@ -1,19 +1,10 @@
-# `script` phase: you usually build, test and generate docs in this phase
+#!/bin/bash
+
+# build, test and generate docs in this phase
set -ex
-. $(dirname $0)/utils.sh
-
-# NOTE Workaround for rust-lang/rust#31907 - disable doc tests when cross compiling
-# This has been fixed in the nightly channel but it would take a while to reach the other channels
-disable_cross_doctests() {
- if [ $(host) != "$TARGET" ] && [ "$TRAVIS_RUST_VERSION" = "stable" ]; then
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
- brew install gnu-sed --default-names
- fi
- find src -name '*.rs' -type f | xargs sed -i -e 's:\(//.\s*```\):\1 ignore,:g'
- fi
-}
+. "$(dirname $0)/utils.sh"
main() {
# disable_cross_doctests
@@ -22,7 +13,6 @@ main() {
cargo test --target "${TARGET}" --verbose --all
"$( dirname "${0}" )/test_complete.sh"
fi
-
# sanity check the file type
file target/$TARGET/debug/rg
}
diff --git a/ci/sha256.sh b/ci/sha256.sh
index 670c9766..670c9766 100644..100755
--- a/ci/sha256.sh
+++ b/ci/sha256.sh
diff --git a/ci/utils.sh b/ci/utils.sh
index 7dcd7cec..61428ecb 100644
--- a/ci/utils.sh
+++ b/ci/utils.sh
@@ -1,6 +1,6 @@
-mktempd() {
- echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
-}
+#!/bin/bash
+
+# Various utility functions used through CI.
host() {
case "$TRAVIS_OS_NAME" in
@@ -15,9 +15,6 @@ host() {
gcc_prefix() {
case "$TARGET" in
- aarch64-unknown-linux-gnu)
- echo aarch64-linux-gnu-
- ;;
arm*-gnueabihf)
echo arm-linux-gnueabihf-
;;
@@ -27,19 +24,8 @@ gcc_prefix() {
esac
}
-dobin() {
- [ -z $MAKE_DEB ] && die 'dobin: $MAKE_DEB not set'
- [ $# -lt 1 ] && die "dobin: at least one argument needed"
-
- local f prefix=$(gcc_prefix)
- for f in "$@"; do
- install -m0755 $f $dtd/debian/usr/bin/
- ${prefix}strip -s $dtd/debian/usr/bin/$(basename $f)
- done
-}
-
architecture() {
- case ${TARGET:?} in
+ case "$TARGET" in
x86_64-*)
echo amd64
;;
@@ -56,9 +42,8 @@ architecture() {
}
is_ssse3_target() {
- case "${TARGET}" in
- i686-unknown-netbsd) return 1 ;; # i686-unknown-netbsd - SSE2
- i686*|x86_64*) return 0 ;;
+ case "$TARGET" in
+ x86_64*) return 0 ;;
+ *) return 1 ;;
esac
- return 1
}