Skip to content

new examples & smoke tests: Gedzelman & Arnold 1994 fig 2, Miyake et al. 1968 fig 19; isotope diffusivity ratios in Formulae (Graham's law; Stewart 1975; Hellmann & Harvey); isotope relaxation timescales formulae (Miyake); new ventilation test based on Kinzer & Gunn 1951 table 1; null refactor in Formulae; access to RogersYau terminal vel. from Formulae #1366

new examples & smoke tests: Gedzelman & Arnold 1994 fig 2, Miyake et al. 1968 fig 19; isotope diffusivity ratios in Formulae (Graham's law; Stewart 1975; Hellmann & Harvey); isotope relaxation timescales formulae (Miyake); new ventilation test based on Kinzer & Gunn 1951 table 1; null refactor in Formulae; access to RogersYau terminal vel. from Formulae

new examples & smoke tests: Gedzelman & Arnold 1994 fig 2, Miyake et al. 1968 fig 19; isotope diffusivity ratios in Formulae (Graham's law; Stewart 1975; Hellmann & Harvey); isotope relaxation timescales formulae (Miyake); new ventilation test based on Kinzer & Gunn 1951 table 1; null refactor in Formulae; access to RogersYau terminal vel. from Formulae #1366

name: tests+artifacts+pypi
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'
release:
types: [published]
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: 3.8
- run: |
pip install pre-commit
pre-commit clean
pre-commit autoupdate
pre-commit run --all-files
- if: ${{ failure() }}
run: git diff
nojit_and_codecov:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: 1
steps:
- uses: actions/checkout@master
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@master
with:
python-version: 3.9
- name: Generate coverage report
run: |
pip install -e .[tests]
pip install -e ./examples
pip install pytest-cov
pytest --durations=10 -We tests/unit_tests --cov-report=xml --cov=PySDM
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/[email protected]
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
pdoc:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/[email protected]
with:
submodules: recursive
persist-credentials: false
- uses: actions/[email protected]
with:
python-version: 3.9
- run: |
pip install pdoc3
pip install -e .
pip install -e examples
python -We -m pdoc --html PySDM examples/PySDM_examples
python -We .github/workflows/pdoc_index_workaround.py
- if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }}
uses: JamesIves/[email protected]
with:
BRANCH: pdoc
FOLDER: html
CLEAN: true
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/[email protected]
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# TODO #1160 https://github.com/pylint-dev/pylint/issues/9099
pip install "pylint<3.0.0" nbqa
pip install pdoc3 # (pdoc3 for checking the .github/workflows/pdoc_index_workaround.py)
pip install -r tests/devops_tests/requirements.txt
pip install -e ./examples[tests]
pip install -e .[tests]
- run: |
# TODO #682
pylint --unsafe-load-any-extension=y --disable=fixme,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials)
- run: |
# TODO #682
pylint --max-module-lines=550 --unsafe-load-any-extension=y --disable=fixme,too-many-function-args,unsubscriptable-object,consider-using-with,protected-access,too-many-statements,too-many-public-methods,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,missing-class-docstring,too-many-locals,too-many-instance-attributes,too-few-public-methods,too-many-arguments,c-extension-no-member $(git ls-files '*.py' | grep ^examples)
- run: |
# TODO #682
nbqa pylint --unsafe-load-any-extension=y --disable=fixme,duplicate-code,invalid-name,trailing-whitespace,line-too-long,missing-function-docstring,wrong-import-position,missing-module-docstring,wrong-import-order,ungrouped-imports,no-member,too-many-locals,unnecessary-lambda-assignment $(git ls-files '*.ipynb')
zenodo_json:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: notiz-dev/github-action-json-property@release
with:
path: '.zenodo.json'
prop_path: 'creators'
tests:
needs: [pylint, pdoc, nojit_and_codecov, precommit, zenodo_json]
strategy:
matrix:
platform: [ubuntu-latest, macos-12, windows-latest]
python-version: ["3.8", "3.11"]
test-suite: ["unit_tests/!(dynamics)", "unit_tests/dynamics/!(condensation)", "unit_tests/dynamics/condensation", "smoke_tests/no_env", "smoke_tests/box", "smoke_tests/parcel_a", "smoke_tests/parcel_b", "smoke_tests/parcel_c", "smoke_tests/kinematic_1d", "smoke_tests/kinematic_2d", "tutorials_tests"]
exclude:
- test-suite: "devops_tests"
python-version: "3.8"
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 40
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .
# sanity check if we do not depend on something from tests extras
- run: python -We -c "import PySDM"
- if: startsWith(matrix.test-suite, 'smoke_tests') || matrix.test-suite == 'tutorials_tests'
run: pip install -e ./examples
- run: pip install -e .[tests] # incl. ensuring that the previous pip did not overwrite the package
# install devops_tests for tutorials_tests
- if: matrix.test-suite == 'tutorials_tests'
run: pip install -r tests/devops_tests/requirements.txt
# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- name: Run pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBA_OPT: 1
run: |
shopt -s extglob
pytest --durations=10 --timeout=900 --timeout_method=thread -p no:unraisableexception -We tests/${{ matrix.test-suite }}
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
examples-setup:
strategy:
matrix:
platform: [ubuntu-22.04, macos-12, windows-latest]
python-version: ["3.8", "3.11"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- run: |
echo pip_user_site=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") >> $GITHUB_ENV
echo toml_ci_md5=$(cat pyproject.toml setup.py examples/pyproject.toml examples/setup.py tests/devops_tests/requirements.txt .github/workflows/tests+artifacts+pypi.yml \
| python -c "import hashlib;print(hashlib.md5(open(0,'rb').read()).hexdigest())") >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.pip_user_site }}
key: examples_pip_cache-${{ matrix.platform }}-${{ matrix.python-version }}-${{ env.toml_ci_md5 }}
- if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade --user pip
python -m pip install -e . ./examples
python -m pip install -r tests/devops_tests/requirements.txt
- if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.pip_user_site }}
key: examples_pip_cache-${{ matrix.platform }}-${{ matrix.python-version }}-${{ env.toml_ci_md5 }}
examples:
needs: [pylint, precommit, examples-setup]
strategy:
matrix:
platform: [ubuntu-22.04, macos-12, windows-latest]
python-version: ["3.8", "3.11"]
test-suite: [ "chemistry_freezing_isotopes", "condensation_a", "condensation_b", "coagulation", "breakup", "multi-process_a", "multi-process_b"]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: 45
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- run: |
echo pip_user_site=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") >> $GITHUB_ENV
echo toml_ci_md5=$(cat pyproject.toml setup.py examples/pyproject.toml examples/setup.py tests/devops_tests/requirements.txt .github/workflows/tests+artifacts+pypi.yml \
| python -c "import hashlib;print(hashlib.md5(open(0,'rb').read()).hexdigest())") >> $GITHUB_ENV
- run: |
rm -rf $pip_user_site
- id: cache
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
path: ${{ env.pip_user_site }}
key: examples_pip_cache-${{ matrix.platform }}-${{ matrix.python-version }}-${{ env.toml_ci_md5 }}
# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- if: startsWith(matrix.platform, 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get install python3-paraview
- if: startsWith(matrix.platform, 'macos-')
run: |
brew install --cask paraview
echo `dirname /Applications/ParaView-*.app/Contents/bin/pvpython | head -1` >> $GITHUB_PATH
- if: matrix.platform != 'windows-latest'
run: pvpython --version
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m pytest --durations=10 -v -p no:unraisableexception -We tests/examples_tests/test_tests_completeness.py
python -m pytest --durations=10 -v -p no:unraisableexception -We tests/examples_tests/test_run* --suite ${{ matrix.test-suite }}
devops:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- run: pip install -r tests/devops_tests/requirements.txt
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pytest --durations=10 -v -s -We -p no:unraisableexception -k "not test_run_notebooks" tests/devops_tests
package:
strategy:
matrix:
packages-dir: [".", "examples"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/[email protected]
with:
python-version: "3.11"
- run: pip install twine build
- run: |
unset CI
cd ${{ matrix.packages-dir }}
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | grep -v impl_numba/warnings.py | grep -v "no previously-included files matching" | wc -l`
twine check --strict dist/*
- uses: actions/upload-artifact@v3
with:
path: ${{ matrix.packages-dir}}/dist
name: dist
pkg_install_check:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.11"]
runs-on: ${{ matrix.platform }}
needs: [package]
steps:
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: pip install dist/*.whl
- run: python -c "import PySDM; print(PySDM.__version__)"
- run: python -c "import PySDM_examples; print(PySDM_examples.__version__)"
publish:
runs-on: ubuntu-latest
needs: [tests, examples, devops, package, pkg_install_check]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- 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/
packages-dir: dist
- if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
packages-dir: dist