Skip to content

Commit 94357f7

Browse files
committed
Add upstream CI
1 parent 7cff941 commit 94357f7

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/scripts/upstream_install.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import subprocess
2+
import sys
3+
from pathlib import Path
4+
5+
6+
def install_deps() -> None:
7+
# NOTE: need to use legacy-resolver due to https://github.com/dask/community/issues/124
8+
install_cmd = (
9+
sys.executable,
10+
"-m",
11+
"pip",
12+
"install",
13+
"--use-deprecated=legacy-resolver",
14+
"--upgrade",
15+
)
16+
upstream_deps = (
17+
"git+https://github.com/dask/dask.git#egg=dask[array]",
18+
"git+https://github.com/dask/distributed.git#egg=distributed",
19+
"git+https://github.com/dask/dask-ml.git#egg=dask-ml",
20+
"git+https://github.com/pydata/xarray.git#egg=xarray",
21+
"git+https://github.com/zarr-developers/zarr-python.git#egg=zarr",
22+
)
23+
full_cmd_upstream = install_cmd + upstream_deps
24+
print(f"Install upstream dependencies via: {full_cmd_upstream}")
25+
subprocess.check_call(full_cmd_upstream)
26+
req_deps = set(Path("requirements.txt").read_text().splitlines())
27+
req_upstream = [x.split("egg=")[-1].strip() for x in upstream_deps]
28+
req_left = tuple(x for x in req_deps if not any(y in x for y in req_upstream))
29+
full_cmd_left_over = install_cmd + req_left
30+
print(f"Install left over dependencies via: {full_cmd_left_over}")
31+
subprocess.check_call(full_cmd_left_over)
32+
33+
34+
def install_self() -> None:
35+
install_cmd = (
36+
sys.executable,
37+
"-m",
38+
"pip",
39+
"install",
40+
"--no-deps",
41+
"-e" ".",
42+
)
43+
print(f"Install sgkit via: `{install_cmd}`")
44+
subprocess.check_call(install_cmd)
45+
46+
47+
if __name__ == "__main__":
48+
install_deps()
49+
install_self()

.github/workflows/upstream.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Upstream
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "0 1 * * *"
7+
# manual trigger
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
if: github.repository_owner == 'pystatgen'
14+
strategy:
15+
matrix:
16+
python-version: [3.7, 3.8]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install deps and sgkit
26+
run: |
27+
sudo apt update -y
28+
sudo apt install libgsl-dev # Needed for msprime < 1.0. Binary wheels include GSL for >= 1.0
29+
python -m pip install --upgrade pip
30+
python .github/scripts/upstream_install.py
31+
python -m pip install -r requirements-dev.txt
32+
33+
- name: Test with pytest
34+
run: |
35+
python -m pip freeze
36+
pytest -v

0 commit comments

Comments
 (0)