Phip fix #144
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
# This file is based on examples in | |
# https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
CI: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.8, 3.9, "3.10"] | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
# First print out lots of information. We do this in separate | |
# "name" blocks because otherwise the output gets mixed together | |
# in the github actions log. | |
- name: Print user and group id | |
run: id | |
- name: PWD | |
run: pwd | |
- name: apt-get any needed packages | |
if: "contains(matrix.os, 'ubuntu')" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential git cmake libnetcdf-dev | |
# In the future, if we want to add MPI, we'd need to also install "openmpi-bin libopenmpi-dev" | |
- name: get any needed packages from homebrew | |
if: "contains(matrix.os, 'macos')" | |
run: | | |
brew install netcdf | |
# If we want to add MPI in the future, uncomment the next line: | |
#brew install open-mpi | |
- name: Print versions | |
run: | | |
cmake --version | |
#which mpicc | |
#which mpiexec | |
#mpicc --version | |
- uses: actions/checkout@v3 | |
# If we want submodules downloaded, uncomment the next 2 lines: | |
#with: | |
# submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: which python after python setup | |
run: python --version | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
#- name: Install required python packages | |
# run: | | |
# pip install wheel numpy jax jaxlib | |
- name: env after adding python | |
run: env | |
- name: Install | |
run: pip install -v . | |
- name: Try import | |
run: python -c "import booz_xform as bx; b = bx.Booz_xform()" | |
- name: Install python packages that are required for the tests. | |
run: | | |
pip install scipy matplotlib | |
- name: Run python unit tests | |
run: python3 -m unittest -v | |
# To run the C++ unit tests, it seems best to build them separately from the python package system, because we don't want these unit tests to be installed. It seems unnecessary to build them again, but the little bit of time this takes is not important. | |
- name: Install python packages required for standalone build | |
run: pip install pybind11 | |
- name: Configure CMake | |
run: | | |
if [ -d build ]; then rm -rf build; fi | |
mkdir build | |
cd build | |
cmake .. | |
- name: Build C++ unit tests | |
run: | | |
cd build | |
make -j unitTests | |
- name: Run C++ unit tests | |
run: | | |
cd build | |
./unitTests |