Skip to content

Commit e33a4c7

Browse files
committed
ci: use download_lbug.sh
1 parent e993e8c commit e33a4c7

2 files changed

Lines changed: 122 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,128 @@ on:
77
push:
88
branches: [main]
99

10+
permissions:
11+
actions: read
12+
contents: read
13+
1014
concurrency:
1115
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1216
cancel-in-progress: true
1317

1418
jobs:
15-
python-ci:
19+
python-ci-capi:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout ladybug
23+
uses: actions/checkout@v4
24+
with:
25+
repository: LadybugDB/ladybug
26+
fetch-depth: 1
27+
path: ladybug
28+
29+
- name: Update submodules
30+
working-directory: ladybug
31+
run: git submodule update --init --recursive dataset
32+
33+
- name: Checkout ladybug-python into ladybug/tools/python_api
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 1
37+
path: ladybug/tools/python_api
38+
39+
- name: Setup ccache
40+
uses: hendrikmuhs/ccache-action@v1.2
41+
with:
42+
key: python-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}
43+
max-size: 2G
44+
create-symlink: true
45+
restore-keys: |
46+
python-${{ runner.os }}-${{ runner.arch }}-refs/heads/main
47+
python-${{ runner.os }}-${{ runner.arch }}-
48+
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v3
51+
with:
52+
version: "latest"
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.12"
58+
59+
- name: Install dependencies
60+
working-directory: ladybug/tools/python_api
61+
run: |
62+
uv venv .venv
63+
uv pip install -e .[dev]
64+
65+
- name: Resolve compatible lbug artifact run
66+
working-directory: ladybug
67+
env:
68+
GITHUB_TOKEN: ${{ github.token }}
69+
run: |
70+
SHA="$(git rev-parse HEAD)"
71+
API_URL="https://api.github.com/repos/LadybugDB/ladybug/actions/workflows/build-and-deploy.yml/runs"
72+
AUTH_HEADER="Authorization: Bearer $GITHUB_TOKEN"
73+
ACCEPT_HEADER="Accept: application/vnd.github+json"
74+
VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28"
75+
76+
RUN_ID="$(
77+
curl -fsSL \
78+
-H "$AUTH_HEADER" \
79+
-H "$ACCEPT_HEADER" \
80+
-H "$VERSION_HEADER" \
81+
"$API_URL?head_sha=$SHA&status=success&per_page=1" \
82+
| python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")'
83+
)"
84+
85+
if [ -z "$RUN_ID" ]; then
86+
RUN_ID="$(
87+
curl -fsSL \
88+
-H "$AUTH_HEADER" \
89+
-H "$ACCEPT_HEADER" \
90+
-H "$VERSION_HEADER" \
91+
"$API_URL?branch=main&status=success&per_page=1" \
92+
| python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")'
93+
)"
94+
fi
95+
96+
if [ -z "$RUN_ID" ]; then
97+
echo "Could not find a successful LadybugDB/ladybug build-and-deploy run." >&2
98+
exit 1
99+
fi
100+
101+
echo "Using Ladybug build-and-deploy RUN_ID=$RUN_ID for SHA=$SHA"
102+
echo "LBUG_BUILD_RUN_ID=$RUN_ID" >> "$GITHUB_ENV"
103+
104+
- name: Download shared lbug library
105+
working-directory: ladybug/tools/python_api
106+
env:
107+
GH_TOKEN: ${{ github.token }}
108+
run: |
109+
gh --version
110+
LBUG_PRECOMPILED_RUN_ID="$LBUG_BUILD_RUN_ID" LBUG_LIB_KIND=shared bash scripts/download_lbug.sh .cache/lbug-capi.env
111+
cat .cache/lbug-capi.env >> "$GITHUB_ENV"
112+
113+
- name: Check formatting (black)
114+
working-directory: ladybug/tools/python_api
115+
run: |
116+
uv pip install black
117+
.venv/bin/black --check src_py test
118+
119+
- name: Run ruff check
120+
working-directory: ladybug/tools/python_api
121+
run: |
122+
.venv/bin/ruff check src_py test
123+
124+
- name: Run pytest (C API backend)
125+
working-directory: ladybug/tools/python_api
126+
env:
127+
LBUG_PYTHON_BACKEND: capi
128+
run: |
129+
.venv/bin/python -m pytest -vv ./test
130+
131+
python-ci-pybind:
16132
runs-on: ubuntu-latest
17133
steps:
18134
- name: Checkout ladybug
@@ -79,8 +195,10 @@ jobs:
79195
make python
80196
cp tools/python_api/src_py/*.py tools/python_api/build/ladybug/
81197
82-
- name: Run pytest
198+
- name: Run pytest (pybind backend)
83199
working-directory: ladybug/tools/python_api
200+
env:
201+
LBUG_PYTHON_BACKEND: pybind
84202
run: |
85203
export PYTHONPATH=./build
86204
.venv/bin/python -m pytest -vv ./test

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ dev = [
2626
"setuptools~=80.9",
2727
"ruff==0.11.12",
2828
"mypy==1.16.0",
29-
"torch>=2.5.0",
30-
"torch-geometric>=2.5.0",
29+
"torch>=2.5.0,<2.6.0",
30+
"torch-geometric>=2.5.0,<2.6.0",
3131
]
3232

3333
[[tool.uv.index]]

0 commit comments

Comments
 (0)