mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-04-24 17:12:16 +02: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:
parent
224c112e05
commit
b50ae9a99c
55
.travis.yml
55
.travis.yml
@ -1,11 +1,9 @@
|
|||||||
language: rust
|
language: rust
|
||||||
cache: cargo
|
cache: cargo
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PROJECT_NAME=ripgrep
|
- PROJECT_NAME: ripgrep
|
||||||
- RUST_BACKTRACE: full
|
- RUST_BACKTRACE: full
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -13,13 +11,12 @@ addons:
|
|||||||
- zsh
|
- zsh
|
||||||
# Needed for testing decompression search.
|
# Needed for testing decompression search.
|
||||||
- xz-utils
|
- xz-utils
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
# Nightly channel.
|
# Nightly channel.
|
||||||
# (All *nix releases are done on the nightly channel to take advantage
|
# All *nix releases are done on the nightly channel to take advantage
|
||||||
# of the regex library's multiple pattern SIMD search.)
|
# of the regex library's multiple pattern SIMD search.
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: nightly
|
rust: nightly
|
||||||
env: TARGET=i686-unknown-linux-musl
|
env: TARGET=i686-unknown-linux-musl
|
||||||
@ -39,14 +36,16 @@ matrix:
|
|||||||
- binutils-arm-linux-gnueabihf
|
- binutils-arm-linux-gnueabihf
|
||||||
- libc6-armhf-cross
|
- libc6-armhf-cross
|
||||||
- libc6-dev-armhf-cross
|
- libc6-dev-armhf-cross
|
||||||
# Beta channel.
|
# Beta channel. We enable these to make sure there are no regressions in
|
||||||
|
# Rust beta releases.
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: beta
|
rust: beta
|
||||||
env: TARGET=x86_64-unknown-linux-musl
|
env: TARGET=x86_64-unknown-linux-musl
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: beta
|
rust: beta
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
# Minimum Rust supported channel.
|
# Minimum Rust supported channel. We enable these to make sure ripgrep
|
||||||
|
# continues to work on the advertised minimum Rust version.
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: 1.20.0
|
rust: 1.20.0
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
@ -63,43 +62,27 @@ matrix:
|
|||||||
- binutils-arm-linux-gnueabihf
|
- binutils-arm-linux-gnueabihf
|
||||||
- libc6-armhf-cross
|
- libc6-armhf-cross
|
||||||
- libc6-dev-armhf-cross
|
- libc6-dev-armhf-cross
|
||||||
|
install: ci/install.sh
|
||||||
before_install:
|
script: ci/script.sh
|
||||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
before_deploy: ci/before_deploy.sh
|
||||||
|
|
||||||
install:
|
|
||||||
- bash ci/install.sh
|
|
||||||
|
|
||||||
script:
|
|
||||||
- bash ci/script.sh
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- bash ci/before_deploy.sh
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
file_glob: true
|
||||||
|
file: deployment/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.*
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
condition: $TRAVIS_RUST_VERSION = nightly
|
||||||
|
branch: ag/misc-improvements
|
||||||
|
# tags: true
|
||||||
api_key:
|
api_key:
|
||||||
secure: "IbSnsbGkxSydR/sozOf1/SRvHplzwRUHzcTjM7BKnr7GccL86gRPUrsrvD103KjQUGWIc1TnK1YTq5M0Onswg/ORDjqa1JEJPkPdPnVh9ipbF7M2De/7IlB4X4qXLKoApn8+bx2x/mfYX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kdB9qKcrEvRINCelalzALPi0hD/HUDi8DD2PNTCLLMo6VSYtvc685Zbe+KgNzDV1YyTrRCUW6JotrS0r2ULLwnsh40hSB//nNv3XmwNmC/CmW5QAnIGj8cBMF4S2t6ohADIndojdAfNiptmaZOIT6owK7bWMgPMyopo="
|
||||||
file_glob: true
|
|
||||||
file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.*
|
|
||||||
# don't delete the artifacts from previous phases
|
|
||||||
skip_cleanup: true
|
|
||||||
# deploy when a new tag is pushed
|
|
||||||
on:
|
|
||||||
# channel to use to produce the release artifacts
|
|
||||||
# NOTE make sure you only release *once* per target
|
|
||||||
# TODO you may want to pick a different channel
|
|
||||||
condition: $TRAVIS_RUST_VERSION = nightly
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
# Pushes and PR to the master branch
|
# Pushes and PR to the master branch
|
||||||
- master
|
- master
|
||||||
# IMPORTANT Ruby regex to match tags. Required, or travis won't trigger deploys when a new tag
|
# Ruby regex to match tags. Required, or travis won't trigger deploys when
|
||||||
# is pushed. This regex matches semantic versions like v1.2.3-rc4+2016.02.22
|
# a new tag is pushed.
|
||||||
- /^\d+\.\d+\.\d+.*$/
|
- /^\d+\.\d+\.\d+.*$/
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never
|
on_success: never
|
||||||
|
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
|
set -ex
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
. "$(dirname $0)/utils.sh"
|
||||||
|
|
||||||
# Generate artifacts for release
|
# Generate artifacts for release
|
||||||
mk_artifacts() {
|
mk_artifacts() {
|
||||||
if is_ssse3_target; then
|
if is_ssse3_target; then
|
||||||
RUSTFLAGS="-C target-feature=+ssse3" \
|
RUSTFLAGS="-C target-feature=+ssse3" \
|
||||||
cargo build --target $TARGET --release --features simd-accel
|
cargo build --target "$TARGET" --release --features simd-accel
|
||||||
else
|
else
|
||||||
cargo build --target $TARGET --release
|
cargo build --target "$TARGET" --release
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mk_tarball() {
|
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)"
|
local gcc_prefix="$(gcc_prefix)"
|
||||||
mkdir "${td:?}/${name}"
|
local td="$(mktemp -d)"
|
||||||
mkdir "$td/$name/complete"
|
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"
|
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 {doc/rg.1,README.md,UNLICENSE,COPYING,LICENSE-MIT} "$td/$name/"
|
||||||
cp \
|
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/"
|
"$td/$name/complete/"
|
||||||
cp complete/_rg "$td/$name/complete/"
|
cp complete/_rg "$td/$name/complete/"
|
||||||
|
|
||||||
pushd $td
|
(cd "$td" && tar czf "$out_dir/$name.tar.gz" *)
|
||||||
tar czf "$out_dir/$name.tar.gz" *
|
rm -rf "$td"
|
||||||
popd
|
|
||||||
rm -r $td
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
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
|
set -ex
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
. "$(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
|
|
||||||
}
|
|
||||||
|
|
||||||
install_rustup() {
|
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
|
rustc -V
|
||||||
cargo -V
|
cargo -V
|
||||||
}
|
}
|
||||||
|
|
||||||
install_standard_crates() {
|
install_targets() {
|
||||||
if [ $(host) != "$TARGET" ]; then
|
if [ $(host) != "$TARGET" ]; then
|
||||||
rustup target add $TARGET
|
rustup target add $TARGET
|
||||||
fi
|
fi
|
||||||
@ -33,11 +26,13 @@ configure_cargo() {
|
|||||||
local prefix=$(gcc_prefix)
|
local prefix=$(gcc_prefix)
|
||||||
if [ -n "${prefix}" ]; then
|
if [ -n "${prefix}" ]; then
|
||||||
local gcc_suffix=
|
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}"
|
local gcc="${prefix}gcc${gcc_suffix}"
|
||||||
|
|
||||||
# information about the cross compiler
|
# information about the cross compiler
|
||||||
${gcc} -v
|
"${gcc}" -v
|
||||||
|
|
||||||
# tell cargo which linker to use for cross compilation
|
# tell cargo which linker to use for cross compilation
|
||||||
mkdir -p .cargo
|
mkdir -p .cargo
|
||||||
@ -49,12 +44,9 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
install_c_toolchain
|
|
||||||
install_rustup
|
install_rustup
|
||||||
install_standard_crates
|
install_targets
|
||||||
configure_cargo
|
configure_cargo
|
||||||
|
|
||||||
# TODO if you need to install extra stuff add it here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
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
|
set -ex
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
. "$(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
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# disable_cross_doctests
|
# disable_cross_doctests
|
||||||
@ -22,7 +13,6 @@ main() {
|
|||||||
cargo test --target "${TARGET}" --verbose --all
|
cargo test --target "${TARGET}" --verbose --all
|
||||||
"$( dirname "${0}" )/test_complete.sh"
|
"$( dirname "${0}" )/test_complete.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# sanity check the file type
|
# sanity check the file type
|
||||||
file target/$TARGET/debug/rg
|
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() {
|
#!/bin/bash
|
||||||
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
|
||||||
}
|
# Various utility functions used through CI.
|
||||||
|
|
||||||
host() {
|
host() {
|
||||||
case "$TRAVIS_OS_NAME" in
|
case "$TRAVIS_OS_NAME" in
|
||||||
@ -15,9 +15,6 @@ host() {
|
|||||||
|
|
||||||
gcc_prefix() {
|
gcc_prefix() {
|
||||||
case "$TARGET" in
|
case "$TARGET" in
|
||||||
aarch64-unknown-linux-gnu)
|
|
||||||
echo aarch64-linux-gnu-
|
|
||||||
;;
|
|
||||||
arm*-gnueabihf)
|
arm*-gnueabihf)
|
||||||
echo arm-linux-gnueabihf-
|
echo arm-linux-gnueabihf-
|
||||||
;;
|
;;
|
||||||
@ -27,19 +24,8 @@ gcc_prefix() {
|
|||||||
esac
|
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() {
|
architecture() {
|
||||||
case ${TARGET:?} in
|
case "$TARGET" in
|
||||||
x86_64-*)
|
x86_64-*)
|
||||||
echo amd64
|
echo amd64
|
||||||
;;
|
;;
|
||||||
@ -56,9 +42,8 @@ architecture() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_ssse3_target() {
|
is_ssse3_target() {
|
||||||
case "${TARGET}" in
|
case "$TARGET" in
|
||||||
i686-unknown-netbsd) return 1 ;; # i686-unknown-netbsd - SSE2
|
x86_64*) return 0 ;;
|
||||||
i686*|x86_64*) return 0 ;;
|
*) return 1 ;;
|
||||||
esac
|
esac
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user