Simplify travis configuration

This commit is contained in:
Florian Dehau 2018-05-06 12:50:03 +02:00
parent 3c38abb203
commit 55840210c7
5 changed files with 5 additions and 109 deletions

View file

@ -5,18 +5,17 @@ rust:
- beta
- nightly
env:
- NO_RUSTUP=1
cache: cargo
matrix:
fast_finish: true
allow_failures:
- rust: nightly
- rust: beta
before_script:
- ./scripts/travis/before_script.sh
- rustup component add rustfmt-preview
script:
- ./scripts/travis/script.sh
- make fmt
- make build
- make test

View file

@ -27,26 +27,6 @@ help: ## Print all the available commands
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ================================ Tools ======================================
install-tools: install-rustfmt install-clippy ## Install tools dependencies
INSTALL_RUSTFMT = ./scripts/tools/install.sh --name=rustfmt-nightly
ifndef CI
INSTALL_RUSTFMT += --channel=nightly
endif
install-rustfmt: ## Intall rustfmt
$(INSTALL_RUSTFMT)
INSTALL_CLIPPY = ./scripts/tools/install.sh --name=clippy
ifndef CI
INSTALL_CLIPPY += --channel=nightly
endif
install-clippy: ## Intall rustfmt
$(INSTALL_CLIPPY)
# =============================== Build =======================================
check: ## Validate the project code

View file

@ -1,65 +0,0 @@
#!/bin/bash
set -e
USAGE="$0 --name=STRING [--channel=STRING]"
# Default values
CARGO="cargo"
NAME=""
CHANNEL=""
# Parse args
for i in "$@"; do
case $i in
--name=*)
NAME="${i#*=}"
shift
;;
--channel=*)
CHANNEL="${i#*=}"
shift
;;
*)
echo "$USAGE"
exit 1
;;
esac
done
current_version() {
local crate="$1"
$CARGO install --list | \
grep "$crate" | \
head -n 1 | \
cut -d ' ' -f 2 | \
sed 's/v\(.*\):/\1/g'
}
upstream_version() {
local crate="$1"
$CARGO search "$crate" | \
grep "$crate" | \
head -n 1 | \
cut -d' ' -f 3 | \
sed 's/"//g'
}
if [ "$NAME" == "" ]; then
echo "$USAGE"
exit 1
fi
if [ "$CHANNEL" != "" ]; then
CARGO+=" +$CHANNEL"
fi
CURRENT_VERSION=$(current_version "$NAME")
UPSTREAM_VERSION=$(upstream_version "$NAME")
if [[ "$CURRENT_VERSION" != "$UPSTREAM_VERSION" ]]; then
echo "WARN: Latest version of $NAME not installed: $CURRENT_VERSION -> $UPSTREAM_VERSION"
$CARGO install --force "$NAME"
else
echo "INFO: Latest version of $NAME already installed ($CURRENT_VERSION)"
fi

View file

@ -1,9 +0,0 @@
#!/bin/bash
set -eu
export PATH="$PATH:$HOME/.cargo/bin"
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
export LD_LIBRARY_PATH="$(rustc +nightly --print sysroot)/lib:${LD_LIBRARY_PATH:-""}"
make install-tools
fi

View file

@ -1,9 +0,0 @@
#!/bin/bash
set -eu
make build
make test
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
make lint
fi