forked from sfu-db/dataprep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
136 lines (96 loc) · 3.64 KB
/
Justfile
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
#### Documentations ####
doc-clean-notebooks:
fd ".*\.ipynb" -t f docs/source/ -x jupyter nbconvert --clear-output
build-docs:
poetry run sphinx-build -M html docs/source docs/build
publish-docs: build-docs
touch docs/build/html/.nojekyll
gh-pages --dotfiles --message "[skip ci] Updates" --dist docs/build/html
gen-apidocs:
poetry run sphinx-apidoc --ext-doctest --ext-autodoc --ext-mathjax -f -o docs/source dataprep
#### CI ####
black:
poetry run black dataprep
ci: format ci-black typeck test lint
ci-black:
poetry run black --check --quiet dataprep
format:
poetry run black dataprep
typeck: ci-mypy
test +ARGS="":
poetry run pytest dataprep/tests {{ARGS}}
testf +ARGS="dataprep":
poetry run pytest {{ARGS}}
lint:
poetry run pylint dataprep
ci-mypy:
poetry run mypy dataprep
build:
poetry build
release version:
#! /usr/bin/env bash
# Sanity checks
arr=(major minor patch)
if [[ " ${arr[*]} " != *" {{version}} "* ]]; then
echo "version must be one of 'major', 'minor', 'patch', got '{{version}}'";
exit 1;
fi
if [ ! -z "$(git status --porcelain)" ]; then echo "Git tree is not clean, commit first"; exit 1; fi
if [ ! -z "$(git rev-parse --verify release)" ]; then echo "delete the existing release branch before new release"; exit 1; fi
# Pre bump the version to get the next version number
git checkout develop
vstring="$(poetry version {{version}})"
if [ $? -ne 0 ]; then
echo $vstring;
exit 1;
fi
from_version=$(echo "${vstring}" | sed -nr "s/^Bumping version from ([0-9]+\.[0-9]+\.[0-9]+) to ([0-9]+\.[0-9]+\.[0-9]+)$/\1/p")
to_version=$(echo "${vstring}" | sed -nr "s/^Bumping version from ([0-9]+\.[0-9]+\.[0-9]+) to ([0-9]+\.[0-9]+\.[0-9]+)$/\2/p")
git checkout pyproject.toml # clean up
echo "Releasing from ${from_version} to ${to_version}?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) git checkout pyproject.toml; git checkout develop; git branch -D release; exit;;
esac
done
echo ================ Release Note ================
poetry run python scripts/release-note.py $(git rev-parse develop)
echo ================ Release Note ================
echo
echo Does release note looks good?
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit;;
esac
done
# Begin of the real stuff!
# Create new release branch
git checkout -b "release/v${to_version}" develop
poetry version {{version}}
echo "Creating release commit"
git add pyproject.toml
poetry run semantic-release version --{{version}}
# echo "Merge release/v${to_version} to master & develop"
# git checkout master
# git merge "release/v${to_version}"
# git checkout develop
# git merge "release/v${to_version}"
echo "Push branch and tag to remote"
git push origin "release/v${to_version}":master
git push origin "release/v${to_version}":develop
git push origin "release/v${to_version}"
git push origin "v${to_version}"
echo "Build artifacts"
poetry build
echo "Creating release draft"
poetry run python scripts/release-note.py $(git rev-parse release/v${to_version}^) | sed "1iv${to_version}\n" | hub release create -d -a "dist/dataprep-${to_version}-py3-none-any.whl" -a "dist/dataprep-${to_version}.tar.gz" -F - "v${to_version}"
@ensure-git-clean:
if [ ! -z "$(git status --porcelain)" ]; then echo "Git tree is not clean, commit first"; exit 1; fi
@release-note hash="":
echo ================ Release Note ================
poetry run python scripts/release-note.py {{hash}}
echo ================ Release Note ================
setuppy:
python scripts/gen-setup.py