Add auto publish #77
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
# Author - Stuart McAlpine - December 2022 | |
name: read_swift CI | |
# How does the workflow get triggered? | |
on: | |
# Triggers when push/pull-request made to the main branch. | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
# List of jobs for this workflow. | |
jobs: | |
ci-with-pytest-mpi: | |
# Our strategy lists the OS and Python versions we want to test on. | |
strategy: | |
# Don't quit all jobs if only one job fails. | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: ["ubuntu-latest"] | |
# What operating system is this job running on? | |
runs-on: ${{ matrix.os }} | |
# Our CI steps for this job. | |
steps: | |
# Check out this repository code. | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Install Python. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install OpenMPI and HDF5 libs | |
- name: Install OpenMPI and HDF5 | |
run: | | |
sudo apt-get update | |
sudo apt install -y libopenmpi-dev libhdf5-mpi-dev | |
# Install py_Read_swift. | |
- name: Install pyread_swift | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install . | |
python3 -m pip uninstall -y h5py | |
MPICC=mpicc CC=mpicc HDF5_MPI="ON" python3 -m pip install --no-binary=h5py h5py | |
python3 -m pip install pytest-mpi | |
cd .. | |
# Perform unit tests. | |
- name: Test with pytest | |
run: | | |
cd tests | |
bash get_ics.sh | |
mpirun -np 2 pytest --with-mpi test_read_mpi.py | |
ci-with-pytest: | |
# Our strategy lists the OS and Python versions we want to test on. | |
strategy: | |
# Don't quit all jobs if only one job fails. | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: ["ubuntu-latest"] | |
# What operating system is this job running on? | |
runs-on: ${{ matrix.os }} | |
# Our CI steps for this job. | |
steps: | |
# Check out this repository code. | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Install Python. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install MPI / mpi4py | |
- name: Setup MPI | |
uses: mpi4py/setup-mpi@v1 | |
with: | |
mpi: openmpi | |
# Install dependencies. | |
- name: Install pip and read_swift | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install . | |
python3 -m pip install pytest | |
# Perform unit tests. | |
- name: Test with pytest | |
run: | | |
cd tests | |
bash get_ics.sh | |
pytest test_read.py |