Skip to content

Remove extra address init #86

Remove extra address init

Remove extra address init #86

Workflow file for this run

name: Test of package installation & execution
'on':
push:
branches-ignore:
- gh-pages
tags:
- '*'
schedule:
- cron: 0 10 * * 1
jobs:
build_cpp:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-install: [pip, conda]
install-zmq: [true, false]
install-mpi: [true]
with-coverage: [false, true]
with-asan: [false]
with-elf: [false]
with-valgrind: [false]
exclude:
- python-install: conda
with-coverage: false
- python-install: pip
with-coverage: true
- os: windows-latest
install-zmq: false
- os: windows-latest
with-asan: true
- python-install: conda
install-zmq: false
- python-install: conda
install-mpi: false
- python-install: conda
with-asan: true
include:
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: true
with-coverage: true
with-asan: false
with-elf: true
with-valgrind: false
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: true
with-asan: false
with-elf: true
with-valgrind: false
- os: macos-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: true
with-elf: true
with-valgrind: false
- os: ubuntu-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: true
- os: macos-latest
python-install: pip
install-zmq: true
install-mpi: false
with-coverage: false
with-asan: false
with-elf: false
with-valgrind: true
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
submodules: true
###################################
# PIP SETUP
###################################
- name: Install dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest' && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y libc6-dbg gdb valgrind lcov libcmocka-dev
sudo apt upgrade --fix-missing
valgrind --version
- name: Install dependencies on Mac
if: matrix.os == 'macos-latest' && matrix.python-install == 'pip'
run: |
brew install llvm cmocka lcov gnutls
- name: Install dependencies on Windows
if: matrix.os == 'windows-latest' && matrix.python-install == 'pip'
run: |
vcpkg.exe install cmocka --triplet x64-windows
# ZeroMQ dependencies
- name: Install ZeroMQ
if: matrix.os == 'ubuntu-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev libgomp1
sudo apt upgrade --fix-missing
- name: Install ZeroMQ
if: matrix.os == 'macos-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
brew install zeromq libomp
- name: Install ZeroMQ
if: matrix.os == 'windows-latest' && matrix.install-zmq && matrix.python-install == 'pip'
run: |
vcpkg.exe install zeromq --triplet x64-windows
# MPI dependencies
- name: Install MPI dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest' && matrix.install-mpi && matrix.python-install == 'pip'
run: |
sudo apt-get update
sudo apt-get install -y mpich
sudo apt upgrade --fix-missing
- name: Install MPI dependencies on Mac
if: matrix.os == 'macos-latest' && matrix.install-mpi && matrix.python-install == 'pip'
run: |
brew install open-mpi
# - name: MPI dependencies on Windows
# if: matrix.os == 'windows-latest' && matrix.install-mpi && matrix.python-install == 'pip'
# run: |
# vcpkg.exe install msmpi --triplet x64-windows
- name: Setup Python
if: matrix.python-install == 'pip'
id: pysetup
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Fix Python path on mac
if: matrix.os == 'macos-latest' && matrix.python-install == 'pip'
run: |
tee -a ~/.profile <<<'export PATH="${pythonLocation}/bin:${PATH}"'
- name: Install Python dependencies
if: matrix.python-install == 'pip'
run: |
python -m pip install -r requirements.txt
python -m pip install -r requirements-test.txt
###################################
# CONDA SETUP
###################################
- name: Set up MSVC Compiler on windows
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest' && matrix.python-install == 'conda'
with:
toolset: 14.0
- name: Set up miniconda test environment
if: matrix.python-install == 'conda'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: yggdrasil
environment-file: environment.yml
auto-update-conda: true
channels: conda-forge
channel-priority: strict
- name: Install LLVM on mac for OpenMP
if: matrix.os == 'macos-latest' && matrix.python-install == 'conda'
run: |
conda install llvm -y
###################################
# SET CONFIG FLAGS
###################################
- name: Global config flags
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=-DYGG_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_PYTHON_LIBRARY=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" >> "$GITHUB_ENV"
echo "TEST_FLAGS=-C Debug --output-on-failure -VV" >> "$GITHUB_ENV"
echo "PYTHON_CMAKE_ARGS=" >> "$GITHUB_ENV"
- name: Coverage config flags
if: matrix.with-coverage == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_COVERAGE=ON" >> "$GITHUB_ENV"
- name: ASAN config flags
if: matrix.with-asan == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_BUILD_ASAN=ON -DYGG_BUILD_UBSAN=ON -DYGGDRASIL_DISABLE_PYTHON_C_API=ON" >> "$GITHUB_ENV"
echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DYGG_BUILD_ASAN=ON -DYGG_BUILD_UBSAN=ON" >> "$GITHUB_ENV"
echo "ASAN_OPTIONS=detect_odr_violation=0:detect_container_overflow=0" >> $GITHUB_ENV
echo "TEST_FLAGS=${{ env.TEST_FLAGS }} -E valgrind*" >> "$GITHUB_ENV"
- name: ASAN dynamic library
if: matrix.with-asan == true && matrix.os == 'macos-latest'
shell: bash -l {0}
run: |
echo "DYLD_INSERT_LIBRARIES=$(clang -print-file-name=libclang_rt.asan_osx_dynamic.dylib)" >> "$GITHUB_ENV"
- name: ELF config flags
if: matrix.with-elf == false
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_ELF=OFF" >> "$GITHUB_ENV"
- name: Valgrind on config flags
if: matrix.with-valgrind == true
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_ENABLE_INSTRUMENTATION_OPT=OFF -DYGGDRASIL_DISABLE_PYTHON_C_API=ON" >> "$GITHUB_ENV"
- name: Valgrind off config flags
if: matrix.with-valgrind == false
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DYGG_SKIP_VALGRIND_TESTS=ON" >> "$GITHUB_ENV"
- name: Pip config flags
if: matrix.python-install == 'pip'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DPython3_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DPython3_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
- name: Conda config flags
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} -DCMAKE_PREFIX_PATH=${CONDA_PREFIX}" >> "$GITHUB_ENV"
- name: Pip config flags on Windows
if: matrix.python-install == 'pip' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
# echo "PYTHON_CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }} \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
echo "PYTHON_CONFIG_FLAGS=${{ env.PYTHON_CONFIG_FLAGS }} --config-settings=cmake.define.CMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows --config-settings=cmake.define.Python3_ROOT_DIR=${{ env.pythonLocation }} --config-settings=cmake.define.Python_ROOT_DIR=${{ env.pythonLocation }}" >> "$GITHUB_ENV"
# echo "CONFIG_FLAGS=${{ env.CONFIG_FLAGS }} \"-DPython3_EXECUTABLE=${{ env.pythonLocation }}\python.exe\" \"-DCMAKE_PREFIX_PATH=${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\"" >> "$GITHUB_ENV"
###################################
# Add paths for Windows dlls
###################################
- name: Vcpkg library paths on Windows
if: matrix.python-install == 'pip' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
# DLL_DIRECTORY="${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin"
DLL_DIRECTORY="${VCPKG_INSTALLATION_ROOT}\installed\x64-windows\debug\bin"
ls ${DLL_DIRECTORY}
echo "${DLL_DIRECTORY}" >> $GITHUB_PATH
- name: Conda library paths on Windows
if: matrix.python-install == 'conda' && matrix.os == 'windows-latest'
shell: bash -l {0}
run: |
DLL_DIRECTORY="${CONDA_PREFIX}/Library/lib"
ls ${DLL_DIRECTORY}
echo "${DLL_DIRECTORY}" >> $GITHUB_PATH
###################################
# Check
###################################
- name: Check for numpy (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
python -c "import sys; print(sys.executable)"
python -c "import numpy; print(numpy.get_include())"
- name: Check for numpy (PIP)
if: matrix.python-install == 'pip'
run: |
python -c "import sys; print(sys.executable)"
python -c "import numpy; print(numpy.get_include())"
###################################
# Configure
###################################
- name: Configure (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
mkdir build
cd build
cmake .. ${{ env.CONFIG_FLAGS }}
- name: Configure (PIP)
if: matrix.python-install == 'pip'
run: |
mkdir build
cd build
cmake .. ${{ env.CONFIG_FLAGS }}
###################################
# Build CPP & C
###################################
- name: Build C++ & C (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
cd build
cmake --build . --config Debug
- name: Build C++ & C (PIP)
if: matrix.python-install == 'pip'
run: |
cd build
cmake --build . --config Debug
###################################
# Build Python
###################################
- name: Set CMAKE_ARGS for Python build
shell: bash -l {0}
run: |
echo "CMAKE_ARGS=${{ env.PYTHON_CMAKE_ARGS }}" >> "$GITHUB_ENV"
- name: Build Python (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
pip install . -v ${{ env.PYTHON_CONFIG_FLAGS }}
- name: Build Python (PIP)
if: matrix.python-install == 'pip'
run: |
pip install . -v ${{ env.PYTHON_CONFIG_FLAGS }}
###################################
# Test CPP & C
###################################
- name: Test C++ & C Interfaces (CONDA)
if: matrix.python-install == 'conda'
shell: bash -l {0}
run: |
cd build
ctest ${{ env.TEST_FLAGS }}
- name: Test C++ & C Interfaces (PIP)
if: matrix.python-install == 'pip'
run: |
cd build
# echo "PATH=${PATH}"
ctest ${{ env.TEST_FLAGS }}
###################################
# Test Python
###################################
- name: Test Python Interfaces (CONDA)
if: matrix.python-install == 'conda' && matrix.with-elf == false && matrix.with-valgrind == false
shell: bash -l {0}
run: |
pytest -sv python/test
# - name: Check for Python Interfaces (PIP)
# # if: matrix.python-install == 'pip' && matrix.with-asan == false && matrix.with-elf == false && matrix.with-valgrind == false
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false
# shell: bash -l {0}
# run: |
# PYTHON_EXEC=${{ steps.pysetup.outputs.python-path }}
# ${PYTHON_EXEC} -m site
# ${PYTHON_EXEC} -c 'import site; print(site.getsitepackages())'
# ls $(${PYTHON_EXEC} -c 'import site; print(site.getsitepackages()[0])')
# ls $(${PYTHON_EXEC} -c 'import os; import site; print(os.path.join(site.getsitepackages()[0], "pyYggdrasil"))')
# - name: Test Python Interfaces w/ LLDB (PIP)
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false && matrix.os == 'macos-latest'
# run: |
# lldb -o 'run' -o 'quit' -- $(which python) -m pytest -svx python/test
# - name: Test Python Interfaces w/ GDB (PIP)
# if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false && matrix.os == 'ubuntu-latest'
# run: |
# gdb --batch -x gdb_commands.txt --args $(which python) -m pytest -svx python/test
- name: Test Python Interfaces (PIP)
if: matrix.python-install == 'pip' && matrix.with-elf == false && matrix.with-valgrind == false
run: |
pytest -sv python/test
###################################
# Coverage
###################################
- name: Upload coverage report
if: matrix.with-coverage == true
uses: codecov/codecov-action@v3
with:
name: ${{ matrix.os }}-${{ matrix.python-install }}-${{ matrix.install-zmq }}-${{ matrix.install-mpi }}-${{ matrix.with-coverage }}-${{ matrix.with-asan }}-${{ matrix.with-elf }}-${{ matrix.with-valgrind }}
token: ${{ secrets.CODECOV_TOKEN }}
file: build/coverage/coverage.info
# directory: build/Testing/CoverageInfo
functionalities: gcov