Skip to content

Adjust tests so we don't try the benchmarking #487

Adjust tests so we don't try the benchmarking

Adjust tests so we don't try the benchmarking #487

Workflow file for this run

# main test workflow; ported from .travis.yaml
name: main
on:
push:
branches: [ '*', $default-branch ]
tags: ['[0-9]*'] # anything looks like a version.
pull_request:
branches: [ $default-branch ]
jobs:
build:
runs-on: ${{ matrix.os }}
env:
OMP_NUM_THREADS: 1
defaults:
run:
shell: bash -l {0} # for conda.
strategy:
matrix:
os: [ubuntu-latest]
python-version: [ '3.8', '3.10', '3.13' ]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup test env
run: |
sudo apt update
sudo apt install -y build-essential libopenmpi-dev openmpi-bin python3-numpy python3-scipy python3-mpi4py python3-sympy python3-astropy cython3 python3-dask python3-pandas python3-h5py libgsl-dev
python -m pip install --upgrade pip
pip install build pytest pytest-mpi
pip install -r requirements.txt
pip install -r requirements-extras.txt
- name: Build
run: |
python -m build
- name: Install
run: |
python -m pip install --user dist/nbodykit*whl
- name: Build in place for tests
run: |
python setup.py build_ext --inplace
- name: Python Unit tests
run: |
cd nbodykit
mpirun -n 1 python -m pytest --with-mpi
mpirun -n 2 python -m pytest --with-mpi
mpirun -n 4 --oversubscribe python -m pytest --with-mpi
cd ../
- name: Store the distribution packages
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' #Only do this once!
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/nbodykit*.tar.gz
publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nbodykit
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download the source dist
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1