fix: Fix warnings and more const-correctness #228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test module | |
on: | |
[ "push", "pull_request" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.11" ] | |
os: [ubuntu-latest, ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install C++ build tools & git | |
run: sudo apt-get update && sudo apt-get install -y build-essential git | |
- name: Install Boost | |
run: sudo apt-get update && sudo apt-get install -y libboost-all-dev | |
- name: Install OpenMP | |
run: sudo apt-get update && sudo apt-get install -y libomp-dev | |
- name: Install cnpy | |
run: | | |
git clone https://github.com/TomSchammo/cnpy/ | |
cd cnpy | |
git checkout cpp17 | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" | |
make VERBOSE=1 | |
sudo make install | |
- name: Install setuptools | |
run: python -m pip install setuptools==70.0.0 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pybind11 numpy==1.24.0 | |
python -m pip install torch==2.2.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Find PyTorch cmake path | |
id: find-torch-cmake-path | |
run: | | |
echo "TORCH_PATH=$(python -c 'import torch; import os; print(os.path.join(torch.__path__[0], "share", "cmake"))')" >> $GITHUB_ENV | |
- name: Build and install C++ module | |
run: | | |
export CXXFLAGS="-fopenmp ${CXXFLAGS}" | |
export CFLAGS="-fopenmp ${CFLAGS}" | |
python -m pip install . -v --no-cache-dir | |
- name: Test with pytest | |
run: | | |
python -m pytest ./pytest/test.py -v |