Skip to content

Commit 866e029

Browse files
authored
Merge pull request #1916 from lzutao/ci-bash
build: Transform most CI scripts to bash
2 parents 7cd6a2c + ac0463b commit 866e029

File tree

25 files changed

+83
-95
lines changed

25 files changed

+83
-95
lines changed

.travis.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,14 @@ matrix:
7373
if: branch != master
7474
env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=i686-apple-darwin
7575

76-
- name: clippy/rustup-init.sh
76+
- name: rustfmt/clippy/rustup-init.sh/shellcheck
7777
language: minimal
7878
install:
7979
- |
8080
sh ./rustup-init.sh --default-toolchain=beta -y;
8181
. "$HOME"/.cargo/env;
82-
rustup component add clippy;
82+
rustup component add rustfmt clippy;
8383
script:
84-
- cargo clippy --all --all-targets
8584
- |
8685
docker run \
8786
--volume "$TRAVIS_BUILD_DIR":/checkout:ro \
@@ -90,6 +89,11 @@ matrix:
9089
-it \
9190
centos:6 \
9291
sh ./ci/raw_init.sh;
92+
- shellcheck -s dash -- rustup-init.sh;
93+
- git ls-files -- '*.sh' | xargs shellcheck -s dash -e SC1090;
94+
- git ls-files -- '*.bash' | xargs shellcheck -s bash -e SC1090;
95+
- cargo fmt --all -- --check;
96+
- cargo clippy --all --all-targets
9397
before_deploy:
9498
deploy:
9599

