forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-tarball.sh
executable file
·177 lines (151 loc) · 4.47 KB
/
publish-tarball.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
if [[ -n $APPVEYOR ]]; then
# Bootstrap rust build environment
source ci/env.sh
source ci/rust-version.sh
appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
export USERPROFILE="D:\\"
./rustup-init -yv --default-toolchain $rust_stable --default-host x86_64-pc-windows-msvc
export PATH="$PATH:/d/.cargo/bin"
rustc -vV
cargo -vV
fi
DRYRUN=
if [[ -z $CI_BRANCH ]]; then
DRYRUN="echo"
CHANNEL=unknown
fi
eval "$(ci/channel-info.sh)"
TAG=
if [[ -n "$CI_TAG" ]]; then
CHANNEL_OR_TAG=$CI_TAG
TAG="$CI_TAG"
else
CHANNEL_OR_TAG=$CHANNEL
fi
if [[ -z $CHANNEL_OR_TAG ]]; then
echo Unable to determine channel to publish into, exiting.
exit 1
fi
maybeCUDA=
case "$CI_OS_NAME" in
osx)
TARGET=x86_64-apple-darwin
;;
linux)
TARGET=x86_64-unknown-linux-gnu
maybeCUDA=cuda
;;
windows)
TARGET=x86_64-pc-windows-msvc
;;
*)
echo CI_OS_NAME unset
exit 1
;;
esac
echo --- Creating tarball
(
set -x
rm -rf solana-release/
mkdir solana-release/
COMMIT="$(git rev-parse HEAD)"
(
echo "channel: $CHANNEL_OR_TAG"
echo "commit: $COMMIT"
echo "target: $TARGET"
) > solana-release/version.yml
source ci/rust-version.sh stable
scripts/cargo-install-all.sh +"$rust_stable" solana-release $maybeCUDA
# Reduce the Windows archive size until
# https://github.com/appveyor/ci/issues/2997 is fixed
if [[ -n $APPVEYOR ]]; then
rm -f solana-release/bin/solana-validator.exe solana-release/bin/solana-bench-exchange.exe
fi
if $maybeCUDA; then
# Wrap `solana-validator-cuda` with a script that loads perf-libs
# automatically
cp -a target/perf-libs solana-release/target/
mkdir solana-release/.bin
cp solana-release-cuda/bin/solana-validator solana-release/.bin/solana-validator-cuda
cat > solana-release/bin/solana-validator-cuda <<'EOF'
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"/..
source target/perf-libs/env.sh
if [[ -z $SOLANA_PERF_LIBS_CUDA ]]; then
echo
echo Error: CUDA not available
exit 1
fi
exec .bin/solana-validator-cuda "$@"
EOF
chmod +x solana-release/bin/solana-validator-cuda
fi
# TODO: Remove scripts/ and multinode/... from tarball
cp -a scripts multinode-demo solana-release/
# Add a wrapper script for validator.sh
# TODO: Remove multinode/... from tarball
cat > solana-release/bin/validator.sh <<'EOF'
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"/..
export USE_INSTALL=1
export REQUIRE_LEDGER_DIR=1
export REQUIRE_KEYPAIRS=1
exec multinode-demo/validator.sh "$@"
EOF
chmod +x solana-release/bin/validator.sh
tar cvf solana-release-$TARGET.tar solana-release
bzip2 solana-release-$TARGET.tar
cp solana-release/bin/solana-install-init solana-install-init-$TARGET
cp solana-release/version.yml solana-release-$TARGET.yml
)
# Metrics tarball is platform agnostic, only publish it from Linux
MAYBE_METRICS_TARBALL=
if [[ "$CI_OS_NAME" = linux ]]; then
metrics/create-metrics-tarball.sh
MAYBE_METRICS_TARBALL=solana-metrics.tar.bz2
fi
source ci/upload-ci-artifact.sh
for file in solana-release-$TARGET.tar.bz2 solana-release-$TARGET.yml solana-install-init-"$TARGET"* $MAYBE_METRICS_TARBALL; do
upload-ci-artifact "$file"
if [[ -n $DO_NOT_PUBLISH_TAR ]]; then
echo "Skipped $file due to DO_NOT_PUBLISH_TAR"
continue
fi
if [[ -n $BUILDKITE ]]; then
echo --- AWS S3 Store: "$file"
(
set -x
$DRYRUN docker run \
--rm \
--env AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY \
--volume "$PWD:/solana" \
eremite/aws-cli:2018.12.18 \
/usr/bin/s3cmd --acl-public put /solana/"$file" s3://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
echo Published to:
$DRYRUN ci/format-url.sh http://release.solana.com/"$CHANNEL_OR_TAG"/"$file"
)
if [[ -n $TAG ]]; then
ci/upload-github-release-asset.sh "$file"
fi
elif [[ -n $TRAVIS ]]; then
# .travis.yml uploads everything in the travis-s3-upload/ directory to release.solana.com
mkdir -p travis-s3-upload/"$CHANNEL_OR_TAG"
cp -v "$file" travis-s3-upload/"$CHANNEL_OR_TAG"/
if [[ -n $TAG ]]; then
# .travis.yaml uploads everything in the travis-release-upload/ directory to
# the associated Github Release
mkdir -p travis-release-upload/
cp -v "$file" travis-release-upload/
fi
elif [[ -n $APPVEYOR ]]; then
# Add artifacts for .appveyor.yml to upload
appveyor PushArtifact "$file" -FileName "$CHANNEL_OR_TAG"/"$file"
fi
done
echo --- ok