Skip to content

Commit d47ba0b

Browse files
committed
build(workflow): add tests to CI workflow
1 parent 18c8bae commit d47ba0b

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ on:
1212
- src/**
1313
- python/**
1414
- "*.toml"
15-
- ".github/workflows/CI.yml"
15+
- ".github/workflows/*.yml"
1616
push:
1717
branches: [main]
1818
paths:
1919
- src/**
2020
- python/**
2121
- "*.toml"
22-
- ".github/workflows/CI.yml"
22+
- ".github/workflows/*.yml"
2323
workflow_dispatch:
2424

2525
permissions:
@@ -38,11 +38,15 @@ jobs:
3838
- uses: actions/setup-python@v5
3939
with:
4040
python-version: 3.x
41+
- name: Run tests
42+
uses: ./.github/workflows/_test.yml
43+
with:
44+
platform: ${{ matrix.platform.runner }}
4145
- name: Build wheels
4246
uses: PyO3/maturin-action@v1
4347
with:
4448
target: ${{ matrix.platform.target }}
4549
args: --release --out dist --find-interpreter
4650
sccache: 'true'
4751
manylinux: auto
48-
container: ${{ matrix.platform.container }}
52+
container: ${{ matrix.platform.container }}

.github/workflows/_test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
rust:
12+
strategy:
13+
matrix:
14+
python-version: [3.11, 3.13]
15+
runs-on: ${{ inputs.platform }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- run: rustup toolchain install stable --profile minimal
20+
- name: Rust Cache
21+
uses: Swatinem/[email protected]
22+
- name: Build
23+
run: cargo build --verbose
24+
- name: Run Rust tests
25+
run: cargo test --verbose
26+
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
cache: 'pip'
31+
32+
- name: Install dependencies
33+
run: |
34+
pip3 install .
35+
pip3 install pytest
36+
37+
- name: Run Python tests
38+
run: |
39+
cd python
40+
pytest cocoindex/tests

0 commit comments

Comments
 (0)