-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathbuild_docker_and_upload_pip.sh
executable file
·51 lines (43 loc) · 1.75 KB
/
build_docker_and_upload_pip.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
#!/bin/bash
# Copyright 2023 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
for i in {10..12}; do
ver=python3.$i
echo Building for $ver
docker build -f Dockerfile -t multidim-op-dev-$ver --build-arg PYTHON_VERSION=$ver . &&
# Remove any existing containers
docker rm multidim-op-dev
# Print the functions within the new Op we just built
docker run --name=multidim-op-dev multidim-op-dev-$ver /bin/bash -c "pip install /augmentation_src/dest/*manylinux* && python -c 'from multidim_image_augmentation import augmentation_ops; from inspect import getmembers, isfunction; print(getmembers(augmentation_ops, isfunction))'" &&
# Copy the wheel and source tarball out of the container
docker cp multidim-op-dev:/augmentation_src/dest/. dest/ &&
# Remove the container
docker rm multidim-op-dev
done
echo Built files:
find dest*/
python3 -m twine check dest/*manylinux*.whl dest/*tar.gz
while true; do
read -p "Do you want to proceed with upload? (y/n) " yn
case $yn in
[yY] ) echo Uploading...;
break;;
[nN] ) echo Exiting...;
exit;;
* ) echo Invalid Entry;;
esac
done
# Upload to PyPi
python3 -m twine upload dest/*manylinux*.whl dest/*tar.gz