Repository navigation
86 lines (86 loc) · 2.88 KB
/
Copy pathtest_python_workflow.yml
File metadata and controls
86 lines (86 loc) · 2.88 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
name: Run Python test
permissions: {}
on:
workflow_call:
inputs:
skip_tests:
type: boolean
default: false
required: false
test_python_lower:
type: boolean
default: false
required: false
# DO NOT CHANGE NAME OF WORKFLOW, USED IN OTHER WORKFLOWS KEEP "Rust Tests"
jobs:
select-strategy:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set-matrix.outputs.python-versions }}
steps:
- id: set-matrix
run: |
echo "python-versions=[\"3.11\",\"3.14.0\"]" >> $GITHUB_OUTPUT
python-test:
env:
RUST_BACKTRACE: 1
CARGO_BUILD_JOBS: 3
if: ${{ !inputs.skip_tests }}
name: Python Tests
needs: select-strategy
strategy:
matrix:
python: ${{ fromJson(needs.select-strategy.outputs.python-versions) }}
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v7
name: Checkout
- uses: maxim-lobanov/setup-xcode@v1
name: Xcode version
if: "contains(matrix.os, 'macOS')"
with:
xcode-version: latest-stable
- uses: ./.github/actions/setup_rust
name: Setup Rust
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
name: Cargo cache
with:
# Jobs building the same profile/features/RUSTFLAGS share one cache per OS
shared-key: python-build-fast
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
cache: "pip"
- name: Install Python dependencies
run: |
echo "Installing test dependencies..."
python -m pip install pytest tox
python -m pip install black
echo "Installing linting dependencies from cache..."
python -m pip install maturin mypy networkx pyvis pandas-stubs
# Build the wheel ourselves (same flags as tox's .pkg env) so the exact wheel under test can be shared with format.yml
- name: Build raphtory wheel
shell: bash
working-directory: python
run: |
maturin build --features test --profile build-fast --interpreter python --out dist
- name: Run Python tests
shell: bash
working-directory: python
run: |
tox run --installpkg "$(ls dist/*.whl)"
# Used by format.yml for stub and schema generation; the `test` feature only adds panic-on-drop, not API
- name: Upload wheel
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.14.0'
uses: actions/upload-artifact@v4
with:
name: python-wheel-linux-py3.14
path: python/dist/*.whl
if-no-files-found: error
retention-days: 1