11# main test workflow; ported from .travis.yaml
22
3-
43name : main
54
65on :
7- schedule :
8- - cron : ' 0 0 * * 5' # Runs on every Friday.
96 push :
107 branches : [ '*', $default-branch ]
118 tags : ['[0-9]*'] # anything looks like a version.
@@ -17,79 +14,64 @@ jobs:
1714 runs-on : ${{ matrix.os }}
1815 env :
1916 OMP_NUM_THREADS : 1
20-
2117 defaults :
2218 run :
2319 shell : bash -l {0} # for conda.
24-
2520 strategy :
26- fail-fast : false
2721 matrix :
28- os : [ ubuntu-latest, macos-latest ]
29- numpy-version : [ '1.20' ]
30- python-version : [ 3.8 ]
31- include :
32- - {deploy: true, os: ubuntu-latest, numpy-version: '1.20', python-version: 3.8 }
22+ os : [ubuntu-latest]
23+ python-version : [ '3.8', '3.10', '3.13' ]
3324 steps :
34-
3525 - name : Checkout source code
36- uses : actions/checkout@v2
37-
38- - name : Cache conda
39- uses : actions/cache@v1
40- env :
41- # Increase this value to reset cache.
42- CACHE_NUMBER : 0
43- with :
44- path : ~/conda_pkgs_dir
45- key :
46- ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}
47-
48- - name : Setup Conda Environment
49- uses :
conda-incubator/[email protected] 50- with :
51- activate-environment : test
52- channels : bccp
53- show-channel-urls : true
54- use-only-tar-bz2 : false
55- auto-update-conda : true
56- python-version : ${{ matrix.python-version }}
57-
26+ uses : actions/checkout@v4
5827 - name : Setup test env
5928 run : |
60- conda install -q -y \
61- python=${{ matrix.python-version }} \
62- numpy=${{ matrix.numpy-version }} \
63- nose cython mpi4py \
64- --file requirements.txt \
65- --file requirements-extras.txt
66-
67- # submitting coverage to coveralls
68- pip install coveralls
69- # install nbodykit itself
70- pip install .[extras]
71- conda list --explicit
72-
73- - name : Install Compilers
29+ sudo apt update
30+ 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
31+ python -m pip install --upgrade pip
32+ pip install build pytest pytest-mpi
33+ pip install -r requirements.txt
34+ pip install -r requirements-extras.txt
35+ - name : Build
7436 run : |
75- if [ "$RUNNER_OS" == "macOS" ]; then
76- conda install -q -y clang_osx-64 clangxx_osx-64 gfortran_osx-64
77- else
78- conda install -q -y gcc_linux-64 gxx_linux-64 gfortran_linux-64
79- fi
80-
37+ python -m build
38+ - name : Install
39+ run : |
40+ python -m pip install --user dist/nbodykit*whl
41+ - name : Build in place for tests
42+ run : |
43+ python setup.py build_ext --inplace
8144 - name : Python Unit tests
8245 run : |
83- python run-tests.py -v --mpirun='mpirun -n 4' --with-coverage
84-
85- - name : Build Python sdist
86- if : startsWith(github.ref, 'refs/tags') && matrix.deploy
46+ cd nbodykit
47+ python -m pytest --with-mpi
48+ - name : MPI Unit tests
8749 run : |
88- bash check_tag.sh "${GITHUB_REF##*/}" bigfile/version.py
89- python setup.py sdist
50+ cd nbodykit
51+ mpirun -n 4 --oversubscribe python -m pytest --with-mpi
52+ - name : Store the distribution packages
53+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' # Only do this once!
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : python-package-distributions
57+ path : dist/nbodykit*.tar.gz
9058
91- - name : Publish distribution to PyPI
92- uses : pypa/gh-action-pypi-publish@master
93- if : startsWith(github.ref, 'refs/tags') && matrix.deploy
59+ publish-to-pypi :
60+ name : Publish to PyPI
61+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
62+ needs :
63+ - build
64+ runs-on : ubuntu-latest
65+ environment :
66+ name : pypi
67+ url : https://pypi.org/p/nbodykit
68+ permissions :
69+ id-token : write # IMPORTANT: mandatory for trusted publishing
70+ steps :
71+ - name : Download the source dist
72+ uses : actions/download-artifact@v4
9473 with :
95- password : ${{ secrets.PYPI_SECRET }}
74+ name : python-package-distributions
75+ path : dist/
76+ - name : Publish distribution to PyPI
77+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments