Unverified Commit e1c50d9c authored by guyang3532's avatar guyang3532 Committed by GitHub
Browse files

Add smoke test for CI (#2437)

parent 8b029651
This diff is collapsed.
......@@ -64,6 +64,7 @@ binary_common: &binary_common
cu_version:
description: "CUDA version to build against, in CU format (e.g., cpu or cu100)"
type: string
default: "cpu"
unicode_abi:
description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)"
type: string
......@@ -78,6 +79,11 @@ binary_common: &binary_common
UNICODE_ABI: << parameters.unicode_abi >>
CU_VERSION: << parameters.cu_version >>
smoke_test_common: &smoke_test_common
<<: *binary_common
docker:
- image: torchvision/smoke_test:latest
jobs:
circleci_consistency:
docker:
......@@ -288,6 +294,109 @@ jobs:
aws s3 cp "$pkg" "s3://pytorch/whl/${UPLOAD_CHANNEL}/<< parameters.subfolder >>" --acl public-read
done
smoke_test_linux_conda:
<<: *smoke_test_common
steps:
- attach_workspace:
at: ~/workspace
- run:
name: install binaries
command: |
set -x
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
conda install -v -y -c pytorch-nightly pytorch
conda install -v -y $(ls ~/workspace/torchvision*.tar.bz2)
- run:
name: smoke test
command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
python -c "import torchvision"
smoke_test_linux_pip:
<<: *smoke_test_common
steps:
- attach_workspace:
at: ~/workspace
- run:
name: install binaries
command: |
set -x
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
pip install $(ls ~/workspace/torchvision*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
- run:
name: smoke test
command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
python -c "import torchvision"
smoke_test_docker_image_build:
machine:
image: ubuntu-1604:201903-01
resource_class: large
environment:
image_name: torchvision/smoke_test
steps:
- checkout
- run:
name: Build and push Docker image
no_output_timeout: "1h"
command: |
set +x
echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin
set -x
cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID}
docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest
docker push ${image_name}:${CIRCLE_WORKFLOW_ID}
docker push ${image_name}:latest
smoke_test_win_conda:
<<: *binary_common
executor:
name: windows-cpu
steps:
- attach_workspace:
at: ~/workspace
- run:
name: install binaries
command: |
set -x
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda env remove -n python${PYTHON_VERSION} || true
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION}
conda install Pillow
conda install -v -y -c pytorch-nightly pytorch
conda install -v -y $(ls ~/workspace/torchvision*.tar.bz2)
- run:
name: smoke test
command: |
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate python${PYTHON_VERSION}
python -c "import torchvision"
smoke_test_win_pip:
<<: *binary_common
executor:
name: windows-cpu
steps:
- attach_workspace:
at: ~/workspace
- run:
name: install binaries
command: |
set -x
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda env remove -n python${PYTHON_VERSION} || true
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION}
pip install $(ls ~/workspace/torchvision*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
- run:
name: smoke test
command: |
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate python${PYTHON_VERSION}
python -c "import torchvision"
unittest_linux_cpu:
<<: *binary_common
docker:
......@@ -463,3 +572,14 @@ workflows:
- python_type_check
- clang_format
{{ build_workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
docker_build:
triggers:
- schedule:
cron: "0 10 * * 0"
filters:
branches:
only:
- master
jobs:
- smoke_test_docker_image_build:
context: org-member
......@@ -55,6 +55,9 @@ def workflow_pair(btype, os_type, python_version, cu_version, unicode, prefix=''
if upload:
w.append(generate_upload_workflow(base_workflow_name, os_type, btype, cu_version, filter_branch=filter_branch))
if filter_branch == 'nightly' and os_type in ['linux', 'win']:
pydistro = 'pip' if btype == 'wheel' else 'conda'
w.append(generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, python_version, os_type))
return w
......@@ -133,6 +136,24 @@ def generate_upload_workflow(base_workflow_name, os_type, btype, cu_version, *,
return {f"binary_{btype}_upload": d}
def generate_smoketest_workflow(pydistro, base_workflow_name, filter_branch, python_version, os_type):
required_build_suffix = "_upload"
required_build_name = base_workflow_name + required_build_suffix
smoke_suffix = f"smoke_test_{pydistro}"
d = {
"name": f"{base_workflow_name}_{smoke_suffix}",
"requires": [required_build_name],
"python_version": python_version,
}
if filter_branch:
d["filters"] = gen_filter_branch_tree(filter_branch)
return {"smoke_test_{os_type}_{pydistro}".format(os_type=os_type, pydistro=pydistro): d}
def indent(indentation, data_list):
return ("\n" + " " * indentation).join(
yaml.dump(data_list, default_flow_style=False).splitlines())
......
# this Dockerfile is for torchvision smoke test, it will be created periodically via CI system
# if you need to do it locally, follow below steps once you have Docker installed
# assuming you're within the directory where this Dockerfile located
# $ docker build . -t torchvision/smoketest
# if you want to push to aws ecr, make sure you have the rights to write to ECR, then run
# $ eval $(aws ecr get-login --region us-east-1 --no-include-email)
# $ export MYTAG=localbuild ## you can choose whatever tag you like
# $ docker tag torchvision/smoketest 308535385114.dkr.ecr.us-east-1.amazonaws.com/torchvision/smoke_test:${MYTAG}
# $ docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/torchvision/smoke_test:${MYTAG}
FROM ubuntu:latest
RUN apt-get -qq update && apt-get -qq -y install curl bzip2 libsox-fmt-all \
&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -bfp /usr/local \
&& rm -rf /tmp/miniconda.sh \
&& conda install -y python=3 \
&& conda update conda \
&& apt-get -qq -y remove curl bzip2 \
&& apt-get -qq -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
&& conda clean --all --yes
ENV PATH /opt/conda/bin:$PATH
RUN conda create -y --name python3.6 python=3.6
RUN conda create -y --name python3.7 python=3.7
RUN conda create -y --name python3.8 python=3.8
SHELL [ "/bin/bash", "-c" ]
RUN echo "source /usr/local/etc/profile.d/conda.sh" >> ~/.bashrc
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.6 && conda install -y numpy Pillow
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.7 && conda install -y numpy Pillow
RUN source /usr/local/etc/profile.d/conda.sh && conda activate python3.8 && conda install -y numpy Pillow
CMD [ "/bin/bash"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment