33name : main
44
55on :
6- schedule :
7- - cron : ' * * * * 5' # Runs on every Friday.
86 push :
97 branches : [ '*', $default-branch ]
108 tags : ['[0-9]*'] # anything looks like a version.
@@ -24,78 +22,110 @@ jobs:
2422 defaults :
2523 run :
2624 shell : bash -l {0} # for conda.
27-
2825 strategy :
2926 fail-fast : false
3027 matrix :
3128 os : [ ubuntu-latest, macos-latest ]
32- numpy-version : [ 1.16 ]
33- python-version : [ 3.8 ]
34- include :
35- - {deploy: true, os: ubuntu-latest, numpy-version: 1.16, python-version: 3.8 }
29+ python-version : [ '3.8', '3.10', '3.13' ]
30+ # Something seems wrong with the conda packages for these python versions.
31+ # pip --upgrade fails for 3.13 and for 3.10 there is an import error.
32+ exclude :
33+ - os : macos-latest
34+ python-version : ' 3.10'
35+ - os : macos-latest
36+ python-version : ' 3.13'
3637 steps :
37-
3838 - name : Checkout source code
39- uses : actions/checkout@v2
40-
39+ uses : actions/checkout@v4
4140 - name : Cache conda
42- uses : actions/cache@v1
41+ if : matrix.os == 'macos-latest'
42+ uses : actions/cache@v4
4343 env :
4444 # Increase this value to reset cache.
4545 CACHE_NUMBER : 0
4646 with :
4747 path : ~/conda_pkgs_dir
4848 key :
4949 ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}
50-
5150 - name : Setup Conda Environment
52- uses : conda-incubator/setup-miniconda@v2.0.1
51+ if : matrix.os == 'macos-latest'
52+ uses : conda-incubator/setup-miniconda@v3.2.0
5353 with :
5454 activate-environment : test
5555 channels : bccp,conda-forge
5656 show-channel-urls : true
5757 use-only-tar-bz2 : true
5858 auto-update-conda : true
5959 python-version : ${{ matrix.python-version }}
60-
61- - name : Setup test env
60+ - name : Setup mac test env
61+ if : matrix.os == 'macos-latest'
6262 run : |
6363 conda install -q -y \
6464 python=${{ matrix.python-version }} \
65- numpy=${{ matrix.numpy-version }} \
66- nose cython mpi4py \
67- compilers
68- conda install -q -y cmake gsl
69- conda install -q -y runtests
70-
65+ numpy cython mpi4py compilers
66+ conda install -q -y cmake gsl pytest pytest-mpi python-build
67+ - name : Setup linux test env
68+ if : matrix.os == 'ubuntu-latest'
69+ run : |
70+ sudo apt update
71+ sudo apt install -y build-essential libopenmpi-dev openmpi-bin python3-numpy cython3 python3-mpi4py cmake libgsl-dev
72+ python -m pip install --upgrade pip
73+ pip install build pytest pytest-mpi
74+ - name : Build
75+ run : |
76+ python -m build
77+ - name : Install
78+ run : |
79+ python -m pip install --user dist/bigfile*whl
80+ - name : Build in place for tests
81+ run : |
82+ python setup.py build_ext --inplace
7183 - name : Build C
7284 run : |
73- mkdir build
74- cd build
85+ mkdir Cbuild
86+ cd Cbuild
7587 cmake -DCMAKE_INSTALL_PREFIX:PATH=install ..
7688 make install
77-
7889 - name : C Unit tests
7990 run : |
80- mpirun -n 4 build/utils/bigfile-iosim -n 1 -s 1024000 create test
81- mpirun -n 4 build/utils/bigfile-iosim -n 1 -s 1024000 read test
82- mpirun -n 4 build/utils/bigfile-iosim -n 4 -s 1024000 read test
83- mpirun -n 4 build/utils/bigfile-iosim -A -n 1 -s 1024000 read test
84- mpirun -n 4 build/utils/bigfile-iosim -A -n 4 -s 1024000 read test
85- mpirun -n 8 build/utils/bigfile-iosim -A -n 2 -s 1024000 read test
86-
91+ mpirun -n 4 Cbuild/utils/bigfile-iosim -n 1 -s 1024000 create test
92+ mpirun -n 4 Cbuild/utils/bigfile-iosim -n 1 -s 1024000 read test
93+ mpirun -n 4 Cbuild/utils/bigfile-iosim -n 4 -s 1024000 read test
94+ mpirun -n 4 Cbuild/utils/bigfile-iosim -A -n 1 -s 1024000 read test
95+ mpirun -n 4 Cbuild/utils/bigfile-iosim -A -n 4 -s 1024000 read test
96+ mpirun -n 8 Cbuild/utils/bigfile-iosim -A -n 2 -s 1024000 read test
8797 - name : Python Unit tests
8898 run : |
89- python ./runtests.py
90-
91- - name : Build Python sdist
92- if : startsWith(github.ref, 'refs/tags') && matrix.deploy
99+ python -m pytest --with-mpi
100+ mpirun -n 2 python -m pytest --with-mpi
101+ mpirun -n 4 --oversubscribe python -m pytest --with-mpi
102+ - name : Build Python dist
103+ if : matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags')
93104 run : |
94105 bash check_tag.sh "${GITHUB_REF##*/}" bigfile/version.py
95- python setup.py sdist
106+ - name : Store the distribution packages
107+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' # Only do this once!
108+ uses : actions/upload-artifact@v4
109+ with :
110+ name : python-package-distributions
111+ path : dist/bigfile*.tar.gz
96112
97- - name : Publish distribution to PyPI
98- uses : pypa/gh-action-pypi-publish@master
99- if : startsWith(github.ref, 'refs/tags') && matrix.deploy
113+ publish-to-pypi :
114+ name : Publish to PyPI
115+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
116+ needs :
117+ - build
118+ runs-on : ubuntu-latest
119+ environment :
120+ name : pypi
121+ url : https://pypi.org/p/bigfile
122+ permissions :
123+ id-token : write # IMPORTANT: mandatory for trusted publishing
124+ steps :
125+ - name : Download the source dist
126+ uses : actions/download-artifact@v4
100127 with :
101- password : ${{ secrets.PYPI_SECRET }}
128+ name : python-package-distributions
129+ path : dist/
130+ - name : Publish distribution to PyPI
131+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments