-
Notifications
You must be signed in to change notification settings - Fork 324
/
travis-main.sh
executable file
·102 lines (82 loc) · 3.1 KB
/
travis-main.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
#!/usr/bin/env bash
set -e
if [[ "$TRAVIS_COMMIT_MESSAGE" == *"Travis build:"* ]]; then
echo "This is an auto commit from travis. Not doing anything."
exit 0
fi
# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//[email protected]:}
SHA=`git rev-parse --verify HEAD`
# Importing necessary python libraries
echo "Updating Dependencies..."
npm install
sudo apt-get install python3-pandas
sudo apt install python3-pip
pip3 install --upgrade setuptools
pip3 install -r visualization/requirements.txt
# Validate the data
source ./travis/validate-data.sh
# Do not run builds on branches outside of master
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "Not on master. Not doing anything else."
exit 0
fi
# Update the truth data
if [[ "$TRAVIS_EVENT_TYPE" == *"cron"* || "$TRAVIS_COMMIT_MESSAGE" == *"FORCE_ZOLTAR"* ]]; then
echo "updating truth data..."
bash ./travis/update-truth.sh
echo "Upload truth to Zoltar"
python3 ./code/zoltar_scripts/upload_truth_to_zoltar.py
# Upload to zoltar at every merged pull request
echo "Upload forecasts to Zoltar "
bash ./travis/upload-to-zoltar.sh
# Replace the validated_files.csv with locally_validated_files.csv at every build except PRs
echo "replacing validated files"
cp ./code/validation/locally_validated_files.csv ./code/validation/validated_files.csv
echo "Merge detected.. push to github"
bash ./travis/push.sh
fi
# Upload to zoltar at every merged pull request
# if [[ "$TRAVIS_COMMIT_MESSAGE" == *"Merge pull request"* ]]; then
# echo "Upload forecasts to Zoltar "
# bash ./travis/upload-to-zoltar.sh
# fi
# Replace the validated_files.csv with locally_validated_files.csv at every build except PRs
# if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
# echo "replacing validated files"
# cp ./code/validation/locally_validated_files.csv ./code/validation/validated_files.csv
# echo "Merge detected.. push to github"
# bash ./travis/push.sh
# fi
## Automatically deploy visualization.
## TODO - This code does not work yet
# if [[ "$TRAVIS_COMMIT_MESSAGE" == *"trigger build"* ]]; then
# source ./travis/vis-deploy.sh
# fi
#
# Functions below are for testing purposes
if [[ "$TRAVIS_COMMIT_MESSAGE" == *"test truth"* ]]; then
echo "updating truth data..."
bash ./travis/update-truth.sh
echo "Push the truth"
bash ./travis/push.sh
echo "Upload truth to Zoltar"
python3 ./code/zoltar_scripts/upload_truth_to_zoltar.py
fi
if [[ "$TRAVIS_COMMIT_MESSAGE" == *"test zoltar upload"* ]]; then
echo "Upload forecasts to Zoltar"
bash ./travis/upload-to-zoltar.sh
echo "Push validated file db to GitHub"
bash ./travis/push.sh
fi
if [[ "$TRAVIS_COMMIT_MESSAGE" == *"test truth zoltar"* ]]; then
echo "Upload truth to Zoltar"
python3 ./code/zoltar_scripts/upload_truth_to_zoltar.py
fi
if [[ "$TRAVIS_COMMIT_MESSAGE" == *"create zoltar validated file"* ]]; then
echo "Create new validated zoltar forecast list"
bash ./travis/create-validated-file-db.sh
echo "Push the validated file db to Zoltar"
bash ./travis/push.sh
fi