Skip to content

Commit 800614a

Browse files
committed
ci: add a push blocking ci
1 parent 0ea6dc3 commit 800614a

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Python CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [main]
7+
push:
8+
branches: [main]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
python-ci:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout ladybug-python
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
path: ladybug-python
23+
24+
- name: Checkout ladybug
25+
uses: actions/checkout@v4
26+
with:
27+
repository: LadybugDB/ladybug
28+
fetch-depth: 1
29+
30+
- name: Copy python_api to ladybug repo
31+
run: |
32+
mkdir -p ladybug/tools/python_api
33+
cp -r . ladybug/tools/python_api/
34+
35+
- name: Setup ccache
36+
uses: hendrikmuhs/ccache-action@v1.2
37+
with:
38+
key: python-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}
39+
max-size: 2G
40+
create-symlink: true
41+
restore-keys: |
42+
python-${{ runner.os }}-${{ runner.arch }}-refs/heads/main
43+
python-${{ runner.os }}-${{ runner.arch }}-
44+
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v3
47+
with:
48+
version: "latest"
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
55+
- name: Install dependencies
56+
working-directory: ladybug/tools/python_api
57+
run: |
58+
uv venv .venv
59+
uv pip install -e .[dev]
60+
61+
- name: Build native module
62+
working-directory: ladybug
63+
env:
64+
GEN: Ninja
65+
CMAKE_C_COMPILER_LAUNCHER: ccache
66+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
67+
run: |
68+
make python
69+
cp tools/python_api/src_py/*.py build/real_ladybug/
70+
71+
- name: Check formatting (black)
72+
working-directory: ladybug/tools/python_api
73+
run: |
74+
uv pip install black
75+
.venv/bin/black --check src_py test
76+
77+
- name: Run ruff check
78+
working-directory: ladybug/tools/python_api
79+
run: |
80+
.venv/bin/ruff check src_py test
81+
82+
- name: Run pytest
83+
working-directory: ladybug/tools/python_api
84+
run: |
85+
export PYTHONPATH=./build
86+
.venv/bin/python -m pytest -vv ./test

0 commit comments

Comments
 (0)