Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint shell scripts in CI #274

Merged
merged 2 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/buildkite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ steps:
user: "998:997" # buildkite-agent:buildkite-agent
- command: "ci/test-cuda.sh"
label: "cuda"
- command: "ci/shellcheck.sh"
label: "shellcheck [public]"
- wait
- command: "ci/publish.sh"
label: "publish release artifacts"
Expand Down
3 changes: 2 additions & 1 deletion ci/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

if [[ -r ~/.cargo/env ]]; then
# Pick up local install of kcov/cargo-kcov
# shellcheck disable=SC1090
source ~/.cargo/env
fi

Expand Down
2 changes: 1 addition & 1 deletion ci/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

if [[ -z "$BUILDKITE_TAG" ]]; then
# Skip publish if this is not a tagged release
Expand Down
14 changes: 14 additions & 0 deletions ci/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -e
#
# Reference: https://github.com/koalaman/shellcheck/wiki/Directive

cd "$(dirname "$0")/.."

set -x
docker pull koalaman/shellcheck
find . -name "*.sh" -not -regex ".*/.cargo/.*" -print0 \
| xargs -0 \
docker run -w /work -v "$PWD:/work" \
koalaman/shellcheck --color=always --external-sources --shell=bash

exit 0
10 changes: 4 additions & 6 deletions ci/test-cuda.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

if [[ -z "$libcuda_verify_ed25519_URL" ]]; then
echo libcuda_verify_ed25519_URL undefined
exit 1
fi
: "${libcuda_verify_ed25519_URL:?environment variable undefined}"

export LD_LIBRARY_PATH=/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
curl -X GET -o libcuda_verify_ed25519.a "$libcuda_verify_ed25519_URL"

source $HOME/.cargo/env
# shellcheck disable=SC1090 # <-- shellcheck can't follow ~
source ~/.cargo/env
cargo test --features=cuda

exit 0
2 changes: 1 addition & 1 deletion ci/test-ignored.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

rustc --version
cargo --version
Expand Down
2 changes: 1 addition & 1 deletion ci/test-nightly.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

rustc --version
cargo --version
Expand Down
2 changes: 1 addition & 1 deletion ci/test-stable.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

cd $(dirname $0)/..
cd "$(dirname "$0")/.."

rustc --version
cargo --version
Expand Down
19 changes: 15 additions & 4 deletions multinode-demo/client.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/bin/bash
#!/bin/bash -e

if [[ -z "$1" ]]; then
echo "usage: $0 [leader machine]"
exit 1
fi

LEADER="$1"

set -x
export RUST_LOG=solana=info
rsync -v -e ssh $1:~/solana/leader.json .
rsync -v -e ssh $1:~/solana/mint-demo.json .
cat mint-demo.json | cargo run --release --bin solana-client-demo -- -l leader.json -c 8100 -n 1
rsync -v -e ssh "$LEADER:~/solana/leader.json" .
rsync -v -e ssh "$LEADER:~/solana/mint-demo.json" .

cargo run --release --bin solana-client-demo -- \
-l leader.json -c 8100 -n 1 < mint-demo.json
29 changes: 22 additions & 7 deletions multinode-demo/validator.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#!/bin/bash
rsync -v -e ssh $1:~/solana/mint-demo.json .
rsync -v -e ssh $1:~/solana/leader.json .
rsync -v -e ssh $1:~/solana/genesis.log .
rsync -v -e ssh $1:~/solana/leader.log .
rsync -v -e ssh $1:~/solana/libcuda_verify_ed25519.a .
#!/bin/bash -e

if [[ -z "$1" ]]; then
echo "usage: $0 [leader machine]"
exit 1
fi

LEADER="$1"

set -x

rsync -v -e ssh "$LEADER:~/solana/mint-demo.json" .
rsync -v -e ssh "$LEADER:~/solana/leader.json" .
rsync -v -e ssh "$LEADER:~/solana/genesis.log" .
rsync -v -e ssh "$LEADER:~/solana/leader.log" .
rsync -v -e ssh "$LEADER:~/solana/libcuda_verify_ed25519.a" .

export RUST_LOG=solana=info

sudo sysctl -w net.core.rmem_max=26214400
cat genesis.log leader.log | cargo run --release --features cuda --bin solana-fullnode -- -l validator.json -s validator.json -v leader.json -b 9000 -d 2>&1 | tee validator-tee.log

cat genesis.log leader.log | \
cargo run --release --features cuda --bin solana-fullnode -- \
-l validator.json -s validator.json -v leader.json -b 9000 -d 2>&1 | tee validator-tee.log