Skip to content

Commit 7d997be

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

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/ci.yml

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

0 commit comments

Comments
 (0)