Skip to content

Commit 22685ea

Browse files
author
Vincent Moens
authored
[Versioning] env-script for windows build (2) (#934)
1 parent ab58a0e commit 22685ea

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

.github/scripts/version_script.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
set TENSORDICT_BUILD_VERSION=0.5.0
3+
echo TENSORDICT_BUILD_VERSION is set to %TENSORDICT_BUILD_VERSION%

.github/workflows/build-wheels-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
package-name: ${{ matrix.package-name }}
4747
smoke-test-script: ${{ matrix.smoke-test-script }}
4848
trigger-event: ${{ github.event_name }}
49-
env-script: .github/scripts/version_script.sh
49+
env-script: .github/scripts/version_script.bat

.github/workflows/wheels-windows.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Wheels
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
push:
6+
branches:
7+
- release/*
8+
9+
concurrency:
10+
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
11+
# On master, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
12+
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && format('ci-master-{0}', github.sha) || format('ci-{0}', github.ref) }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
17+
build-wheel-windows:
18+
runs-on: windows-latest
19+
strategy:
20+
matrix:
21+
python_version: [["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"], ["3.11", "3.11"], ["3.12", "3.12"]]
22+
steps:
23+
- name: Setup Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python_version[1] }}
27+
- name: Checkout tensordict
28+
uses: actions/checkout@v2
29+
- name: Install PyTorch RC
30+
shell: bash
31+
run: |
32+
python3 -mpip install torch --extra-index-url https://download.pytorch.org/whl/cpu
33+
- name: Build wheel
34+
shell: bash
35+
run: |
36+
python3 -mpip install wheel
37+
TENSORDICT_BUILD_VERSION=0.5.0 python3 setup.py bdist_wheel
38+
- name: Upload wheel for the test-wheel job
39+
uses: actions/upload-artifact@v2
40+
with:
41+
name: tensordict-win-${{ matrix.python_version[0] }}.whl
42+
path: dist/tensordict-*.whl
43+
- name: Upload wheel for download
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: tensordict-batch.whl
47+
path: dist/*.whl
48+
49+
test-wheel-windows:
50+
needs: build-wheel-windows
51+
strategy:
52+
matrix:
53+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12" ]
54+
runs-on: windows-latest
55+
steps:
56+
- name: Setup Python
57+
uses: actions/setup-python@v2
58+
with:
59+
python-version: ${{ matrix.python_version }}
60+
- name: Checkout tensordict
61+
uses: actions/checkout@v2
62+
- name: Install PyTorch RC
63+
shell: bash
64+
run: |
65+
python3 -mpip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
66+
- name: Upgrade pip
67+
shell: bash
68+
run: |
69+
python3 -mpip install --upgrade pip
70+
- name: Install test dependencies
71+
shell: bash
72+
run: |
73+
python3 -mpip install numpy pytest pytest-cov codecov unittest-xml-reporting pillow>=4.1.1 scipy av networkx expecttest pyyaml
74+
- name: Download built wheels
75+
uses: actions/download-artifact@v2
76+
with:
77+
name: tensordict-win-${{ matrix.python_version }}.whl
78+
path: wheels
79+
- name: Install built wheels
80+
shell: bash
81+
run: |
82+
python3 -mpip install wheels/*
83+
- name: Log version string
84+
shell: bash
85+
run: |
86+
# Avoid ambiguity of "import tensordict" by deleting the source files.
87+
rm -rf tensordict/
88+
python -c "import tensordict; print(tensordict.__version__)"
89+
- name: Run tests
90+
shell: bash
91+
run: |
92+
set -e
93+
export IN_CI=1
94+
mkdir test-reports
95+
python -m torch.utils.collect_env
96+
python -c "import tensordict; print(tensordict.__version__)"
97+
EXIT_STATUS=0
98+
pytest test/smoke_test.py -v --durations 200
99+
exit $EXIT_STATUS

0 commit comments

Comments
 (0)