-
-
Notifications
You must be signed in to change notification settings - Fork 2k
179 lines (149 loc) · 5.05 KB
/
test-coverage.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Code coverage
on:
pull_request:
paths:
- '**.rs'
- '**.py'
- .github/workflows/test-coverage.yml
push:
branches:
- main
paths:
- '**.rs'
- '**.py'
- .github/workflows/test-coverage.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
RUSTFLAGS: '-C instrument-coverage --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target'
RUST_BACKTRACE: 1
LLVM_PROFILE_FILE: ${{ github.workspace }}/target/polars-%p-%3m.profraw
CARGO_LLVM_COV: 1
CARGO_LLVM_COV_SHOW_ENV: 1
CARGO_LLVM_COV_TARGET_DIR: ${{ github.workspace }}/target
jobs:
coverage-rust:
# Running under ubuntu doesn't seem to work:
# https://github.com/pola-rs/polars/issues/14255
# Pinned on macos-13 because latest does not work:
# https://github.com/pola-rs/polars/issues/15917
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Set up Rust
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref_name == 'main' }}
- name: Prepare coverage
run: cargo llvm-cov clean --workspace
- name: Run tests
run: >
cargo test --all-features
-p polars-arrow
-p polars-compute
-p polars-core
-p polars-io
-p polars-lazy
-p polars-ops
-p polars-parquet
-p polars-plan
-p polars-row
-p polars-sql
-p polars-time
-p polars-utils
- name: Run integration tests
run: cargo test --all-features -p polars --test it
- name: Report coverage
run: cargo llvm-cov report --lcov --output-path coverage-rust.lcov
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-rust
path: coverage-rust.lcov
coverage-python:
# Running under ubuntu doesn't seem to work:
# https://github.com/pola-rs/polars/issues/14255
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Create virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV
- name: Install Python dependencies
working-directory: py-polars
run: |
# Install typing-extensions separately whilst the `--extra-index-url` in `requirements-ci.txt`
# doesn't have an up-to-date typing-extensions, see
# https://github.com/astral-sh/uv/issues/6028#issuecomment-2287232150
uv pip install -U typing-extensions
uv pip install --compile-bytecode -r requirements-dev.txt -r requirements-ci.txt --verbose
- name: Set up Rust
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref_name == 'main' }}
- name: Prepare coverage
run: cargo llvm-cov clean --workspace
- name: Install Polars
run: maturin develop -m py-polars/Cargo.toml
- name: Run Python tests
working-directory: py-polars
run: >
pytest
-n auto --dist loadgroup
-m "not release and not benchmark and not docs"
-k 'not test_polars_import'
--cov --cov-report xml:main.xml
- name: Run Python tests - async reader
working-directory: py-polars
env:
POLARS_FORCE_ASYNC: 1
run: >
pytest tests/unit/io/
-n auto --dist loadgroup
-m "not release and not benchmark and not docs"
--cov --cov-report xml:async.xml --cov-fail-under=0
- name: Report Rust coverage
run: cargo llvm-cov report --lcov --output-path coverage-python.lcov
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-python
path: |
coverage-python.lcov
py-polars/main.xml
py-polars/async.xml
upload-coverage:
needs: [coverage-rust, coverage-python]
runs-on: ubuntu-latest
steps:
# Needed to fetch the Codecov config file
- uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-rust.lcov,coverage-python.lcov,py-polars/main.xml,py-polars/async.xml
root_dir: ${{ github.workspace }}