forked from vincentlaucsb/csv-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.11 KB
/
Copy pathpython-bindings.yml
File metadata and controls
76 lines (63 loc) · 2.11 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
name: Python Bindings
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
env:
CSV_FETCHCONTENT_BASE_DIR: ${{ github.workspace }}/.cache/fetchcontent
jobs:
python-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up latest Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v5
with:
path: ${{ env.CSV_FETCHCONTENT_BASE_DIR }}
key: fetchcontent-${{ runner.os }}-python-${{ hashFiles('CMakeLists.txt', 'python/CMakeLists.txt') }}
- name: Install Python test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade coverage numpy pandas
- name: Configure CMake
run: >
cmake -B build-python
-DBUILD_PYTHON=ON
-DCSV_BUILD_TESTS=OFF
-DCSV_BUILD_PROGRAMS=OFF
-DCMAKE_BUILD_TYPE=Release
-DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
-DPYTHON_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
-S ${{ github.workspace }}
- name: Build fastpycsv
run: cmake --build build-python --config Release --target fastpycsv
- name: Run Python tests with coverage
env:
PYTHONPATH: ${{ github.workspace }}/python
run: >
python -m coverage run
--source=python/fastpycsv
-m unittest discover
-s python/tests
- name: Generate Python coverage report
run: python -m coverage xml -o python-coverage.xml
- name: Upload Python coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: python-coverage.xml
flags: python
name: python-bindings
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
override_commit: ${{ github.event.pull_request.head.sha || github.sha }}
override_pr: ${{ github.event.pull_request.number }}