-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_script.sh
executable file
·48 lines (31 loc) · 1.19 KB
/
build_script.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
#!/bin/bash
PYTHON_PATH=$(which python)
CUR_DIR=$(pwd)
cd "./price_indices" || exit
notebooks=(./price_indices.ipynb)
# Path to the custom nbconvert configuration file
NB_CONVERT_CONFIG="./nbconvert_conf.py"
for notebook in "${notebooks[@]}"; do
# Use the custom nbconvert configuration file
echo -e "Converting Notebook File $notebook\n---"
"$PYTHON_PATH" -m nbconvert --to script --config "$NB_CONVERT_CONFIG" "$notebook"
# Remove the .ipynb extension to get the base name
mod_name="${notebook%.ipynb}"
script_name="$mod_name.py"
# Format the script with Black
echo -e "Starting Auto Formatting\n---"
"$PYTHON_PATH" -m black "$script_name"
# Check types with mypy
echo -e "Starting static Type Checks\n---"
"$PYTHON_PATH" -m mypy "$script_name"
# run the tests
echo -e "Starting Unit Tests\n---"
"$PYTHON_PATH" ../tests/test_price_indices.py
done
cd "$CUR_DIR" || exit
echo -e "Building Sphinx Documentation\n---"
sphinx-build -b html sphinx-source/ docs/
# make html
touch docs/.nojekyll
git add docs/.nojekyll ; git commit -m "Disable Jekyll processing"
git add * ; git commit -m "Executed CI Script" ; git push origin main