Merge pull request #226 from hmcezar/main #360
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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/docs/buildDocs.sh') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Cache PLUMED | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/opt | |
~/.ccache | |
key: ccache-v2-${{ runner.os }}-${{ github.sha }} | |
restore-keys: ccache-v2-${{ runner.os }}- | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3-mpi4py python3-numpy python3-distutils | |
sudo apt-get install -y libhdf5-openmpi-dev libfftw3-3 libfftw3-dev | |
- name: Install python dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade wheel numpy mpi4py "cython<3" | |
CC="mpicc" HDF5_MPI="ON" python3 -m pip install --no-binary=h5py h5py | |
python3 -m pip install -r requirements.txt | |
- name: Install PLUMED | |
run: | | |
mkdir -p $HOME/opt/ | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y openmpi-bin libopenmpi-dev git | |
sudo apt-get install gsl-bin libgsl0-dev libboost-serialization-dev | |
sudo apt-get install -y ccache | |
sudo ln -s ccache /usr/local/bin/mpic++ | |
export PATH=/usr/lib/ccache:${PATH} | |
git clone https://github.com/plumed/plumed2.git $HOME/plumed2 | |
ccache -s | |
CXX="mpic++" PYTHON_BIN=python3 .ci/install.plumed program_path=$HOME/plumed2 | |
ccache -s | |
- name: Install PLUMED python wrapper | |
run: | | |
current_path=$PWD | |
cd $HOME/plumed2/python | |
make pip | |
python3 -m pip install . | |
cd $current_path | |
- name: Install package | |
run: | | |
python3 -m pip install . | |
- name: Test with pytest | |
run: | | |
python3 -m pip install pytest pytest-cov pytest-mpi coverage | |
export PLUMED_KERNEL=$HOME/opt/lib/libplumedKernel.so | |
pytest --cov=./ | |
chmod +x pytest-mpi | |
./pytest-mpi -c -ca -n 2 -ns -oo -s -lc -v | |
- name: Coverage report and upload | |
run: | | |
coverage report | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |