tests+pypi #240
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: tests+pypi | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 13 * * 4' | |
release: | |
types: [published] | |
jobs: | |
pylint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: mpi4py/setup-mpi@v1 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint==2.14.5 | |
python setup.py egg_info | |
ex -sc 'g/^\[tests\]$/d' -cx numba_mpi.egg-info/requires.txt | |
pip install -r numba_mpi.egg-info/requires.txt | |
- name: Analysing the code with pylint | |
run: | | |
pylint --unsafe-load-any-extension=y --disable=fixme $(git ls-files '*.py') | |
precommit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.10" | |
- name: Linting | |
run: | | |
pip install pre-commit | |
pre-commit clean | |
pre-commit autoupdate | |
pre-commit run --all-files | |
pdoc: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- uses: mpi4py/setup-mpi@v1 | |
- name: Build | |
run: | | |
pip install pdoc3 | |
pip install -e . | |
python -We -m pdoc --html numba_mpi | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
uses: JamesIves/github-pages-deploy-action@4.1.1 | |
with: | |
BRANCH: pdoc | |
FOLDER: html/numba_mpi | |
CLEAN: true | |
zenodo_json: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: notiz-dev/github-action-json-property@release | |
with: | |
path: '.zenodo.json' | |
prop_path: 'creators' | |
build: | |
needs: [pylint, precommit, pdoc, zenodo_json] | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-12, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
mpi: [ 'mpich', 'openmpi', 'msmpi', 'intelmpi'] | |
exclude: | |
- platform: macos-12 | |
mpi: msmpi | |
- platform: macos-12 | |
mpi: intelmpi | |
- platform: ubuntu-latest | |
mpi: msmpi | |
- platform: windows-latest | |
mpi: mpich | |
- platform: windows-latest | |
mpi: openmpi | |
- platform: windows-latest | |
mpi: intelmpi | |
# https://github.com/numba-mpi/numba-mpi/issues/69 | |
- platform: ubuntu-latest | |
python-version: 3.8 | |
mpi: mpich | |
- platform: ubuntu-latest | |
python-version: 3.9 | |
mpi: mpich | |
fail-fast: false | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: mpi4py/setup-mpi@v1 | |
with: | |
mpi: ${{ matrix.mpi }} | |
- if: matrix.mpi == 'intelmpi' | |
run: | | |
# checking if multiple MPI libs are OK | |
sudo apt-get install mpi-default-bin | |
mpiexec python -c "import os; assert 'I_MPI_ROOT' in os.environ" | |
- run: pip install -e .[tests] | |
- run: python -We -c "import mpi4py" | |
- run: python -We -c "import numba_mpi" | |
- run: mpiexec -n 2 pytest --durations=10 -p no:unraisableexception -We | |
dist: | |
runs-on: ubuntu-latest | |
needs: [build] | |
permissions: | |
id-token: write | |
steps: | |
- uses: mpi4py/setup-mpi@v1 | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- run: pip install twine build | |
- run: | | |
unset CI | |
python -m build 2>&1 | tee build.log | |
exit `fgrep -i warning build.log | grep -v "tool.setuptools_scm" | wc -l` | |
- run: twine check --strict dist/* | |
- run: | | |
python setup.py egg_info | |
ex -sc 'g/^\[tests\]$/d' -cx numba_mpi.egg-info/requires.txt | |
pip install -r numba_mpi.egg-info/requires.txt | |
pip install --no-index --find-links file:./dist numba-mpi | |
cd /tmp # make sure local files are not picked up | |
python -We -c "import numba_mpi" | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@unstable/v1 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
- if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@unstable/v1 |