forked from airbnb/chronon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·63 lines (51 loc) · 1.94 KB
/
build.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
#!/bin/bash
# Builds a tar file with
# 1. Chronon spark jar that can drive all workflows
# 2. Chronon doc site
# 3. Test repo that can be used by init
set -euxo pipefail
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$BRANCH" != "main" ]]; then
echo "$(tput bold) You are not on main branch!"
echo "$(tput sgr0) Are you sure you want to release? (y to continue)"
read response
if [[ "$response" != "y" ]]; then
echo "Not releasing then. Wise choice."
exit 0
fi
fi
thrift --gen py -out api/py/ai/chronon api/thrift/api.thrift
DOC_BUILD=docs/build
VIRTUAL_ENV=${DOC_BUILD}/sphinx
# Cleanup old artifacts
rm -rf ${DOC_BUILD}
# Setup Virtualenv for Sphinx with all its dependencies
virtualenv ${VIRTUAL_ENV}
source ${VIRTUAL_ENV}/bin/activate
pip install -r docs/sphinx-requirements.txt
# Install the repo's Chronon python API
rm -rf api/py/dist/
python -m build api/py
pip install api/py/dist/chronon-ai*.tar.gz
# Run the Sphinx build
${VIRTUAL_ENV}/bin/sphinx-build -b html docs/source/ ${DOC_BUILD}/html
# Exit the virtualenv
deactivate
sbt +spark_uber/assembly
SBT_JAR_11=$(ls -rt spark/target/scala-2.11/ | grep ".*uber-assembly.*\.jar$" |tail -n 1 | awk '{print $(NF)}')
SBT_JAR_12=$(ls -rt spark/target/scala-2.12/ | grep ".*uber-assembly.*\.jar$" |tail -n 1 | awk '{print $(NF)}')
SBT_JAR_13=$(ls -rt spark/target/scala-2.13/ | grep ".*uber-assembly.*\.jar$" |tail -n 1 | awk '{print $(NF)}')
rm -rf releases
mkdir releases
mkdir -p releases/jar_scala_11
mkdir -p releases/jar_scala_12
mkdir -p releases/jar_scala_13
mv ${DOC_BUILD}/html/* releases/
tar -zcf releases/repo.tar.gz -C api/py/test/sample .
mv "spark/target/scala-2.11/${SBT_JAR_11}" releases/jar_scala_11/
mv "spark/target/scala-2.12/${SBT_JAR_12}" releases/jar_scala_12/
mv "spark/target/scala-2.13/${SBT_JAR_13}" releases/jar_scala_13/
cp init.sh releases/init.sh
cp docker-compose.yml releases/docker-compose.yml
echo "Wrote release artifacts into ./releases"
tree -L 1 releases