Skip to content

Commit cc1c80f

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

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
cp -r . ladybug/tools/python_api
33+
34+
- name: Setup ccache
35+
uses: hendrikmuhs/ccache-action@v1.2
36+
with:
37+
key: python-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}
38+
max-size: 2G
39+
create-symlink: true
40+
restore-keys: |
41+
python-${{ runner.os }}-${{ runner.arch }}-refs/heads/main
42+
python-${{ runner.os }}-${{ runner.arch }}-
43+
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v3
46+
with:
47+
version: "latest"
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: "3.12"
53+
54+
- name: Install dependencies
55+
working-directory: ladybug/tools/python_api
56+
run: |
57+
uv venv .venv
58+
uv pip install -e .[dev]
59+
60+
- name: Build native module
61+
working-directory: ladybug
62+
env:
63+
GEN: Ninja
64+
CMAKE_C_COMPILER_LAUNCHER: ccache
65+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
66+
run: |
67+
make python
68+
cp tools/python_api/src_py/*.py build/real_ladybug/
69+
70+
- name: Check formatting (black)
71+
working-directory: ladybug/tools/python_api
72+
run: |
73+
uv pip install black
74+
.venv/bin/black --check src_py test
75+
76+
- name: Run ruff check
77+
working-directory: ladybug/tools/python_api
78+
run: |
79+
.venv/bin/ruff check src_py test
80+
81+
- name: Run pytest
82+
working-directory: ladybug/tools/python_api
83+
run: |
84+
export PYTHONPATH=./build
85+
.venv/bin/python -m pytest -vv ./test

0 commit comments

Comments
 (0)