@@ -120,23 +124,13 @@ script:
120124
esac
121125
- |
122126
if [ -n "$DOCKER" ]; then
123-
sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS";
127+
bash ci/build-run-docker.bash "$DOCKER" "$TARGET" "$SKIP_TESTS";
124128
else
125-
sh ci/run.sh;
126-
fi
127-
128-
# Check the formatting last because test failures are more interesting to have
129-
# discovered for contributors lacking some platform access for testing beforehand
130-
- |
131-
if [ "${TARGET}" = x86_64-unknown-linux-gnu ]; then
132-
shellcheck -s dash -e SC1090 -- rustup-init.sh ci/*.sh;
133-
rustup component add rustfmt;
134-
rustfmt -vV;
135-
cargo fmt --all -- --check;
129+
bash ci/run.bash;
136130
fi
137131
138132
before_deploy:
139-
- sh ci/prepare-deploy-travis.sh
133+
- bash ci/prepare-deploy-travis.bash
140134

141135
deploy:
142136
- provider: s3

ci/build-run-docker.sh renamed to ci/build-run-docker.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
script_dir=$(cd "$(dirname "$0")" && pwd)
44
root_dir="${script_dir}/.."
55

6-
. "${script_dir}/shared.sh"
6+
. "${script_dir}/shared.bash"
77

88
set -e
99
# Disable cause it makes shared script not to work properly
@@ -19,7 +19,7 @@ SKIP_TESTS="$3"
1919

2020
travis_fold start "fetch.image.${TARGET}"
2121
travis_time_start
22-
travis_do_cmd sh ci/fetch-rust-docker.sh "${TARGET}"
22+
travis_do_cmd bash ci/fetch-rust-docker.bash "${TARGET}"
2323
travis_time_finish
2424
travis_fold end "fetch.image.${TARGET}"
2525

@@ -52,7 +52,7 @@ docker run \
5252
--init \
5353
--rm \
5454
"${DOCKER}" \
55-
-c 'PATH="${PATH}":/rustc-sysroot/bin sh ci/run.sh'
55+
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
5656

5757
# check that rustup-init was built with ssl support
5858
# see https://github.com/rust-lang/rustup.rs/issues/1051

ci/deploy.sh renamed to ci/deploy.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
# Usage:
66
#
77
# 1. Deploy the release on the dev environment:
8-
# ./deploy.sh dev VERSION_NUMBER
8+
# ./deploy.bash dev VERSION_NUMBER
99
#
1010
# 2. Test everything works correctly:
1111
# RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup rustup self update
1212
#
1313
# 3. Deploy the release to the prod environment:
14-
# ./deploy.sh prod VERSION_NUMBER
14+
# ./deploy.bash prod VERSION_NUMBER
1515

1616
set -euo pipefail
1717
IFS=$'\n\t'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-aarch64-unknown-linux-gnu
22

3-
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc
4-
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-unknown-linux-gnueabi-gcc
3+
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
4+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-unknown-linux-gnueabi-gcc

ci/docker/android/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ RUN apt-get update && \
1111
make \
1212
pkg-config
1313

14-
COPY ci/docker/scripts/sccache.sh /scripts/
15-
RUN sh /scripts/sccache.sh
14+
COPY ci/docker/scripts/sccache.bash /scripts/
15+
RUN bash /scripts/sccache.bash
1616

1717
RUN apt-get install -y --no-install-recommends \
1818
unzip \
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-arm-unknown-linux-gnueabi
22

3-
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc
4-
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-unknown-linux-gnueabi-gcc
3+
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
4+
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-unknown-linux-gnueabi-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-arm-unknown-linux-gnueabihf
22

3-
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc
4-
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-unknown-linux-gnueabihf-gcc
3+
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
4+
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-unknown-linux-gnueabihf-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-armv7-unknown-linux-gnueabihf
22

3-
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc
4-
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=armv7-unknown-linux-gnueabihf-gcc
3+
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
4+
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=armv7-unknown-linux-gnueabihf-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-mips-unknown-linux-gnu
22

3-
ENV CC_mips_unknown_linux_gnu=mips-linux-gnu-gcc
4-
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc
3+
ENV CC_mips_unknown_linux_gnu=mips-linux-gnu-gcc \
4+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-mips64-unknown-linux-gnuabi64
22

3-
ENV CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc
4-
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc
3+
ENV CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
4+
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-mips64el-unknown-linux-gnuabi64
22

3-
ENV CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc
4-
ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc
3+
ENV CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc \
4+
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-mipsel-unknown-linux-gnu
22

3-
ENV CC_mipsel_unknown_linux_gnu=mipsel-linux-gnu-gcc
4-
ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc
3+
ENV CC_mipsel_unknown_linux_gnu=mipsel-linux-gnu-gcc \
4+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-powerpc-unknown-linux-gnu
22

3-
ENV CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc
4-
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-unknown-linux-gnu-gcc
3+
ENV CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \
4+
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-unknown-linux-gnu-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-powerpc64-unknown-linux-gnu
22

3-
ENV CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc
4-
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-unknown-linux-gnu-gcc
3+
ENV CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
4+
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-unknown-linux-gnu-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-powerpc64le-unknown-linux-gnu
22

3-
ENV CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc
4-
ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc
3+
ENV CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
4+
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-s390x-unknown-linux-gnu
22

3-
ENV CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc
4-
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-ibm-linux-gnu-gcc
3+
ENV CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
4+
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-ibm-linux-gnu-gcc
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM rust-x86_64-unknown-freebsd
22

3-
ENV CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-clang
4-
ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-clang
3+
ENV CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-clang \
4+
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-clang

ci/docker/x86_64-unknown-linux-musl/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:18.04
22

3-
COPY ci/docker/scripts/sccache.sh /scripts/
3+
COPY ci/docker/scripts/sccache.bash /scripts/
44

55
RUN \
66
apt-get update && \
@@ -12,4 +12,4 @@ RUN \
1212
perl \
1313
make \
1414
gcc && \
15-
sh /scripts/sccache.sh
15+
bash /scripts/sccache.bash

ci/fetch-rust-docker.sh renamed to ci/fetch-rust-docker.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
script_dir=$(cd "$(dirname "$0")" && pwd)
4-
. "$script_dir/shared.sh"
4+
. "$script_dir/shared.bash"
55

66
set -e
77
# Disable cause it makes shared script not to work properly

ci/prepare-deploy-travis.sh renamed to ci/prepare-deploy-travis.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ "$TRAVIS_PULL_REQUEST" = "true" ] || [ "$TRAVIS_BRANCH" = "auto" ]; then
77
fi
88

99
# Copy rustup-init to rustup-setup for backwards compatibility
10-
cp target/"$TARGET"/release/rustup-init$EXE_EXT target/"$TARGET"/release/rustup-setup$EXE_EXT
10+
cp target/"$TARGET"/release/rustup-init"${EXE_EXT}" target/"$TARGET"/release/rustup-setup"${EXE_EXT}"
1111

1212
# Generate hashes
1313
if [ "$TRAVIS_OS_NAME" = "osx" ]; then

ci/run.bash

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
export RUST_BACKTRACE=1
6+
7+
rustc -vV
8+
cargo -vV
9+
10+
FEATURES=()
11+
if [ "$TRAVIS_OS_NAME" != "windows" ]; then
12+
FEATURES=('--features' 'vendored-openssl')
13+
fi
14+
15+
cargo build --locked -v --release --target "$TARGET" "${FEATURES[@]}"
16+
17+
runtest () {
18+
cargo test --release --target "$TARGET" "${FEATURES[@]}" "$@"
19+
}
20+
21+
if [ -z "$SKIP_TESTS" ]; then
22+
cargo run --locked --release --target "$TARGET" "${FEATURES[@]}" -- --dump-testament
23+
runtest -p download
24+
runtest --bin rustup-init
25+
runtest --lib --all
26+
runtest --doc --all
27+
28+
runtest --test dist -- --test-threads 1
29+
30+
find ./tests -maxdepth 1 -type f ! -path '*/dist.rs' -name '*.rs' \
31+
| sed -E 's@\./tests/(.+)\.rs@\1@g' \
32+
| while read -r test; do
33+
runtest --test "${test}"
34+
done
35+
fi

ci/run.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

ci/shared.sh renamed to ci/shared.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ travis_nanoseconds() {
4949
local cmd='date'
5050
local format='+%s%N'
5151

52-
if command -v gdate >/dev/null 2>&1; then
52+
if command -v gdate >/dev/null; then
5353
cmd='gdate'
5454
elif [ "$(uname)" = Darwin ]; then
5555
format='+%s000000000'

src/cli/download_tracker.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,4 @@ mod tests {
267267

268268
assert_eq!(DownloadTracker::from_seconds(222_292), (2, 13, 44, 52));
269269
}
270-
271270
}

0 commit comments

Comments
 (0)