Skip to content

Commit 9f0f774

Browse files
committed
Add same test for windows and macos
1 parent 4eb7d43 commit 9f0f774

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env python3
2+
3+
def get_os() -> str:
4+
import sys
5+
if sys.platform.startswith("darwin"):
6+
return "macos"
7+
if sys.platform.startswith("linux"):
8+
return "linux"
9+
if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"):
10+
return "windows"
11+
raise RuntimeError(f"Unknown platform {sys.platform}")
12+
13+
14+
def get_acc() -> str:
15+
import os
16+
return os.getenv("TEST_ACC", "accnone")
17+
18+
19+
def get_ver() -> str:
20+
import os
21+
return os.getenv("TEST_VER", "latest_stable")
22+
23+
24+
def get_pkg_type() -> str:
25+
import sys
26+
if len(sys.argv) > 1 and sys.argv[1] == "--conda":
27+
return "conda"
28+
if len(sys.argv) > 1 and sys.argv[1] == "--wheel":
29+
return "wheel"
30+
return "pip"
31+
32+
def get_install_command(os: str, pkg: str)
33+
import sys
34+
35+
def main() -> None:
36+
import subprocess
37+
import sys
38+
39+
os = get_os()
40+
acc = get_acc()
41+
pkg_type = get_pkg_type()
42+
version = get_ver()
43+
if version in ["latest_lts", "latest_stable"]:
44+
version = published_versions[version]
45+
46+
versions = published_versions["versions"][version]
47+
pkg_vers = versions[os][pkg_type]
48+
acc_vers = pkg_vers[acc]
49+
note, cmd = acc_vers["note"], acc_vers["command"]
50+
if cmd is None:
51+
print(note)
52+
sys.exit(0)
53+
54+
# Check that PyTorch + Domains are installable
55+
print(f"Installing PyTorch {version} + {acc} using {pkg_type} and Python {sys.version}")
56+
if pkg_type == "pip":
57+
cmd_args = [sys.executable] + cmd.split(" ")
58+
cmd_args[1] = "-mpip"
59+
subprocess.check_call(cmd_args)
60+
else:
61+
assert pkg_type == "conda"
62+
args = cmd.split(" ")
63+
# Add `-y` argument
64+
for idx, arg in enumerate(args):
65+
if arg == "install":
66+
args.insert(idx +1, "-y")
67+
subprocess.check_call(args)
68+
69+
70+
if __name__ == "__main__":
71+
main()

.github/workflows/validate-macos-binaries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- .github/workflows/validate-macos-binaries.yml
7+
- .test/smoke_test/*
78
jobs:
89
generate-arm64-conda-matrix:
910
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main

.github/workflows/validate-windows-binaries.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
paths:
1111
- .github/workflows/validate-windows-binaries.yml
12+
- .test/smoke_test/*
1213
jobs:
1314
generate-conda-matrix:
1415
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main

0 commit comments

Comments
 (0)