Skip to content

Commit bfaf408

Browse files
committed
Fix benchmark CI
Current logic is flawed. Intention of benchmark tests was to build library from two different commits. However only C/C++ part was built separately, python code was not touched. When current commit's directory was checked out to run the fresh tests, so was other python code: tests were always run on the same python part of the library. To fix that, build a local wheel from existing code and make sure it is being used instead of local code.
1 parent 0beb3c1 commit bfaf408

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

.github/actions/benchmark/action.yaml

+15-14
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,31 @@ runs:
1818
- name: Checkout commit which performance should be measured
1919
shell: bash
2020
run: |
21+
git restore .
2122
git fetch origin ${{ inputs.ref }} --depth 1
2223
git checkout ${{ inputs.ref }}
2324
24-
- name: Configure
25+
- name: Build wheel
2526
shell: bash
2627
run: |
27-
cmake -S . -B build \
28-
-DBUILD_PYTHON=ON \
29-
-DBUILD_SHARED_LIBS=ON \
30-
-DCMAKE_BUILD_TYPE=Release \
28+
python -m cibuildwheel --only cp312-manylinux_x86_64 --output-dir ./wheelhouse python/
3129
32-
- name: Build
30+
- name: Install local wheel
3331
shell: bash
3432
run: |
35-
cmake \
36-
--build build \
37-
--config Release \
38-
39-
- name: Set PYTHONPATH
40-
shell: bash
41-
run: echo "PYTHONPATH=$(pwd)/python" >> $GITHUB_ENV
33+
pip install ./wheelhouse/*.whl
34+
rm -f ./wheelhouse/*.whl
4235
4336
- name: Checkout current commit which contains all tests to run
4437
shell: bash
4538
run: git checkout ${{ github.sha }}
4639

40+
# assure that local segyio doesn't take priority (one installed to pip is used)
41+
- name: Remove local segyio
42+
shell: bash
43+
run: |
44+
rm -rf $(pwd)/python/segyio
45+
4746
- name: Make segy file
4847
shell: bash
4948
working-directory: python
@@ -79,4 +78,6 @@ runs:
7978
8079
- name: Remove build artifacts
8180
shell: bash
82-
run: git clean -df --exclude=.benchmarks
81+
run: |
82+
git clean -df --exclude=.benchmarks
83+
pip uninstall -y segyio

.github/workflows/benchmarks.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v4
2121

22+
- name: Install wheel and cibuildwheel
23+
run: python3 -m pip install wheel cibuildwheel
24+
2225
- name: Install build/test dependencies
23-
shell: bash
2426
working-directory: python
2527
run: |
2628
python3 -m pip install -r requirements-dev.txt

0 commit comments

Comments
 (0)