forked from secretflow/spu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_and_packaging.sh
executable file
·55 lines (44 loc) · 1.27 KB
/
build_and_packaging.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
#! /bin/bash
RED='\033[0;31m'
NC='\033[0m'
function build_spu(){
echo -e "${RED}Start build wheel package...${NC}"
docker run --rm --mount type=bind,source="$(pwd)",target=/home/admin/dev/ \
-w /home/admin/dev \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
--cap-add=NET_ADMIN \
--privileged=true \
--entrypoint "./build_wheel_entrypoint.sh" \
registry.hub.docker.com/secretflow/spu-gcc11-anolis-dev:latest
(($? != 0)) && { echo -e "${RED}Build exited with non-zero.${NC}"; exit 1; }
spu_wheel_name=$(<./spu_wheel.name)
spu_wheel_path="./${spu_wheel_name//sf-spu/sf_spu}"
}
function install_spu(){
echo -e "${RED}Installing $spu_wheel_path...${NC}"
python3 -m pip install $spu_wheel_path --force-reinstall
}
function upload_spu(){
echo -e "${RED}Uploading package $spu_wheel_path to pypi...${NC}"
twine upload -r pypi $spu_wheel_path
}
iflag=
uflag=
while getopts iu name
do
case $name in
i) iflag=1;;
u) uflag=1;;
?) printf "Usage: %s: [-i] [-u]\n" $0
echo "-i build and install locally."
echo "-u build and upload to pypi."
exit 2;;
esac
done
build_spu
if [ ! -z "$iflag" ]; then
install_spu
fi
if [ ! -z "$uflag" ]; then
upload_spu
fi