|
14 | 14 |
|
15 | 15 | jobs:
|
16 | 16 | tests:
|
17 |
| - name: "Unit-tests on Linux CPU" |
18 |
| - runs-on: [self-hosted, linux.12xlarge] |
19 |
| - container: |
20 |
| - image: pytorch/conda-builder:cpu |
21 | 17 | strategy:
|
22 | 18 | matrix:
|
23 | 19 | py_vers: ["3.7", "3.8", "3.9", "3.10"]
|
24 | 20 | fail-fast: false
|
| 21 | + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main |
| 22 | + with: |
| 23 | + runner: linux.12xlarge |
| 24 | + repository: pytorch/vision |
| 25 | + script: | |
| 26 | + # Mark Build Directory Safe |
| 27 | + git config --global --add safe.directory /__w/vision/vision |
25 | 28 |
|
26 |
| - steps: |
27 |
| - - name: Checkout repository |
28 |
| - uses: actions/checkout@v2 |
29 |
| - - name: Set Release CHANNEL (for release) |
30 |
| - if: ${{ (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release')) || startsWith(github.ref, 'refs/heads/release') }} |
31 |
| - run: | |
32 |
| - echo "CHANNEL=test" >> "$GITHUB_ENV" |
33 |
| - - name: Setup Conda |
34 |
| - shell: bash -l {0} |
35 |
| - env: |
36 |
| - ENV_NAME: conda-env-${{ github.run_id }} |
37 |
| - PY_VERS: ${{ matrix.py_vers }} |
38 |
| - run: | |
39 |
| - git config --global --add safe.directory /__w/vision/vision |
40 |
| - . ~/miniconda3/etc/profile.d/conda.sh |
41 |
| - conda create -yp ${ENV_NAME} python=${PY_VERS} numpy libpng jpeg scipy |
42 |
| - echo "CONDA_RUN=conda run -p ${ENV_NAME}" >> "$GITHUB_ENV" |
43 |
| - - name: Install TorchVision |
44 |
| - shell: bash -l {0} |
45 |
| - env: |
46 |
| - VERSION: cpu |
47 |
| - CUDATOOLKIT: cpuonly |
48 |
| - run: | |
49 |
| - # Needed for JPEG library detection as setup.py detects conda presence |
50 |
| - # by running `shutil.which('conda')` |
51 |
| - export PATH=~/miniconda3/bin:$PATH |
52 |
| - set -ex |
53 |
| - ${CONDA_RUN} conda install \ |
54 |
| - --yes \ |
55 |
| - -c "pytorch-${CHANNEL}" \ |
56 |
| - -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \ |
57 |
| - "${CUDATOOLKIT}" |
58 |
| - ${CONDA_RUN} python3 setup.py develop |
59 |
| - ${CONDA_RUN} python3 -m pip install pytest pytest-mock 'av<10' |
60 |
| - - name: Run tests |
61 |
| - shell: bash -l {0} |
62 |
| - env: |
63 |
| - ENV_NAME: conda-env-${{ github.run_id }} |
64 |
| - PY_VERS: ${{ matrix.py_vers }} |
65 |
| - run: | |
66 |
| - . ~/miniconda3/etc/profile.d/conda.sh |
67 |
| - set -ex |
68 |
| - ${CONDA_RUN} python3 -m torch.utils.collect_env |
69 |
| - ${CONDA_RUN} python3 -m pytest --junitxml=test-results/junit.xml -v --durations 20 |
70 |
| - conda env remove -p ${ENV_NAME} |
| 29 | + # Set up Environment Variables |
| 30 | + export PYTHON_VERSION="${{ matrix.py_vers }}" |
| 31 | + export VERSION="cpu" |
| 32 | + export CUDATOOLKIT="cpuonly" |
| 33 | +
|
| 34 | + # Set CHANNEL |
| 35 | + if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then |
| 36 | + export CHANNEL=test |
| 37 | + else |
| 38 | + export CHANNEL=nightly |
| 39 | + fi |
| 40 | +
|
| 41 | + # Create Conda Env |
| 42 | + conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy |
| 43 | + conda activate /work/ci_env |
| 44 | + |
| 45 | + # Install PyTorch, Torchvision, and testing libraries |
| 46 | + set -ex |
| 47 | + conda install \ |
| 48 | + --yes \ |
| 49 | + -c "pytorch-${CHANNEL}" \ |
| 50 | + -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \ |
| 51 | + "${CUDATOOLKIT}" |
| 52 | + python3 setup.py develop |
| 53 | + python3 -m pip install pytest pytest-mock 'av<10' |
| 54 | +
|
| 55 | + # Run Tests |
| 56 | + python3 -m torch.utils.collect_env |
| 57 | + python3 -m pytest --junitxml=test-results/junit.xml -v --durations 20 |
0 commit comments