-
Notifications
You must be signed in to change notification settings - Fork 25
155 lines (132 loc) · 5.06 KB
/
python-ci-single.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
# This is a reusable workflow
# (https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow),
# called by python-ci-full.yml and python-ci-minimal.yml.
name: TileDB-SOMA Python CI
on:
workflow_call:
inputs:
python_version:
required: true
type: string
os:
required: true
type: string
cc:
required: false
type: string
cxx:
required: false
type: string
report_codecov:
required: true
type: boolean
run_lint:
required: false
type: boolean
default: false
jobs:
lint:
if: inputs.run_lint
runs-on: ${{ inputs.os }}
steps:
- name: Checkout TileDB-SOMA
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: Restore pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ inputs.os }}-${{ inputs.python_version }}-${{ hashFiles('.github/workflows/python-ci-single.yml', '.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip -v install pre-commit
- name: Log pip dependencies
run: pip list
- name: Run pre-commit hooks on all files
run: pre-commit run -a -v
# Skip files in apis/r/src which are:
# * nanoarrow.c/h
# * Auto-generated by Rcpp
# * Things which Dirk doesn't want to be format-checked
- name: Check C++ Format
shell: bash
run: ./scripts/run-clang-format.sh . clang-format 0 $(find libtiledbsoma apis/python/src -name "*.cc" -or -name "*.cpp" -or -name "*.h" | grep -v external)
build:
runs-on: ${{ inputs.os }}
steps:
- name: Show matrix OS
run: echo "inputs.os:" ${{ inputs.os }}
- name: Linux CPU info
if: ${{ inputs.os == 'ubuntu-latest' }}
run: cat /proc/cpuinfo
- name: MacOS CPU info
if: ${{ inputs.os == 'macos-latest' }}
run: sysctl -a | grep cpu
- name: Select XCode version
if: startsWith(inputs.os, 'macos')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'
- name: Checkout TileDB-SOMA
uses: actions/checkout@v4
with:
fetch-depth: 0 # ensure we get all tags to inform package version determination
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
cache: pip
cache-dependency-path: ./apis/python/setup.py
# Experiment for macOS CI false negatives ...
# - name: Cache native libraries
# uses: actions/cache@v4
# with:
# path: |
# build
# dist
# key: libtiledbsoma-build-dist-${{ inputs.os }}-${{ inputs.python_version }}-${{ hashFiles('libtiledbsoma', 'scripts/bld') }}
- name: Install tiledbsoma
run: pip -v install -e apis/python[dev] -C "--build-option=--no-tiledb-deprecated"
env:
CC: ${{ inputs.cc }}
CXX: ${{ inputs.cxx }}
- name: Show package versions
run: python scripts/show-versions.py
- name: Show XCode version
run: clang --version
- name: Obtain test data
shell: bash
run: |
cd test
rm -rf soco
tar zxf soco.tgz
cd ..
- name: Run libtiledbsoma unit tests
run: ctest --output-on-failure --test-dir build/libtiledbsoma -C Release --verbose
env:
TILEDB_SOMA_INIT_BUFFER_BYTES: 33554432 # accommodate tiny runners
- name: Run pytests for Python without new shape
shell: bash
# Setting PYTHONPATH ensures the tests load the in-tree source code under apis/python/src
# instead of the copy we `pip install`ed to site-packages above. That's needed for the code
# coverage analysis to work.
run: export SOMA_PY_NEW_SHAPE=false; PYTHONPATH=$(pwd)/apis/python/src python -m pytest --cov=apis/python/src --cov-report=xml apis/python/tests -v --durations=20 --maxfail=50
- name: Run pytests for Python with new shape
shell: bash
# Setting PYTHONPATH ensures the tests load the in-tree source code under apis/python/src
# instead of the copy we `pip install`ed to site-packages above. That's needed for the code
# coverage analysis to work.
run: PYTHONPATH=$(pwd)/apis/python/src python -m pytest --cov=apis/python/src --cov-report=xml apis/python/tests -v --durations=20 --maxfail=50
- name: Report coverage to Codecov
if: inputs.report_codecov
uses: codecov/codecov-action@v4
with:
flags: python
# Although Codecov isn't supposed to require an auth token for public repos like this one,
# the uploader can be unreliable without one; see
# https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652
# As of this writing (8 Nov 2022) the CODECOV_TOKEN was generated by @aaronwolen in his
# Codecov settings page for this repo, then filled into the GitHub Actions secrets.
token: ${{ secrets.CODECOV_TOKEN }}