-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfetch.sh
More file actions
57 lines (47 loc) · 1.34 KB
/
fetch.sh
File metadata and controls
57 lines (47 loc) · 1.34 KB
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
set -euo pipefail
# Time of run (GMT)
date
# Time run, California time.
TZ=America/Los_Angeles date
PYTHONPATH=$PWD:$PWD/webpage
# Dump environment info, for troubleshooting.
echo PYTHONPATH: $PYTHONPATH
echo PWD: $PWD
python3 --version
if [[ $HOSTNAME == *"MacBook-Pro.local" ]]
then
echo "Don't run this on local machine! Only github."
exit 1
fi
# Set up enough info that we can do a push back to the repository.
git config user.name "FireData Action Bot"
git config user.email "<>"
python3 -m pip install BeautifulSoup4
# Fetch the new day's fire data into the data directories.
python3 get_all_fire_data.py
# Add and commit the new data
git add data
# If there is no new data, git commit returns non-zero, so turn of checking.
set +e
git commit -m "Automatic add of new fire data"
set -e
# Build and commit the webpage.
python3 -m webpage.create_webpage_multi
cp docs/fire_ca_2021.html docs/index.html
git add docs
set +e
git commit -m "Add newly generated web page"
set -e
# Push all changes
git push
## Run code coverage and check in the percentage.
#python3 -m pip install coverage
#python3 -m pip install pytest
#coverage run --branch -m pytest
#coverage report -m > coverage.txt
#cat coverage.txt
#python3 make_badge.py
#git add code-coverage.txt
#git commit code-coverage.txt -m "Autogenerated code coverage for badge."
#git push
echo "Done."