Skip to content

Commit ca49658

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

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

.github/workflows/ci.yml

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

0 commit comments

Comments
 (0)