Skip to content

Commit

Permalink
add CI job for local installations (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier authored Mar 21, 2023
1 parent 61e2000 commit bf847ed
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,41 @@ jobs:
actual = CPUBackend()
sys.exit(actual != expected)
local:
strategy:
matrix:
local-project-stub:
- pep517-setuptools
fail-fast: false

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup development environment
uses: ./.github/actions/setup-dev-env

- name: Collect environment information
run: python scripts/collect_env.py

- name: Install local project with PyTorch dependency
run: ltt install --editable local-project-stubs/${{ matrix.local-project-stub }}

- name: Check if CPU only
shell: python
run: |
import sys
import torch
cuda = torch.version.cuda
print(f"cuda = {cuda}")
hip = torch.version.hip
print(f"hip = {hip}")
sys.exit(cuda or hip)
8 changes: 7 additions & 1 deletion light_the_torch/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ def get_extra_index_urls(computation_backends, channel):
def patch_link_collection_with_supply_chain_attack_mitigation(
computations_backends, channel
):
def is_pinned(requirement):
if requirement.req is None:
return False

return requirement.is_pinned

@contextlib.contextmanager
def context(input):
with patch_link_collection(
Expand All @@ -261,7 +267,7 @@ def context(input):
requirement.name
for requirement in input.root_reqs
if requirement.user_supplied
and not requirement.is_pinned
and not is_pinned(requirement)
and requirement.name in THIRD_PARTY_PACKAGES
},
):
Expand Down
7 changes: 7 additions & 0 deletions local-project-stubs/pep517-setuptools/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"wheel",
]
build-backend = "setuptools.build_meta"
7 changes: 7 additions & 0 deletions local-project-stubs/pep517-setuptools/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[metadata]
name = light-the-torch-test-package
version = 1.2.3

[options]
install_requires =
torch

0 comments on commit bf847ed

Please sign in to comment.