Skip to content

Commit

Permalink
ci: test python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Dec 24, 2023
1 parent 0dc63fd commit 35f774a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,38 @@ jobs:
$exe $test_file
done
test_bind_python:
name: Test Python Bindings
needs:
- download_validation_files
- build_iguana
runs-on: ubuntu-latest
steps:
- name: get dependency build artifacts
uses: actions/download-artifact@v3
with:
name: build_deps
- name: get iguana build artifacts
uses: actions/download-artifact@v3
with:
name: build_iguana_python
- name: get test data
uses: actions/download-artifact@v3
with:
name: validation_files
- name: untar artifacts
run: |
ls *.tar.gz | xargs -I{} tar xzvf {}
rm -v *.tar.gz
- name: pip install requirements
run: python -m pip install -r bind/python/requirements.txt
- name: run test
run: |
test_file=$(find validation_files -name "*.hipo" | head -n1)
echo "[+] TEST FILE: $test_file"
source iguana/bin/this_iguana.sh
iguana/bin/iguana-example-bind.py ${test_file} 1
test_dependent_builds:
name: Test Dependent Builds
needs:
Expand Down
5 changes: 3 additions & 2 deletions bind/python/iguana-example-bind.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env python3

import pyiguana
import sys

# include the header files that you need
pyiguana.include('hipo4/reader.h', 'iguana/algorithms/AlgorithmSequence.h')
# then import the bound namespaces (must be after including the headers)
from cppyy.gbl import hipo, iguana
# from here the syntax is analogous to the C++ example

inFile = 'data.hipo'
numEvents = 3
inFile = sys.argv[1] if len(sys.argv)>1 else 'data.hipo'
numEvents = int(sys.argv[2]) if len(sys.argv)>2 else 3

reader = hipo.reader(inFile)
banks = reader.getBanks(["REC::Particle", "REC::Calorimeter"]);
Expand Down

0 comments on commit 35f774a

Please sign in to comment.