mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-31 04:02:00 -07:00
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.
This commit is contained in:
31
ci/before_deploy.sh
Normal file → Executable file
31
ci/before_deploy.sh
Normal file → Executable file
@@ -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() {
|
||||
|
38
ci/install.sh
Normal file → Executable file
38
ci/install.sh
Normal file → Executable file
@@ -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
|
||||
|
18
ci/script.sh
Normal file → Executable file
18
ci/script.sh
Normal file → Executable file
@@ -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
|
||||
}
|
||||
|
0
ci/sha256.sh
Normal file → Executable file
0
ci/sha256.sh
Normal file → Executable file
29
ci/utils.sh
29
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user