Repository navigation
97 lines (92 loc) · 3.26 KB
/
Copy pathpython-test.yml
File metadata and controls
97 lines (92 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Python Tests
on:
push:
branches:
- main
paths:
- python/**
- crates/**
- Cargo.toml
- Cargo.lock
- .github/workflows/python-test.yml
pull_request:
paths:
- python/**
- crates/**
- Cargo.toml
- Cargo.lock
- .github/workflows/python-test.yml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C debuginfo=line-tables-only"
CARGO_INCREMENTAL: "0"
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
with:
# The rust-cache step below caches the bindings crate.
cache: false
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
shared-key: "lance-csr-python"
# maturin builds the bindings crate, which sits outside the root
# workspace. The root workspace is listed too so the cache key hashes
# the manifest of lance-csr, which the bindings use by path; otherwise a dependency or feature change there keeps
# restoring a stale cache. Its target directory is never built here.
workspaces: |
. -> target
crates/lance-csr-python -> target
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler
- name: Install uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: Install locked dependencies
working-directory: python
# The package itself is built by maturin develop below, in debug mode.
run: uv sync --locked --no-install-project --python ${{ matrix.python-version }}
- name: Build Python extension
working-directory: python
run: uv run --no-sync maturin develop
- name: Run tests
working-directory: python
run: uv run --no-sync pytest -n auto python/tests/ --doctest-modules python/lance_csr -v
lint:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: Install locked dependencies
working-directory: python
# Linting needs no build of the Rust extension.
run: uv sync --locked --no-install-project --python 3.12
- name: Run ruff format check
working-directory: python
run: uv run --no-sync ruff format --check python/
- name: Run ruff lint
working-directory: python
run: uv run --no-sync ruff check python/
- name: Run pyright type check
working-directory: python
run: uv run --no-sync pyright