Skip to content

add effective saturation wrt ice/liquid from Jouzel&Merlivat 1984 #1255

add effective saturation wrt ice/liquid from Jouzel&Merlivat 1984

add effective saturation wrt ice/liquid from Jouzel&Merlivat 1984 #1255

Workflow file for this run

name: tests
defaults:
run:
shell: bash
env:
# arbitrarily selected runs for generating animation
anim_python-version: '3.12'
anim_test-suite: 'multi-process_a'
# common options for pytest
pytest_options: "--durations=10 -v -s -We -p no:unraisableexception"
on:
push:
branches: [ main ]
paths-ignore: ['docs/**', '**.md']
pull_request:
branches: [ main ]
paths-ignore: ['docs/**', '**.md']
schedule:
- cron: '0 13 * * 4'
jobs:
pylint:
runs-on: ubuntu-24.04
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 -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')
nojit_and_codecov:
needs: [pylint]
runs-on: ubuntu-24.04
env:
NUMBA_DISABLE_JIT: 1
steps:
- uses: actions/[email protected]
with:
submodules: recursive
fetch-depth: 0
- uses: actions/[email protected]
with:
python-version: 3.9
- name: Generate coverage report
run: |
pip install -e .[tests]
pip install -e ./examples
pip install pytest-cov
pytest ${{ env.pytest_options }} tests/unit_tests --cov-report=xml --cov=PySDM
- uses: codecov/[email protected]
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
tests:
needs: [nojit_and_codecov]
strategy:
matrix:
platform: [ubuntu-24.04, macos-13, macos-14, windows-latest]
python-version: ["3.9", "3.12"]
test-suite: ["unit_tests/!(dynamics)", "unit_tests/dynamics/!(condensation|collisions)", "unit_tests/dynamics/condensation", "unit_tests/dynamics/collisions","smoke_tests/no_env", "smoke_tests/box", "smoke_tests/parcel_a", "smoke_tests/parcel_b", "smoke_tests/parcel_c", "smoke_tests/parcel_d", "smoke_tests/kinematic_1d", "smoke_tests/kinematic_2d", "tutorials_tests"]
exclude:
- platform: "macos-14"
python-version: "3.9"
- test-suite: "devops_tests"
python-version: "3.9"
# TODO #1406
- platform: "macos-14"
test-suite: "smoke_tests/box"
- platform: "macos-14"
test-suite: "smoke_tests/parcel_a"
- platform: "macos-14"
test-suite: "smoke_tests/parcel_d"
- platform: "macos-14"
test-suite: "smoke_tests/kinematic_2d"
- platform: "macos-14"
test-suite: "unit_tests/!(dynamics)"
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 40 || 30 }}
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
# incl. ensuring that the previous pip did not overwrite the package
- run: |
pip install --only-binary :all: -e .[tests]
# 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 ${{ env.pytest_options }} --timeout=900 --timeout_method=thread tests/${{ matrix.test-suite }}
examples-setup:
needs: [nojit_and_codecov]
strategy:
matrix:
platform: [ubuntu-24.04, macos-13, windows-latest]
python-version: ["3.9", "3.12"]
runs-on: ${{ matrix.platform }}
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.yml \
| python -c "import hashlib;print(hashlib.md5(open(0,'rb').read()).hexdigest())") >> $GITHUB_ENV
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.pip_user_site }}
key: examples_pip_cache-${{ matrix.platform }}-${{ matrix.python-version }}-${{ env.toml_ci_md5 }}
lookup-only: true
- if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip uninstall -y jupyterlab-server # https://github.com/pypa/pip/issues/6275
python -m pip install -e . -e ./examples
python -m pip install pytest-timeout
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: [examples-setup]
strategy:
matrix:
platform: [ubuntu-24.04, macos-13, windows-latest]
python-version: ["3.9", "3.12"]
test-suite: [ "chemistry_extraterrestrial", "freezing", "isotopes", "condensation_a", "condensation_b", "condensation_c", "coagulation", "breakup", "multi-process_a", "multi-process_b", "multi-process_c", "multi-process_d", "multi-process_e"]
fail-fast: false
runs-on: ${{ matrix.platform }}
timeout-minutes: ${{ startsWith(matrix.platform, 'windows-') && 40 || 30 }}
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.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-') && (matrix.test-suite == 'multi-process_a' || matrix.test-suite == 'multi-process_b')
run: |
sudo apt-get update
sudo apt-get install libegl1 libopengl0 ghostscript ffmpeg
wget -nv "https://paraview.org/paraview-downloads/download.php?submit=Download&version=v5.13&type=binary&os=Linux&downloadFile=ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz" -O paraview.tar.gz
tar xzf paraview.tar.gz
echo `pwd`/`dirname ParaView*/bin/pvpython` >> $GITHUB_PATH
- if: startsWith(matrix.platform, 'macos-') && (matrix.test-suite == 'multi-process_a' || matrix.test-suite == 'multi-process_b')
run: |
brew install --cask paraview
echo `dirname /Applications/ParaView-*.app/Contents/bin/pvpython | head -1` >> $GITHUB_PATH
brew install ghostscript ffmpeg
- if: startsWith(matrix.platform, 'windows-') && (matrix.test-suite == 'multi-process_a' || matrix.test-suite == 'multi-process_b')
run: |
curl "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v5.13&type=binary&os=Windows&downloadFile=ParaView-5.13.1-Windows-Python3.10-msvc2017-AMD64.msi" -o paraview.msi
msiexec //i paraview.msi //quiet //qn //norestart
echo "C:\\Program Files\\ParaView 5.13.1\\bin\\" >> $GITHUB_PATH
- if: matrix.test-suite == (matrix.test-suite == 'multi-process_a' || matrix.test-suite == 'multi-process_b')
run: |
pvpython --version
pvpython -c "from paraview import simple"
- run: |
python -m pytest ${{ env.pytest_options }} tests/examples_tests/test_tests_completeness.py
# TODO #1207
- if: startsWith(matrix.platform, 'macos-13')
run: python -m pytest --basetemp=/tmp/pytest ${{ env.pytest_options }} tests/examples_tests/test_run* -k "not Rozanski_and_Sonntag_1982" --suite ${{ matrix.test-suite }}
- if: ( ! startsWith(matrix.platform, 'macos-13') )
run: python -m pytest ${{ env.pytest_options }} --basetemp=/tmp/pytest --timeout_method=thread --timeout=${{ startsWith(matrix.platform, 'windows-') && 1000 || 900 }} tests/examples_tests/test_run* --suite ${{ matrix.test-suite }}
- if: ( ! startsWith(matrix.platform, 'windows-') ) && matrix.test-suite == env.anim_test-suite && matrix.python-version == env.anim_python-version
run: |
set -x
mkdir -p $HOME/work/_temp/_github_home/figures
rm /tmp/pytest/test_run_notebooks_*current
ls /tmp/pytest/test_run_notebooks_*/
ls /tmp/pytest/test_run_notebooks_*/output/
ffmpeg -i /tmp/pytest/test_run_notebooks_*/output/docs_intro_animation.ogv -loop 0 -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" $HOME/work/_temp/_github_home/figures/docs_intro_animation_${{ matrix.platform }}.gif
mv /tmp/pytest/test_run_notebooks_*/output/last_animation_frame.pdf $HOME/work/_temp/_github_home/figures/last_animation_frame_${{ matrix.platform }}.pdf
ls $HOME/work/_temp/_github_home/figures
- name: animation movie upload
if: ( ! startsWith(matrix.platform, 'windows-') ) && matrix.test-suite == env.anim_test-suite && matrix.python-version == env.anim_python-version
uses: actions/upload-artifact@v4
with:
name: animation-movie-${{ matrix.platform }}
if-no-files-found: error
path: ~/work/_temp/_github_home/figures/*.gif
- name: animation frame upload
if: ( ! startsWith(matrix.platform, 'windows-') ) && matrix.test-suite == env.anim_test-suite && matrix.python-version == env.anim_python-version
uses: actions/upload-artifact@v4
with:
name: animation-frame-${{ matrix.platform }}
if-no-files-found: error
path: ~/work/_temp/_github_home/figures/*.pdf
- name: tip release upload
if: github.ref == 'refs/heads/main' && ( startsWith(matrix.platform, 'ubuntu-') ) && matrix.test-suite == env.anim_test-suite && matrix.python-version == env.anim_python-version
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: /github/home/figures/*.gif