Skip to content

Commit 8ee3325

Browse files
[CI] Add Github-Actions workflows for Windows wheels & nightly-build (#837)
Co-authored-by: Yohann Benchetrit <ybenchetrit@meta.com>
1 parent c0bc12a commit 8ee3325

File tree

2 files changed

+198
-0
lines changed

2 files changed

+198
-0
lines changed

.github/workflows/nightly_build.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,112 @@ jobs:
252252
EXIT_STATUS=0
253253
pytest test/smoke_test.py -v --durations 20
254254
exit $EXIT_STATUS
255+
256+
build-wheel-windows:
257+
runs-on: windows-latest
258+
strategy:
259+
matrix:
260+
python_version: [["3.7", "3.7"], ["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"]]
261+
steps:
262+
- name: Setup Python
263+
uses: actions/setup-python@v2
264+
with:
265+
python-version: ${{ matrix.python_version[1] }}
266+
- name: Checkout torchrl
267+
uses: actions/checkout@v2
268+
- name: Install PyTorch nightly
269+
shell: bash
270+
run: |
271+
python3 -mpip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
272+
- name: Build TorchRL nightly
273+
shell: bash
274+
run: |
275+
rm -r dist || true
276+
python3 -mpip install wheel
277+
python3 setup.py bdist_wheel \
278+
--package_name torchrl-nightly \
279+
--python-tag=${{ matrix.python-tag }}
280+
- name: Upload wheel for the test-wheel job
281+
uses: actions/upload-artifact@v2
282+
with:
283+
name: torchrl-win-${{ matrix.python_version[0] }}.whl
284+
path: dist/*.whl
285+
286+
test-wheel-windows:
287+
needs: build-wheel-windows
288+
runs-on: windows-latest
289+
strategy:
290+
matrix:
291+
python_version: [["3.7", "3.7"], ["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"]]
292+
steps:
293+
- name: Setup Python
294+
uses: actions/setup-python@v2
295+
with:
296+
python-version: ${{ matrix.python_version[1] }}
297+
- name: Checkout torchrl
298+
uses: actions/checkout@v2
299+
- name: Install PyTorch Nightly
300+
shell: bash
301+
run: |
302+
python3 -mpip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
303+
- name: Upgrade pip
304+
shell: bash
305+
run: |
306+
python3 -mpip install --upgrade pip
307+
- name: Install test dependencies
308+
shell: bash
309+
run: |
310+
python3 -mpip install numpy pytest --no-cache-dir
311+
- name: Download built wheels
312+
uses: actions/download-artifact@v2
313+
with:
314+
name: torchrl-win-${{ matrix.python_version[0] }}.whl
315+
path: wheels
316+
- name: Install built wheels
317+
shell: bash
318+
run: |
319+
python3 -mpip install wheels/*
320+
- name: Log version string
321+
shell: bash
322+
run: |
323+
# Avoid ambiguity of "import torchrl" by deleting the source files.
324+
rm -rf torchrl/
325+
python3 -c "import torchrl; print(torchrl.__version__)"
326+
- name: Run tests
327+
shell: bash
328+
run: |
329+
set -e
330+
export IN_CI=1
331+
mkdir test-reports
332+
python -m torch.utils.collect_env
333+
python -c "import torchrl; print(torchrl.__version__);from torchrl.data import ReplayBuffer"
334+
EXIT_STATUS=0
335+
pytest test/smoke_test.py -v --durations 20
336+
exit $EXIT_STATUS
337+
338+
upload-wheel-windows:
339+
needs: test-wheel-windows
340+
runs-on: windows-latest
341+
strategy:
342+
matrix:
343+
python_version: [["3.7", "3.7"], ["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"]]
344+
steps:
345+
- name: Checkout torchrl
346+
uses: actions/checkout@v2
347+
- name: Download built wheels
348+
uses: actions/download-artifact@v2
349+
with:
350+
name: torchrl-win-${{ matrix.python_version[0] }}.whl
351+
path: wheels
352+
- name: Push TorchRL Binary to PYPI
353+
shell: bash
354+
env:
355+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
356+
run: |
357+
python3 -mpip install twine
358+
python3 -m twine upload \
359+
--username __token__ \
360+
--password "$PYPI_TOKEN" \
361+
--skip-existing \
362+
wheels/torchrl_nightly-*.whl \
363+
--verbose

.github/workflows/wheels.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,39 @@ jobs:
7878
name: torchrl-batch.whl
7979
path: dist/*.whl
8080

81+
build-wheel-windows:
82+
runs-on: windows-latest
83+
strategy:
84+
matrix:
85+
python_version: [["3.7", "3.7"], ["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"]]
86+
steps:
87+
- name: Setup Python
88+
uses: actions/setup-python@v2
89+
with:
90+
python-version: ${{ matrix.python_version[1] }}
91+
- name: Checkout torchrl
92+
uses: actions/checkout@v2
93+
- name: Install PyTorch RC
94+
shell: bash
95+
run: |
96+
python3 -mpip install torch --extra-index-url https://download.pytorch.org/whl/cpu
97+
- name: Build wheel
98+
shell: bash
99+
run: |
100+
python3 -mpip install wheel
101+
BUILD_VERSION=0.0.3 python3 setup.py bdist_wheel
102+
- name: Upload wheel for the test-wheel job
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: torchrl-win-${{ matrix.python_version[0] }}.whl
106+
path: dist/torchrl-*.whl
107+
- name: Upload wheel for download
108+
uses: actions/upload-artifact@v2
109+
with:
110+
name: torchrl-batch.whl
111+
path: dist/*.whl
112+
113+
81114
test-wheel:
82115
needs: [build-wheel-linux, build-wheel-mac]
83116
strategy:
@@ -128,3 +161,59 @@ jobs:
128161
EXIT_STATUS=0
129162
pytest test/smoke_test.py -v --durations 20
130163
exit $EXIT_STATUS
164+
165+
test-wheel-windows:
166+
needs: build-wheel-windows
167+
strategy:
168+
matrix:
169+
python_version: [ "3.7", "3.8", "3.9", "3.10" ]
170+
runs-on: windows-latest
171+
steps:
172+
- name: Setup Python
173+
uses: actions/setup-python@v2
174+
with:
175+
python-version: ${{ matrix.python_version }}
176+
- name: Checkout torchrl
177+
uses: actions/checkout@v2
178+
- name: Install PyTorch RC
179+
shell: bash
180+
run: |
181+
python3 -mpip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
182+
- name: Upgrade pip
183+
shell: bash
184+
run: |
185+
python3 -mpip install --upgrade pip
186+
- name: Install tensordict
187+
shell: bash
188+
run: |
189+
python3 -mpip install git+https://github.com/pytorch-labs/tensordict.git
190+
- name: Install test dependencies
191+
shell: bash
192+
run: |
193+
python3 -mpip install numpy pytest pytest-cov codecov unittest-xml-reporting pillow>=4.1.1 scipy av networkx expecttest pyyaml
194+
- name: Download built wheels
195+
uses: actions/download-artifact@v2
196+
with:
197+
name: torchrl-win-${{ matrix.python_version }}.whl
198+
path: wheels
199+
- name: Install built wheels
200+
shell: bash
201+
run: |
202+
python3 -mpip install wheels/*
203+
- name: Log version string
204+
shell: bash
205+
run: |
206+
# Avoid ambiguity of "import torchrl" by deleting the source files.
207+
rm -rf torchrl/
208+
python -c "import torchrl; print(torchrl.__version__)"
209+
- name: Run tests
210+
shell: bash
211+
run: |
212+
set -e
213+
export IN_CI=1
214+
mkdir test-reports
215+
python -m torch.utils.collect_env
216+
python -c "import torchrl; print(torchrl.__version__)"
217+
EXIT_STATUS=0
218+
pytest test/smoke_test.py -v --durations 20
219+
exit $EXIT_STATUS

0 commit comments

Comments
 (0)