-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate_package.sh
executable file
·155 lines (137 loc) · 3.74 KB
/
update_package.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
#!/bin/bash
# Define the new version and commit/release messages
new_version="v0.1.12" # Replace with the actual version number
commit_message="Bump to $new_version" # Replace with the actual commit message
release_message="Release $new_version" # Replace with the actual release message
# Update version in pyproject.toml
echo "Updating version in pyproject.toml to $new_version..."
sed -i '' "s/^version = \".*\"/version = \"$new_version\"/" pyproject.toml
if [ $? -ne 0 ]; then
echo "Error updating version in pyproject.toml"
exit 1
fi
# Update version in __init__.py
echo "Updating version in __init__.py to $new_version..."
sed -i '' "s/__version__ = \".*\"/__version__ = \"${new_version#v}\"/" pyaging/__init__.py
if [ $? -ne 0 ]; then
echo "Error updating version in __init__.py"
exit 1
fi
# Run ruff for linting
echo "Running ruff for linting..."
ruff check pyaging --fix
# Run black for code formatting
echo "Running ruff for code formatting..."
ruff format pyaging
if [ $? -ne 0 ]; then
echo "ruff formatting failed"
exit 1
fi
# Run poetry update
echo "Running poetry update..."
poetry update
if [ $? -ne 0 ]; then
echo "Poetry update failed"
exit 1
fi
# Build the package
echo "Building the package..."
poetry build
if [ $? -ne 0 ]; then
echo "Poetry build failed"
exit 1
fi
# Install the package
echo "Installing the package..."
poetry install
if [ $? -ne 0 ]; then
echo "Poetry install failed"
exit 1
fi
# Update clocks and notebooks in the 'clocks/notebooks' directory
#echo "Updating clocks and notebooks..."
#cd clocks/notebooks
#total=$(ls *.ipynb | wc -l)
#counter=1
#for notebook in *.ipynb; do
# # Skip the file if it is 'template.ipynb'
# if [ "$notebook" = "template.ipynb" ]; then
# echo "Skipping template.ipynb"
# continue
# fi
#
# echo "Processing clock notebook ($counter/$total): $notebook"
# #jupyter nbconvert --to notebook --execute "$notebook" #Change
# jupyter nbconvert --execute --inplace "$notebook" # Execute in place
# if [ $? -ne 0 ]; then
# echo "Error processing $notebook"
# exit 1
# fi
# let counter=counter+1
#done
#cd ../..
# Run the script to update all clocks
#echo "Running script to update all clocks..."
#cd clocks
#python3 update_all_clocks.py $new_version
#if [ $? -ne 0 ]; then
# echo "Updating clocks failed"
# exit 1
#fi
#cd ..
#echo "Reminder: Upload all clocks and metadata to S3!"
# Process tutorials
#echo "Processing tutorials..."
#cd tutorials
#for notebook in *.ipynb; do
# echo "Processing tutorial notebook: $notebook"
# jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute --inplace "$notebook"
#done
#cd ..
# Run gold standard tests
echo "Running gold standard tests..."
poetry run pytest
if [ $? -ne 0 ]; then
echo "Gold standard tests failed"
exit 1
fi
# Run tutorial tests
echo "Running tutorial tests..."
poetry run pytest --nbmake tutorials/
if [ $? -ne 0 ]; then
echo "Tutorial tests failed"
exit 1
fi
# Build documentation
echo "Building documentation..."
cp tutorials/*.ipynb docs/source/tutorials
cp clocks/notebooks/*.ipynb docs/source/clock_notebooks
cd docs
make html
if [ $? -ne 0 ]; then
echo "Documentation build failed"
exit 1
fi
cd ..
# Commit and push changes
echo "Committing and pushing changes..."
git add .
git commit -m "$commit_message"
if [ $? -ne 0 ]; then
echo "Git commit failed"
exit 1
fi
git push
if [ $? -ne 0 ]; then
echo "Git push failed"
exit 1
fi
# Create and push tag
echo "Creating and pushing tag $new_version..."
git tag -a "$new_version" -m "$release_message"
git push origin "$new_version"
if [ $? -ne 0 ]; then
echo "Git tag creation or push failed"
exit 1
fi
echo "Version update pipeline completed successfully."