-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre_commit.sh
More file actions
54 lines (47 loc) · 1.65 KB
/
Copy pathpre_commit.sh
File metadata and controls
54 lines (47 loc) · 1.65 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
#!/usr/bin/env bash
# 'set -e' stops the execution of a script if a command or pipeline has an error.
# This is the opposite of the default shell behaviour, which is to ignore errors in scripts.
set -e
clean_docs() {
# Clean up docs directory keeping the CNAME file if present
directory="docs"
file_to_keep="CNAME"
if [ -e "${directory}/${file_to_keep}" ]; then
find "${directory}" -mindepth 1 ! -name "${file_to_keep}" -exec rm -rf {} +
else
find "${directory}" -mindepth 1 -exec rm -rf {} +
fi
}
update_release_notes() {
# Update release notes
gitverse-release reverse -f release_notes.rst -t 'Release Notes'
}
gen_docs() {
# Generate sphinx docs
# Generated from: `openssl rand -base64 32`
export secret="lUGou1zjhMA89qxRYPuawD5juHdVRreU3mEhSwFaDso="
# Generated from: https://www.lastpass.com/features/password-generator
export apikey="AENmsKfo5YXP5w_FmVKwCkNCqt92YGAU"
mkdir -p doc_gen/_static # Create a _static directory if unavailable
cp README.md doc_gen # Copy readme file to doc_gen
cd doc_gen && make clean html # cd into doc_gen and create the runbook
mv _build/html/* ../docs && mv README.md ../docs # Move the runbook and readme
cp static.css ../docs/_static
}
run_pytest() {
# Run pytest
export PYTHONWARNINGS="ignore::DeprecationWarning"
python -m pytest
}
if [ "$GITHUB_ACTIONS" = "true" ]; then
echo "Running in GitHub Actions"
else
clean_docs &
gen_docs &
update_release_notes &
#run_pytest &
wait
# The existence of this file tells GitHub Pages not to run the published files through Jekyll.
# This is important since Jekyll will discard any files that begin with _
touch docs/.nojekyll
fi