Unverified Commit 246de077 authored by Omkar Salpekar's avatar Omkar Salpekar Committed by GitHub
Browse files

[Nova] Migrate Linux CPU job to Generic Job (#6797)

* [Nova] Migrate Linux CPU job to Generic Job

* branch ref for composite action job

* move checkout step to separate job

* added runs-on

* nit fixes

* no need to run conda sheel script thing

* Channel is set inside the script

* add remaining env vars

* nit env var fix

* cleanup

* simplify unneeded jobs

* name of the conda env should be the path

* remove main ref to use PR
parent 211563fb
...@@ -14,57 +14,44 @@ env: ...@@ -14,57 +14,44 @@ env:
jobs: jobs:
tests: tests:
name: "Unit-tests on Linux CPU"
runs-on: [self-hosted, linux.12xlarge]
container:
image: pytorch/conda-builder:cpu
strategy: strategy:
matrix: matrix:
py_vers: ["3.7", "3.8", "3.9", "3.10"] py_vers: ["3.7", "3.8", "3.9", "3.10"]
fail-fast: false fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
runner: linux.12xlarge
repository: pytorch/vision
script: |
# Mark Build Directory Safe
git config --global --add safe.directory /__w/vision/vision
steps: # Set up Environment Variables
- name: Checkout repository export PYTHON_VERSION="${{ matrix.py_vers }}"
uses: actions/checkout@v2 export VERSION="cpu"
- name: Set Release CHANNEL (for release) export CUDATOOLKIT="cpuonly"
if: ${{ (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release')) || startsWith(github.ref, 'refs/heads/release') }}
run: | # Set CHANNEL
echo "CHANNEL=test" >> "$GITHUB_ENV" if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
- name: Setup Conda export CHANNEL=test
shell: bash -l {0} else
env: export CHANNEL=nightly
ENV_NAME: conda-env-${{ github.run_id }} fi
PY_VERS: ${{ matrix.py_vers }}
run: | # Create Conda Env
git config --global --add safe.directory /__w/vision/vision conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy
. ~/miniconda3/etc/profile.d/conda.sh conda activate /work/ci_env
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg scipy
echo "CONDA_RUN=conda run -p ${ENV_NAME}" >> "$GITHUB_ENV" # Install PyTorch, Torchvision, and testing libraries
- name: Install TorchVision set -ex
shell: bash -l {0} conda install \
env: --yes \
VERSION: cpu -c "pytorch-${CHANNEL}" \
CUDATOOLKIT: cpuonly -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \
run: | "${CUDATOOLKIT}"
# Needed for JPEG library detection as setup.py detects conda presence python3 setup.py develop
# by running `shutil.which('conda')` python3 -m pip install pytest pytest-mock 'av<10'
export PATH=~/miniconda3/bin:$PATH
set -ex # Run Tests
${CONDA_RUN} conda install \ python3 -m torch.utils.collect_env
--yes \ python3 -m pytest --junitxml=test-results/junit.xml -v --durations 20
-c "pytorch-${CHANNEL}" \
-c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \
"${CUDATOOLKIT}"
${CONDA_RUN} python3 setup.py develop
${CONDA_RUN} python3 -m pip install pytest pytest-mock 'av<10'
- name: Run tests
shell: bash -l {0}
env:
ENV_NAME: conda-env-${{ github.run_id }}
PY_VERS: ${{ matrix.py_vers }}
run: |
. ~/miniconda3/etc/profile.d/conda.sh
set -ex
${CONDA_RUN} python3 -m torch.utils.collect_env
${CONDA_RUN} python3 -m pytest --junitxml=test-results/junit.xml -v --durations 20
conda env remove -p ${ENV_NAME}
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