|
| 1 | +name: Wheels |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, synchronize, reopened] |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - release/0.0.1 |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + build-wheel-linux: |
| 12 | + runs-on: ubuntu-18.04 |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python_version: [["3.7", "cp37-cp37m"], ["3.8", "cp38-cp38"], ["3.9", "cp39-cp39"], ["3.10", "cp310-cp310"]] |
| 16 | + cuda_support: [["", "--extra-index-url https://download.pytorch.org/whl/cpu", "\"['cpu', '11.3', '11.6']\"", "cpu"], ["+cu102", "", "\"['10.2']\"", "cuda102"]] |
| 17 | + container: pytorch/manylinux-${{ matrix.cuda_support[3] }} |
| 18 | + steps: |
| 19 | + - name: Checkout torchrl |
| 20 | + uses: actions/checkout@v2 |
| 21 | + - name: Install PyTorch 1.12 RC |
| 22 | + run: | |
| 23 | + export PATH="/opt/python/${{ matrix.python_version[1] }}/bin:$PATH" |
| 24 | + python3 -mpip install torch==1.12 ${{ matrix.cuda_support[1] }} |
| 25 | + python3 -mpip install "git+https://github.com/pytorch/functorch.git@release/0.2" |
| 26 | + - name: Build wheel |
| 27 | + run: | |
| 28 | + export PATH="/opt/python/${{ matrix.python_version[1] }}/bin:$PATH" |
| 29 | + python3 -mpip install wheel |
| 30 | + VERSION_TAG=${{ matrix.cuda_support[0] }} PYTORCH_CUDA_RESTRICTIONS=${{ matrix.cuda_support[2] }} python3 setup.py bdist_wheel |
| 31 | + # NB: wheels have the linux_x86_64 tag so we rename to manylinux1 |
| 32 | + # find . -name 'dist/*whl' -exec bash -c ' mv $0 ${0/linux/manylinux1}' {} \; |
| 33 | + # pytorch/pytorch binaries are also manylinux_2_17 compliant but they |
| 34 | + # pretend that they're manylinux1 compliant so we do the same. |
| 35 | + - name: Show auditwheel output; confirm 2-17 |
| 36 | + run: | |
| 37 | + python3 -mpip install auditwheel |
| 38 | + auditwheel show dist/* |
| 39 | + - name: Upload wheel for the test-wheel job |
| 40 | + uses: actions/upload-artifact@v2 |
| 41 | + with: |
| 42 | + name: torchrl-linux-${{ matrix.python_version[0] }}.whl |
| 43 | + path: dist/torchrl-0.0.1-*.whl |
| 44 | + - name: Upload wheel for download |
| 45 | + uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: torchrl-batch.whl |
| 48 | + path: dist/*.whl |
| 49 | + |
| 50 | + build-wheel-mac: |
| 51 | + runs-on: macos-latest |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + python_version: [["3.7", "3.7"], ["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"]] |
| 55 | + steps: |
| 56 | + - name: Setup Python |
| 57 | + uses: actions/setup-python@v2 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python_version[1] }} |
| 60 | + architecture: x64 |
| 61 | + - name: Checkout torchrl |
| 62 | + uses: actions/checkout@v2 |
| 63 | + - name: Install PyTorch 1.12 RC |
| 64 | + run: | |
| 65 | + python3 -mpip install torch==1.12 --extra-index-url https://download.pytorch.org/whl/cpu |
| 66 | + python3 -mpip install "git+https://github.com/pytorch/functorch.git@release/0.2" |
| 67 | + - name: Build wheel |
| 68 | + run: | |
| 69 | + export CC=clang CXX=clang++ |
| 70 | + python3 -mpip install wheel |
| 71 | + python3 setup.py bdist_wheel |
| 72 | + - name: Upload wheel for the test-wheel job |
| 73 | + uses: actions/upload-artifact@v2 |
| 74 | + with: |
| 75 | + name: torchrl-mac-${{ matrix.python_version[0] }}.whl |
| 76 | + path: dist/*.whl |
| 77 | + - name: Upload wheel for download |
| 78 | + uses: actions/upload-artifact@v2 |
| 79 | + with: |
| 80 | + name: torchrl-batch.whl |
| 81 | + path: dist/*.whl |
| 82 | + |
| 83 | + test-wheel: |
| 84 | + needs: [build-wheel-linux, build-wheel-mac] |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + os: [["linux", "ubuntu-18.04"], ["mac", "macos-latest"]] |
| 88 | + python_version: [ "3.7", "3.8", "3.9", "3.10" ] |
| 89 | + runs-on: ${{ matrix.os[1] }} |
| 90 | + steps: |
| 91 | + - name: Setup Python |
| 92 | + uses: actions/setup-python@v2 |
| 93 | + with: |
| 94 | + python-version: ${{ matrix.python_version }} |
| 95 | + architecture: x64 |
| 96 | + - name: Checkout torchrl |
| 97 | + uses: actions/checkout@v2 |
| 98 | + - name: Install PyTorch 1.12 RC |
| 99 | + run: | |
| 100 | + python3 -mpip install torch==1.12 torchvision --extra-index-url https://download.pytorch.org/whl/cpu |
| 101 | + python3 -mpip install "git+https://github.com/pytorch/functorch.git@release/0.2" |
| 102 | + - name: Upgrade pip |
| 103 | + run: | |
| 104 | + python3 -mpip install --upgrade pip |
| 105 | + - name: Install test dependencies |
| 106 | + run: | |
| 107 | + python3 -mpip install numpy pytest pytest-cov codecov unittest-xml-reporting pillow>=4.1.1 scipy av networkx expecttest pyyaml |
| 108 | + - name: Download built wheels |
| 109 | + uses: actions/download-artifact@v2 |
| 110 | + with: |
| 111 | + name: torchrl-${{ matrix.os[0] }}-${{ matrix.python_version }}.whl |
| 112 | + path: /tmp/wheels |
| 113 | + - name: Install built wheels |
| 114 | + run: | |
| 115 | + python3 -mpip install /tmp/wheels/* |
| 116 | + - name: Log version string |
| 117 | + run: | |
| 118 | + # Avoid ambiguity of "import torchrl" by deleting the source files. |
| 119 | + rm -rf torchrl/ |
| 120 | + python -c "import torchrl; print(torchrl.__version__)" |
| 121 | + - name: Run tests |
| 122 | + run: | |
| 123 | + set -e |
| 124 | + export IN_CI=1 |
| 125 | + mkdir test-reports |
| 126 | + python -m torch.utils.collect_env |
| 127 | + python -c "import torchrl; print(torchrl.__version__)" |
| 128 | + EXIT_STATUS=0 |
| 129 | + pytest test/smoke_test.py -v --durations 20 |
| 130 | + exit $EXIT_STATUS |
0 commit comments